diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 50809d5..c15af2f 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -1,17 +1,17 @@ -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end vim.opt.rtp:prepend(lazypath) @@ -23,10 +23,10 @@ vim.g.maplocalleader = "\\" -- Setup lazy.nvim require("lazy").setup({ - spec = { - -- import your plugins - { import = "plugins" }, - }, - -- automatically check for plugin updates - checker = { enabled = false }, + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- automatically check for plugin updates + checker = { enabled = false }, }) diff --git a/lua/plugins/README.md b/lua/plugins/README.md index 9c3f2c1..a0c9e74 100644 --- a/lua/plugins/README.md +++ b/lua/plugins/README.md @@ -1,2 +1,4 @@ All plugins what looks like a pure library (as a plenary.nvim) should be use in "depenedencies" filed and with "lazy = true". -Main theme should be load during startup (lazy = false) and high priority. +Main theme should be load during startup (lazy = false) and high priority. +If plugin required a "require("nvim-treesitter.configs").setup(opts)" we can use "main = 'nvim-treesitter.configs'" intead +will use it implicity in "config" and "opts" blocks. diff --git a/lua/plugins/aerial.lua b/lua/plugins/aerial.lua index 0d1bfd1..ecca59a 100644 --- a/lua/plugins/aerial.lua +++ b/lua/plugins/aerial.lua @@ -1,9 +1,9 @@ return { - 'stevearc/aerial.nvim', - opts = {}, - -- Optional dependencies - dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-tree/nvim-web-devicons" - }, + "stevearc/aerial.nvim", + opts = {}, + -- Optional dependencies + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons" + }, } diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index dbe6867..eb91872 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,11 +1,9 @@ return { - { - 'ellisonleao/gruvbox.nvim', - lazy = false, - priority = 1000, - config = function() - vim.cmd([[colorscheme gruvbox]]) - end, - opts = { style = 'dark' } - }, - } -- Main theme should be load during startup. + "ellisonleao/gruvbox.nvim", + lazy = false, + priority = 1000, + config = function() + vim.cmd([[colorscheme gruvbox]]) + end, + opts = { style = "dark" } +} diff --git a/lua/plugins/compile-mode.lua b/lua/plugins/compile-mode.lua index 654165e..68f6855 100644 --- a/lua/plugins/compile-mode.lua +++ b/lua/plugins/compile-mode.lua @@ -1,13 +1,14 @@ -return { 'ej-shafran/compile-mode.nvim', - version = '^5.13.0', +return { + "ej-shafran/compile-mode.nvim", + version = "^5.13.0", dependencies = { - 'nvim-lua/plenary.nvim', lazy = true, - 'm00qek/baleia.nvim' + "nvim-lua/plenary.nvim", lazy = true, + "m00qek/baleia.nvim" }, config = function() ---@type CompileModeOpts vim.g.compile_mode = { - default_command = 'cmake --build build', + default_command = "cmake --build build", input_word_completion = true, baleia_setup = true, bang_expansion = true, diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index d763882..e439e2d 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -1,25 +1,25 @@ return { - 'hrsh7th/nvim-cmp', + "hrsh7th/nvim-cmp", dependencies = { - 'neovim/nvim-lspconfig', - 'hrsh7th/cmp-nvim-lsp', - 'petertriho/cmp-git', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-vsnip', - 'hrsh7th/vim-vsnip', - 'hrsh7th/cmp-nvim-lsp-signature-help', + "neovim/nvim-lspconfig", + "hrsh7th/cmp-nvim-lsp", + "petertriho/cmp-git", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-vsnip", + "hrsh7th/vim-vsnip", + "hrsh7th/cmp-nvim-lsp-signature-help", }, config = function() - local cmp = require'cmp' + local cmp = require"cmp" cmp.setup({ snippet = { -- REQUIRED - you must specify a snippet engine expand = function(args) vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + -- require("snippy").expand_snippet(args.body) -- For `snippy` users. -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. end, }, @@ -28,56 +28,56 @@ return { -- documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. + { name = "nvim_lsp" }, + { name = "vsnip" }, -- For vsnip users. + -- { name = "luasnip" }, -- For luasnip users. + -- { name = "ultisnips" }, -- For ultisnips users. + -- { name = "snippy" }, -- For snippy users. }, { - { name = 'buffer' }, - { name = 'nvim_lsp_signature_help' }, + { name = "buffer" }, + { name = "nvim_lsp_signature_help" }, }) }) -- Set configuration for specific filetype. - cmp.setup.filetype('gitcommit', { + cmp.setup.filetype("gitcommit", { sources = cmp.config.sources({ - { name = 'git' }, + { name = "git" }, }, { - { name = 'buffer' }, + { name = "buffer" }, }) }) - cmp.setup.filetype('cmake', { + cmp.setup.filetype("cmake", { sources = cmp.config.sources({ - { name = 'cmake', "CMakeLists.txt" }, + { name = "cmake", "CMakeLists.txt" }, }, { - { name = 'buffer' }, + { name = "buffer" }, }) }) - -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline({ '/', '?' }, { + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won"t work anymore). + cmp.setup.cmdline({ "/", "?" }, { mapping = cmp.mapping.preset.cmdline(), sources = { - { name = 'buffer' } + { name = "buffer" } } }) - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { + -- Use cmdline & path source for ":" (if you enabled `native_menu`, this won"t work anymore). + cmp.setup.cmdline(":", { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ - { name = 'path' } + { name = "path" } }, { - { name = 'cmdline' } + { name = "cmdline" } }) }) end, diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua index 38c2028..1b4c54a 100644 --- a/lua/plugins/nvim-lspconfig.lua +++ b/lua/plugins/nvim-lspconfig.lua @@ -1,9 +1,9 @@ return { - 'neovim/nvim-lspconfig', + "neovim/nvim-lspconfig", config = function() -- Setup language servers -- Server-specific settings. See `:help lspconfig-all` - vim.lsp.config('*', { + vim.lsp.config("*", { capabilities = { textDocument = { semanticTokens = { @@ -11,47 +11,47 @@ return { } } }, - root_markers = { '.git' }, + root_markers = { ".git" }, }) - vim.lsp.config('clangd', { - cmd = { 'clangd', '--background-index', '--clang-tidy', '--log=verbose', '--header-insertion=never' }, - filetypes = { 'c', 'cpp' } + vim.lsp.config("clangd", { + cmd = { "clangd", "--background-index", "--clang-tidy", "--log=verbose", "--header-insertion=never" }, + filetypes = { "c", "cpp" } }) - vim.lsp.enable('clangd') + vim.lsp.enable("clangd") -- Global mappings. -- See `:help vim.diagnostic.*` for documentation on any of the below functions - vim.keymap.set('n', 'e', vim.diagnostic.open_float) - vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) - vim.keymap.set('n', ']d', vim.diagnostic.goto_next) - vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + vim.keymap.set("n", "e", vim.diagnostic.open_float) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next) + vim.keymap.set("n", "q", vim.diagnostic.setloclist) -- Use LspAttach autocommand to only map the following keys -- after the language server attaches to the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('UserLspConfig', {}), + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = function(ev) -- Enable completion triggered by - vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" -- Buffer local mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local opts = { buffer = ev.buf } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) - vim.keymap.set('n', 'wl', function() + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) - vim.keymap.set('n', 'f', function() + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "f", function() vim.lsp.buf.format { async = true } end, opts) end, diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua index c12b9d6..25cc99c 100644 --- a/lua/plugins/nvim-treesitter.lua +++ b/lua/plugins/nvim-treesitter.lua @@ -1,9 +1,9 @@ return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", - main = 'nvim-treesitter.configs', + main = "nvim-treesitter.configs", opts = { - ensure_installed = { 'c', 'cpp', 'lua' }, + ensure_installed = { "c", "cpp", "lua" }, highlight = { enable = true, } } } diff --git a/lua/plugins/vim-commentary.lua b/lua/plugins/vim-commentary.lua index 3ef4bb3..db3b0cf 100644 --- a/lua/plugins/vim-commentary.lua +++ b/lua/plugins/vim-commentary.lua @@ -1 +1 @@ -return { 'tpope/vim-commentary' } +return { "tpope/vim-commentary" }