From feea9886f598f727aa5b0b53d51d024a873cc115 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 28 Feb 2024 20:14:29 +0100 Subject: [PATCH] update nvim config --- nvim/lazy-lock.json | 14 ++++---- nvim/lua/plugins/cmp.lua | 38 +++++++++++++--------- nvim/lua/plugins/colorscheme.lua | 41 ++++++++++++++++++++++++ nvim/lua/plugins/colortheme-kanagawa.lua | 9 ------ nvim/lua/plugins/indent.lua | 10 +++--- nvim/lua/plugins/init.lua | 3 +- nvim/lua/plugins/kodex.lua | 8 ----- nvim/lua/plugins/lsp.lua | 10 ++++++ nvim/lua/plugins/neo-tree.lua | 12 +++++++ nvim/lua/plugins/treesitter.lua | 24 +++++++------- 10 files changed, 113 insertions(+), 56 deletions(-) create mode 100644 nvim/lua/plugins/colorscheme.lua delete mode 100644 nvim/lua/plugins/colortheme-kanagawa.lua delete mode 100644 nvim/lua/plugins/kodex.lua diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index d95c5e1..721ab23 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -6,20 +6,20 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, - "kanagawa.nvim": { "branch": "master", "commit": "ab41956c4559c3eb21e713fcdf54cda1cb6d5f40" }, "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, - "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, - "neo-tree.nvim": { "branch": "main", "commit": "7d3b02073e59ed9ef271795787de76d0de8f5294" }, + "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, + "neo-tree.nvim": { "branch": "main", "commit": "459c60317cc1d251f6eb3b6f010d015d5d24b806" }, "nui.nvim": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" }, - "nvim-autopairs": { "branch": "master", "commit": "1efb4f2e754d282762a1413ea0528d9a45143cdd" }, + "nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" }, "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, - "nvim-lspconfig": { "branch": "master", "commit": "b22610cc7ceb513396adb8e648abb1d1613b2a82" }, - "nvim-treesitter": { "branch": "master", "commit": "c06292fdc641d71d185d2f1a507ad8232b6cf528" }, - "nvim-web-devicons": { "branch": "master", "commit": "14ac5887110b06b89a96881d534230dac3ed134d" }, + "nvim-lspconfig": { "branch": "master", "commit": "b1a11b042d015df5b8f7f33aa026e501b639c649" }, + "nvim-treesitter": { "branch": "master", "commit": "db12bd416e2764420047e4a5d6b96fe44e4377d5" }, + "nvim-web-devicons": { "branch": "master", "commit": "0bb67ef952ea3eb7b1bac9c011281471d99a27bc" }, + "onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 1b2c0d7..ac86df5 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -16,28 +16,34 @@ return { return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end + local moveDown = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }) + + local moveUp = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i", "s" }) + cmp.setup({ preselect = false, view = { entries = { name = 'custom', selection_order = 'near_cursor' }, }, mapping = { - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { "i", "s" }), + [""] = moveDown, + [""] = moveDown, + [""] = moveUp, + [""] = moveUp, [''] = cmp.mapping.confirm({ select = true }), }, formatting = { diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..37e4a51 --- /dev/null +++ b/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,41 @@ +return { + "navarasu/onedark.nvim", + lazy = false, + priority = 1000, + opts = { + style = 'darker', + code_style = { + comments = 'none', + keywords = 'none', + functions = 'none', + strings = 'none', + variables = 'none' + }, + colors = { + fg = '#ffffff', + bg0 = '#282a33', + bg1 = '#30323b', + bg2 = '#24262f', + bg_d = "#1f2129", + red = '#cc817f', + green = '#7ccfaf', + yellow = '#ffcc99', + blue = '#8ac6f2', + cyan = '#8abeb7', + purple = '#9999cc' + }, + highlights = { + ["@string"] = { fg = "$purple" }, + ["@function"] = { fg = "$fg" }, + ["@keyword"] = { fg = "$yellow" }, + ["@variable.parameter"] = { fg = "$fg" }, + ["@punctuation.delimiter"] = { fg = "$fg" }, + ["@punctuation.bracket"] = { fg = "$fg" } + } + }, + config = function(_, opts) + local c = require('onedark') + c.setup(opts) + c.load() + end +} diff --git a/nvim/lua/plugins/colortheme-kanagawa.lua b/nvim/lua/plugins/colortheme-kanagawa.lua deleted file mode 100644 index 402353d..0000000 --- a/nvim/lua/plugins/colortheme-kanagawa.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "rebelot/kanagawa.nvim", - lazy = false, - priority = 1000, - config = function() - require("kanagawa").load("wave") - end -} - diff --git a/nvim/lua/plugins/indent.lua b/nvim/lua/plugins/indent.lua index 5b4f38f..f73eb17 100644 --- a/nvim/lua/plugins/indent.lua +++ b/nvim/lua/plugins/indent.lua @@ -1,8 +1,10 @@ return { "lukas-reineke/indent-blankline.nvim", main = "ibl", - opts = {}, - config = function() - require("ibl").setup() - end + opts = { + scope = { + enabled = true, + show_exact_scope = true + } + }, } diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index f2d72b6..fa06645 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -14,10 +14,11 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup({ -- Highlight - { import = "plugins.colortheme-kanagawa" }, + { import = "plugins.colorscheme" }, { import = "plugins.indent" }, { import = "plugins.nvim-autopairs" }, + -- Filetree { import = "plugins.neo-tree" }, diff --git a/nvim/lua/plugins/kodex.lua b/nvim/lua/plugins/kodex.lua deleted file mode 100644 index 3326a9d..0000000 --- a/nvim/lua/plugins/kodex.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - dir = "~/code/misc/kodex.nvim", - lazy = false, - priority = 1000, - config = function() - vim.cmd(":colorscheme kodex-arctic") - end -} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index afadf82..b6ff79e 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -30,7 +30,17 @@ return { lspconfig.gopls.setup({}) -- Tailwind CSS --require('lspconfig').tailwindcss.setup({ capabilities = capabilities }) + + -- Format on save. + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = '*.go', + callback = function() + vim.lsp.buf.format { async = false } + end + }) + -- Typescript + lspconfig.tsserver.setup({}) -- Config -- Sign configuration diff --git a/nvim/lua/plugins/neo-tree.lua b/nvim/lua/plugins/neo-tree.lua index b7b3e08..8c8c0fd 100644 --- a/nvim/lua/plugins/neo-tree.lua +++ b/nvim/lua/plugins/neo-tree.lua @@ -45,5 +45,17 @@ return { } }, }, + filesystem = { + filtered_items = { + visible = true, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + "node_modules", + "vendor", + }, + }, + }, } } diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index e80490b..c118157 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -8,7 +8,8 @@ return { }, opts = { -- A list of parser names - ensure_installed = { + ensure_installed = { + "bash", "c", "cpp", "ninja", @@ -30,20 +31,18 @@ return { "toml", "xml", "glsl", - "hlsl" + "hlsl", + "markdown" }, -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, + sync_install = true, - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = false, - ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) - -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! - - highlight = { + highlight = { enable = true, -- Setting this to true will run `:h syntax` and tree-sitter at the same time. @@ -56,5 +55,8 @@ return { indent = { enable = true } - } + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, }