diff --git a/modules/neovim.nix b/modules/neovim.nix index 6ede21c..37362be 100644 --- a/modules/neovim.nix +++ b/modules/neovim.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, machine, ... }: { home.sessionVariables = { @@ -53,7 +53,7 @@ nodePackages.yaml-language-server # etc - deno + unstable.deno ltex-ls nodePackages.prettier rnix-lsp @@ -64,6 +64,7 @@ shfmt tree-sitter (callPackage ../packages/jq-lsp {}) + (callPackage ../packages/helm-ls {}) # needed for some plugin build steps cargo @@ -75,7 +76,7 @@ }; xdg.configFile."nvim" = { - source = config.lib.file.mkOutOfStoreSymlink ./nvim; + source = config.lib.file.mkOutOfStoreSymlink "${machine.flakePath}/modules/nvim"; recursive = true; }; } diff --git a/modules/nvim/after/plugin/bufferline.lua b/modules/nvim/after/plugin/bufferline.lua index f9cc21c..7331dbf 100644 --- a/modules/nvim/after/plugin/bufferline.lua +++ b/modules/nvim/after/plugin/bufferline.lua @@ -3,16 +3,61 @@ if not present then return end +local ctp_present, ctp = + pcall(require, "catppuccin.groups.integrations.bufferline") +local ctp_bufferline +if not ctp_present then + ctp_bufferline = {} +else + ctp_bufferline = ctp.get() +end + +local v = vim.version() +local vStr = string.format("v%d.%d.%d", v.major, v.minor, v.patch) + bufferline.setup({ - highlights = require("catppuccin.groups.integrations.bufferline").get(), + highlights = ctp_bufferline, options = { show_close_icon = false, - separator_style = "thin", show_buffer_close_icons = false, - offsets = { { filetype = "NvimTree" } }, + offsets = { + { + filetype = "NvimTree", + text = "  neovim " .. vStr, + text_align = "left", + separator = "║", + }, + }, left_mouse_command = "buffer %d", middle_mouse_command = "bdelete! %d", right_mouse_command = nil, + indicator = { icon = "‣" }, + numbers = function(tab) + local roman = { + "Ⅰ", + "Ⅱ", + "Ⅲ", + "Ⅳ", + "Ⅴ", + "Ⅵ", + "Ⅶ", + "Ⅷ", + "Ⅸ", + "Ⅹ", + "Ⅺ", + "Ⅻ", + "XⅢ", + "XⅣ", + "ⅩⅤ", + "ⅩⅥ", + "ⅩⅦ", + "ⅩⅧ", + "ⅩⅨ", + "ⅩⅩ", + } + + return string.format("%s ", roman[tab.ordinal]) + end, }, }) diff --git a/modules/nvim/after/plugin/catppuccin.lua b/modules/nvim/after/plugin/catppuccin.lua index 7c1cd38..2318263 100644 --- a/modules/nvim/after/plugin/catppuccin.lua +++ b/modules/nvim/after/plugin/catppuccin.lua @@ -86,6 +86,10 @@ catppuccin.setup({ TelescopeSelectionCaret = { link = "Selection" }, -- pmenu PmenuSel = { link = "Selection" }, + -- bufferline + BufferLineTabSeparator = { link = "FloatBorder" }, + BufferLineSeparator = { link = "FloatBorder" }, + BufferLineOffsetSeparator = { link = "FloatBorder" }, } end, mocha = function(colors) diff --git a/modules/nvim/after/plugin/feline.lua b/modules/nvim/after/plugin/feline.lua index 36badca..42f4f9d 100644 --- a/modules/nvim/after/plugin/feline.lua +++ b/modules/nvim/after/plugin/feline.lua @@ -1,12 +1,16 @@ -local ctp_present, ctp_feline = - pcall(require, "catppuccin.groups.integrations.feline") -local present, feline = pcall(require, "feline") +local get_config = function() + -- unload these if loaded, so that theme switching works + package.loaded["feline"] = nil + package.loaded["catppuccin.groups.integrations.feline"] = nil -if not present then - return -end + local present, feline = pcall(require, "feline") + local ctp_present, ctp_feline = + pcall(require, "catppuccin.groups.integrations.feline") + + if not (present and ctp_present) then + return + end -if ctp_present then local clrs = require("catppuccin.palettes").get_palette() ctp_feline.setup({ assets = { @@ -14,17 +18,20 @@ if ctp_present then right_separator = "", bar = "█", mode_icon = " ", - dir = "  ", - file = "  ", + dir = " ", + file = " ", git = { branch = " ", + added = " ", + changed = " ", + removed = " ", }, lsp = { - server = "  ", - error = "  ", - warning = "  ", - info = "  ", - hint = "  ", + server = " ", + error = " ", + warning = " ", + info = " ", + hint = " ", }, }, sett = { @@ -37,21 +44,30 @@ if ctp_present then ["n"] = { "NORMAL", clrs.blue }, }, }) + + feline.setup({ + components = ctp_feline.get(), + force_inactive = { + filetypes = { + "^startify$", + "^fugitive$", + "^fugitiveblame$", + "^qf$", + "^help$", + }, + buftypes = { + "^terminal$", + }, + bufnames = {}, + }, + }) end -feline.setup({ - components = ctp_feline.get(), - force_inactive = { - filetypes = { - "^startify$", - "^fugitive$", - "^fugitiveblame$", - "^qf$", - "^help$", - }, - buftypes = { - "^terminal$", - }, - bufnames = {}, - }, +get_config() + +vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + callback = function() + get_config() + end, }) diff --git a/modules/nvim/after/plugin/lsp.lua b/modules/nvim/after/plugin/lsp.lua index 0dbf38e..0be5b32 100644 --- a/modules/nvim/after/plugin/lsp.lua +++ b/modules/nvim/after/plugin/lsp.lua @@ -13,10 +13,10 @@ local has_words_before = function() ---@diagnostic disable-next-line: deprecated local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 - and vim.api - .nvim_buf_get_lines(0, line - 1, line, true)[1] - :sub(col, col) - :match("%s") + and vim.api + .nvim_buf_get_lines(0, line - 1, line, true)[1] + :sub(col, col) + :match("%s") == nil end @@ -435,3 +435,23 @@ require("py_lsp").setup({ capabilities = capabilities, on_attach = on_attach, }) + +local configs = require("lspconfig.configs") +local util = require("lspconfig.util") + +if not configs.helm_ls then + configs.helm_ls = { + default_config = { + cmd = { "helm-ls", "serve" }, + filetypes = { "helm" }, + root_dir = function(fname) + return util.root_pattern("Chart.yaml")(fname) + end, + }, + } +end + +lspconfig.helm_ls.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) diff --git a/modules/nvim/after/plugin/nvim-tree.lua b/modules/nvim/after/plugin/nvim-tree.lua new file mode 100644 index 0000000..ce3f2c9 --- /dev/null +++ b/modules/nvim/after/plugin/nvim-tree.lua @@ -0,0 +1,16 @@ +local present, nvimtree = pcall(require, "nvim-tree") + +if not present then + return +end + +nvimtree.setup({ + renderer = { + indent_markers = { + enable = true, + }, + }, + diagnostics = { + enable = true, + }, +}) diff --git a/modules/nvim/after/plugin/treesitter.lua b/modules/nvim/after/plugin/treesitter.lua index 85f02f1..9b3a3a4 100644 --- a/modules/nvim/after/plugin/treesitter.lua +++ b/modules/nvim/after/plugin/treesitter.lua @@ -1,5 +1,20 @@ local present, treesitter = pcall(require, "nvim-treesitter.configs") -if not present then return end +if not present then + return +end + +local parser_config = require("nvim-treesitter.parsers").get_parser_configs() +parser_config.gotmpl = { + install_info = { + url = "https://github.com/ngalaiko/tree-sitter-go-template", + files = { "src/parser.c" }, + }, + filetype = "gotmpl", + used_by = { "gohtmltmpl", "gotexttmpl", "gotmpl", "yaml", "helm" }, +} + +local ft_to_parser = require("nvim-treesitter.parsers").filetype_to_parsername +ft_to_parser.helm = "gotmpl" treesitter.setup({ auto_install = true, diff --git a/modules/nvim/init.lua b/modules/nvim/init.lua index c943f4e..430e169 100644 --- a/modules/nvim/init.lua +++ b/modules/nvim/init.lua @@ -32,6 +32,16 @@ vim.o.shiftwidth = 2 vim.o.tabstop = 2 vim.o.softtabstop = 0 vim.o.expandtab = true +-- double box drawing characters for splits +vim.opt.fillchars:append({ + horiz = "═", + horizup = "╩", + horizdown = "╦", + vert = "║", + vertright = "╠", + vertleft = "╣", + verthoriz = "╬", +}) pcall(require, "plugins") pcall(require, "binds") diff --git a/modules/nvim/lazy-lock.json b/modules/nvim/lazy-lock.json index dd651c9..56614ef 100644 --- a/modules/nvim/lazy-lock.json +++ b/modules/nvim/lazy-lock.json @@ -19,26 +19,26 @@ "fidget.nvim": { "branch": "main", "commit": "9dc6d15fdb877b2fb09ea0ba2dfde9beccb5965a" }, "friendly-snippets": { "branch": "main", "commit": "a6f7a1609addb4e57daa6bedc300f77f8d225ab7" }, "gitsigns.nvim": { "branch": "main", "commit": "ec4742a7eebf68bec663041d359b95637242b5c3" }, - "go.nvim": { "branch": "master", "commit": "87263fbeff01d796cc38523bf8488cc0a2fb7a42" }, + "go.nvim": { "branch": "master", "commit": "470349cff528448969efeca65b2f9bdb64730e1b" }, "guihua.lua": { "branch": "master", "commit": "dca755457a994d99f3fe63ee29dbf8e2ac20ae3a" }, "indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" }, - "lazy.nvim": { "branch": "main", "commit": "326556008a1574389be7fa9d670abada10ce1323" }, + "lazy.nvim": { "branch": "main", "commit": "ddaffa07156a090383bd32ef88669eea1b22c11a" }, "lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" }, "lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, "ltex-extra.nvim": { "branch": "master", "commit": "1d2f288ceedc70d5a9c00f55c0d0cc788b5164f2" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "neogit": { "branch": "master", "commit": "089d388876a535032ac6a3f80e19420f09e4ddda" }, "null-ls.nvim": { "branch": "main", "commit": "60b4a7167c79c7d04d1ff48b55f2235bf58158a7" }, - "nvim-autopairs": { "branch": "master", "commit": "28f57e6a6f0b37ec52c257230990b81afa1863e4" }, + "nvim-autopairs": { "branch": "master", "commit": "45ae3122a4c7744db41298b41f9f5a3f092123e6" }, "nvim-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" }, "nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" }, - "nvim-dap": { "branch": "master", "commit": "0e376f00e7fac143e29e1017d2ac2cc3df13d185" }, - "nvim-dap-ui": { "branch": "master", "commit": "885e958ff9de30cfbc359259eccf28cc493ad46b" }, + "nvim-dap": { "branch": "master", "commit": "0d77088e0a3532ae653996abbefb8d951b4ed7ac" }, + "nvim-dap-ui": { "branch": "master", "commit": "94aa67d7bd60d3dffa5cd1967c2cefa6ba906406" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "7f7f2af549e72a0b7bddc3b4f827beb027ea8ce3" }, - "nvim-lspconfig": { "branch": "master", "commit": "d3c82d2f9a6fd91ec1ffee645664d2cc57e706d9" }, - "nvim-surround": { "branch": "main", "commit": "ad56e6234bf42fb7f7e4dccc7752e25abd5ec80e" }, + "nvim-lspconfig": { "branch": "master", "commit": "aeb76066212b09c7c01a3abb42fe82f0130ef402" }, + "nvim-surround": { "branch": "main", "commit": "c0835d2a33898b1509e804b7a3ad49737b90d98a" }, "nvim-tree.lua": { "branch": "master", "commit": "02fdc262eba188198a7deb2117b3b996e6763d65" }, - "nvim-treesitter": { "branch": "master", "commit": "d3a68725e8349212a359d1914fc6e86ff31e4142" }, + "nvim-treesitter": { "branch": "master", "commit": "f6df07be122de665fb363476cc3680c90f5bdf05" }, "nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" }, "nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" }, "nvim-web-devicons": { "branch": "master", "commit": "ade34ca7d19543904b28b903e606be8930fb9ee3" }, @@ -55,8 +55,7 @@ "telescope-project.nvim": { "branch": "master", "commit": "8e8ee37b7210761502cdf2c3a82b5ba8fb5b2972" }, "telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" }, "todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" }, - "tree-sitter-just": { "branch": "main", "commit": "8af0aab79854aaf25b620a52c39485849922f766" }, - "trouble.nvim": { "branch": "main", "commit": "490f7fe6d227f4f7a64f00be8c7dcd7a508ed271" }, + "trouble.nvim": { "branch": "main", "commit": "fc003424b02109f1453af6b40dadff6019b97187" }, "true-zen.nvim": { "branch": "main", "commit": "98740c76254c65576ec294551028b65081053588" }, "vim-astro": { "branch": "main", "commit": "34732be5e9a5c28c2409f4490edf92d46d8b55a9" }, "vim-dadbod": { "branch": "master", "commit": "a09e40664e9cd30cd2b3f8866b796598302070f6" }, @@ -64,6 +63,7 @@ "vim-dadbod-ui": { "branch": "master", "commit": "f4ead480930a37dd2b0cf917a8c387ed36c2d86a" }, "vim-fugitive": { "branch": "master", "commit": "2019e0e4139390f485a024d7a2411218b004a5b3" }, "vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" }, + "vim-helm": { "branch": "master", "commit": "c2e7b85711d410e1d73e64eb5df7b70b1c4c10eb" }, "vim-table-mode": { "branch": "master", "commit": "9555a3e6e5bcf285ec181b7fc983eea90500feb4" }, "vim-vsnip": { "branch": "master", "commit": "8dde8c0ef10bb1afdbb301e2bd7eb1c153dd558e" }, "which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" } diff --git a/modules/nvim/lua/plugins.lua b/modules/nvim/lua/plugins.lua index 067b9b7..9b6e060 100644 --- a/modules/nvim/lua/plugins.lua +++ b/modules/nvim/lua/plugins.lua @@ -89,7 +89,7 @@ local plugins = { -- nvimtree "nvim-tree/nvim-web-devicons", - { "nvim-tree/nvim-tree.lua", opts = {} }, + "nvim-tree/nvim-tree.lua", "stevearc/dressing.nvim", @@ -97,6 +97,7 @@ local plugins = { "andweeb/presence.nvim", { "iamcco/markdown-preview.nvim", build = "cd app && yarn install" }, + "towolf/vim-helm", -- LSP { "neovim/nvim-lspconfig", diff --git a/packages/helm-ls/default.nix b/packages/helm-ls/default.nix new file mode 100644 index 0000000..275b922 --- /dev/null +++ b/packages/helm-ls/default.nix @@ -0,0 +1,22 @@ +{ buildGoModule, fetchFromGitHub, lib, pkgs, ... }: + +buildGoModule rec { + pname = "helm-ls"; + version = "20220912"; + + src = fetchFromGitHub { + owner = "mrjosh"; + repo = "helm-ls"; + rev = "1552f4be6b43eb3fc6c61ce056f1d28f36650c62"; + sha256 = "sha256-YSK7PBsk/NXsM7bFg6ebqiYDH94vsK45vMpZtDJqLnk="; + }; + + vendorSha256 = "sha256-EqZlmOoQtC3Iuf0LG2PL0K2pluGqbyA6132lzgF4+ic="; + + meta = with lib; { + description = "helm language server"; + homepage = "https://github.com/mrjosh/helm-ls"; + license = licenses.mit; + maintainers = [ maintainers.nekowinston ]; + }; +}