diff --git a/lua/base/other.lua b/lua/base/other.lua index 1050274..fb1914c 100644 --- a/lua/base/other.lua +++ b/lua/base/other.lua @@ -39,26 +39,26 @@ opt.mouse = "a" vim.filetype.add({ extension = { - vp = "glsl", - fp = "glsl", - gp = "glsl", - vs = "glsl", - fs = "glsl", - gs = "glsl", - tcs = "glsl", - tes = "glsl", - cs = "glsl", - vert = "glsl", - frag = "glsl", - geom = "glsl", - tess = "glsl", - shd = "glsl", - gls = "glsl", - glsl = "glsl", - rgen = "glsl", - comp = "glsl", - rchit = "glsl", - rahit = "glsl", - rmiss = "glsl", + vp = 'glsl', + fp = 'glsl', + gp = 'glsl', + vs = 'glsl', + fs = 'glsl', + gs = 'glsl', + tcs = 'glsl', + tes = 'glsl', + cs = 'glsl', + vert = 'glsl', + frag = 'glsl', + geom = 'glsl', + tess = 'glsl', + shd = 'glsl', + gls = 'glsl', + glsl = 'glsl', + rgen = 'glsl', + comp = 'glsl', + rchit = 'glsl', + rahit = 'glsl', + rmiss = 'glsl', } }) diff --git a/lua/base/tabs.lua b/lua/base/tabs.lua index da0ad9d..6e75514 100644 --- a/lua/base/tabs.lua +++ b/lua/base/tabs.lua @@ -22,4 +22,4 @@ opt.scrolloff = 8 -- Show unprintable. opt.list = true -opt.listchars = {tab = "⁞ ", eol = "¬", trail = "·"} +opt.listchars = {tab = '⁞ ', eol = '¬', trail = '·'} diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index c15af2f..50809d5 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 a0c9e74..9c3f2c1 100644 --- a/lua/plugins/README.md +++ b/lua/plugins/README.md @@ -1,4 +1,2 @@ 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. -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. +Main theme should be load during startup (lazy = false) and high priority. diff --git a/lua/plugins/aerial.lua b/lua/plugins/aerial.lua index ecca59a..0d1bfd1 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 eb91872..dbe6867 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,9 +1,11 @@ return { - "ellisonleao/gruvbox.nvim", - lazy = false, - priority = 1000, - config = function() - vim.cmd([[colorscheme gruvbox]]) - end, - opts = { style = "dark" } -} + { + 'ellisonleao/gruvbox.nvim', + lazy = false, + priority = 1000, + config = function() + vim.cmd([[colorscheme gruvbox]]) + end, + opts = { style = 'dark' } + }, + } -- Main theme should be load during startup. diff --git a/lua/plugins/compile-mode.lua b/lua/plugins/compile-mode.lua index 68f6855..519ecec 100644 --- a/lua/plugins/compile-mode.lua +++ b/lua/plugins/compile-mode.lua @@ -1,14 +1,13 @@ -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 e439e2d..da5896f 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -1,25 +1,24 @@ 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', + '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 +27,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' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-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 1b4c54a..38c2028 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 25cc99c..c354970 100644 --- a/lua/plugins/nvim-treesitter.lua +++ b/lua/plugins/nvim-treesitter.lua @@ -1,9 +1,9 @@ -return { - "nvim-treesitter/nvim-treesitter", +return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", - main = "nvim-treesitter.configs", - opts = { - ensure_installed = { "c", "cpp", "lua" }, - highlight = { enable = true, } - } + config = function() + require("nvim-treesitter.configs").setup { + ensure_installed = { 'c', 'cpp', 'lua' }, + highlight = { enable = true, } + } + end } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index af0ed08..d22dc9a 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,6 +1,6 @@ return { 'nvim-telescope/telescope.nvim', tag = '0.1.8', - dependencies = { 'nvim-lua/plenary.nvim', lazy = true, 'nvim-tree/nvim-web-devicons', + dependencies = { 'nvim-lua/plenary.nvim', lazy = true, { 'nvim-telescope/telescope-fzf-native.nvim', build = (build_cmd ~= 'cmake') and 'make' @@ -25,6 +25,7 @@ return { } telescope.load_extension('fzf') + -- TODO: use keys = { } local builtin = require('telescope.builtin') vim.keymap.set('n', '', builtin.find_files, {}) vim.keymap.set('n', 'ft', builtin.treesitter, {}) diff --git a/lua/plugins/vim-commentary.lua b/lua/plugins/vim-commentary.lua index db3b0cf..3ef4bb3 100644 --- a/lua/plugins/vim-commentary.lua +++ b/lua/plugins/vim-commentary.lua @@ -1 +1 @@ -return { "tpope/vim-commentary" } +return { 'tpope/vim-commentary' }