From 0725a938cae00b558de61c19343133b2f9f05ff0 Mon Sep 17 00:00:00 2001 From: mekb the turtle Date: Sun, 9 Apr 2023 11:02:26 +1000 Subject: [PATCH] :tada: initial commit Co-authored-by: CallMeEchoCodes --- .editorconfig | 9 ++++ .gitignore | 2 + init.lua | 3 ++ lua/core/init.lua | 79 ++++++++++++++++++++++++++++++ lua/plugins/configs/bufferline.lua | 47 ++++++++++++++++++ lua/plugins/configs/catppuccin.lua | 17 +++++++ lua/plugins/configs/nvim-tree.lua | 11 +++++ lua/plugins/configs/presence.lua | 8 +++ lua/plugins/configs/treesitter.lua | 36 ++++++++++++++ lua/plugins/init.lua | 78 +++++++++++++++++++++++++++++ 10 files changed, 290 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 init.lua create mode 100644 lua/core/init.lua create mode 100644 lua/plugins/configs/bufferline.lua create mode 100644 lua/plugins/configs/catppuccin.lua create mode 100644 lua/plugins/configs/nvim-tree.lua create mode 100644 lua/plugins/configs/presence.lua create mode 100644 lua/plugins/configs/treesitter.lua create mode 100644 lua/plugins/init.lua diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..81b7546 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = tab +tab_width = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..50c430c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +lazy-lock.json +vimrc.old.vim diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..1544509 --- /dev/null +++ b/init.lua @@ -0,0 +1,3 @@ +if not vim.g.vscode then + require("core") +end diff --git a/lua/core/init.lua b/lua/core/init.lua new file mode 100644 index 0000000..e43df19 --- /dev/null +++ b/lua/core/init.lua @@ -0,0 +1,79 @@ +local o, g = vim.o, vim.g + +-- Terminal cursor +-- o.guicursor = "" + +-- Line numbers +o.number = true +o.relativenumber = true +o.number = 2 + +-- Clipboard +o.clipboard = "unnamedplus" + +-- Indentation +o.autoindent = true +o.expandtab = false +o.shiftwidth = 4 +o.smartindent = true +o.tabstop = 4 +o.softtabstop = 4 + +-- Wildcard menu +o.wildmenu = true + +-- Mouse +o.mouse = "a" + +-- Disable netrw +g.loaded_netrw = 1 +g.loaded_netrwPlugin = 1 + +-- Use terminal colours +o.termguicolors = true + +-- Wrap moving cursor horizontal to next/previous lines +-- vim.opt.whichwrap:append("<>[]hl") + +-- Leaders +g.mapleader = " " + +-- Neovide +vim.api.nvim_set_option_value("guifont", "Fira Code,Symbols Nerd Font,Twemoji:h12", {}) +g.neovide_refresh_rate = 60 +g.neovide_cursor_animation_length = 0.03 +g.neovide_cursor_trail_length = 0.05 +g.neovide_cursor_antialiasing = true +g.neovide_transparency = 0.2 +g.neovide_cursor_vfx_mode = "railgun" + +-- Keybinds +function map(mode, keystroke, out) + vim.api.nvim_set_keymap(mode, keystroke, out, { + noremap = true, + silent = true, + }) +end + +-- Tab keybinds +map('n', '', ':BufferLineCycleNext') +map('n', '', ':BufferLineCyclePrev') +map('n', '', ':BufferLineMoveNext') +map('n', '', ':BufferLineMovePrev') +map('n', '', ':BufferLineCycleNext') +map('n', '', ':BufferLineCyclePrev') +map('n', '', ':bd') +map('n', '', ':enew') + +-- Other keybinds +map('n', '', ':let @/ = ""') +map('n', '', 'g') +map('n', '', 'g') +map('n', '', 'db') +map('n', '', 'dw') +map('n', '', '/') +map('n', '', ':set nowrap!') +map('n', '', ':w') + +-- Plugins +require("plugins") diff --git a/lua/plugins/configs/bufferline.lua b/lua/plugins/configs/bufferline.lua new file mode 100644 index 0000000..0f02921 --- /dev/null +++ b/lua/plugins/configs/bufferline.lua @@ -0,0 +1,47 @@ +return function() + local ctp = require("catppuccin.palettes").get_palette() + + require("bufferline").setup({ + options = { + max_name_length = 14, + max_prefix_length = 10, + tab_size = 20, + + color_icons = true, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_buffer_default_icon = true, + show_close_icon = true, + show_tab_indicators = true, + + enforce_regular_tabs = true, + persist_buffer_sort = true, + always_show_bufferline = true, + + separator_style = "thin", + + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count) + return "(" .. count .. ")" + end, + offsets = { + { + filetype = "NvimTree", + text = "", + text_align = "center", + padding = 1, + }, + { + filetype = "lspsagaoutline", + text = "Lspsaga Outline", + text_align = "center", + padding = 1, + }, + }, + }, + + highlights = require("catppuccin.groups.integrations.bufferline").get({ + styles = { "italic", "bold" }, + }), + }) +end \ No newline at end of file diff --git a/lua/plugins/configs/catppuccin.lua b/lua/plugins/configs/catppuccin.lua new file mode 100644 index 0000000..9e50791 --- /dev/null +++ b/lua/plugins/configs/catppuccin.lua @@ -0,0 +1,17 @@ +return function() + require("catppuccin").setup({ + flavour = "mocha", + term_colors = true, + transparent_background = vim.g.neovide == nil, + integrations = { + treesitter = true, + nvimtree = true, + notify = true, + telescope = true, + ts_rainbow = true, + }, + show_end_of_buffer = true, + }) + + vim.cmd.colorscheme("catppuccin") +end diff --git a/lua/plugins/configs/nvim-tree.lua b/lua/plugins/configs/nvim-tree.lua new file mode 100644 index 0000000..17e3332 --- /dev/null +++ b/lua/plugins/configs/nvim-tree.lua @@ -0,0 +1,11 @@ +return function() + require("nvim-tree").setup({ + sort_by = "case_sensitive", + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + }) +end diff --git a/lua/plugins/configs/presence.lua b/lua/plugins/configs/presence.lua new file mode 100644 index 0000000..174fc58 --- /dev/null +++ b/lua/plugins/configs/presence.lua @@ -0,0 +1,8 @@ +return function() + require("presence").setup({ + main_image = "file", + enable_line_number = false, + show_time = false, + neovim_image_text = "Neovim", + }) +end diff --git a/lua/plugins/configs/treesitter.lua b/lua/plugins/configs/treesitter.lua new file mode 100644 index 0000000..8907698 --- /dev/null +++ b/lua/plugins/configs/treesitter.lua @@ -0,0 +1,36 @@ +return vim.schedule_wrap( + function() + vim.api.nvim_set_option_value("foldmethod", "manual", {}) + vim.api.nvim_set_option_value("foldexpr", "nvim_treesitter#foldexpr()", {}) + + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "bash", + "c", + "cpp", + "css", + "cmake", + "html", + "javascript", + "json", + "make", + "markdown", + "markdown_inline", + "python", + "rust", + "typescript", + "yaml", + "java", + "c_sharp", + "lua", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "go", + "jq", + } + }) + require("nvim-treesitter.install").prefer_git = true + end +) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..6d3a600 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,78 @@ +-- Load lazy +local lazy_path = vim.fn.stdpath("data") .. "lazy/lazy.nvim" +if not vim.loop.fs_stat(lazy_path) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazy_path + }) +end + +vim.opt.rtp:prepend(lazy_path) + +-- Lazy settings +local lazy_settings = { + git = { + timeout = 300, + }, + install = { + colorscheme = { "catppuccin" }, + }, + ui = { + border = "rounded", + }, +} + +-- Lazy plugins +local lazy_plugins = { + { + "catppuccin/nvim", + name = "catppuccin", + config = require("plugins.configs.catppuccin"), + priority = 99, + }, + { + "nvim-treesitter/nvim-treesitter", + lazy = true, + build = function() + if #vim.api.nvim_list_uis() ~= 0 then + vim.api.nvim_command("TSUpdate") + end + end, + event = { "CursorHold", "CursorHoldI" }, + dependencies = { + { "andymass/vim-matchup" }, + { "mrjones2014/nvim-ts-rainbow" }, + }, + config = require("plugins.configs.treesitter"), + }, + { + "andweeb/presence.nvim", + config = require("plugins.configs.presence"), + }, + { + "akinsho/bufferline.nvim", + version = "v3.*", + dependencies = "nvim-tree/nvim-web-devicons", + lazy = true, + event = { "BufReadPost", "BufAdd", "BufNewFile" }, + config = require("plugins.configs.bufferline") + }, + { + "nvim-tree/nvim-tree.lua", + lazy = true, + cmd = { + "NvimTreeToggle", + "NvimTreeOpen", + "NvimTreeFindFile", + "NvimTreeFindFileToggle", + "NvimTreeRefresh", + }, + config = require("plugins.configs.nvim-tree") + }, +} + +require("lazy").setup(lazy_plugins, lazy_settings)