feat(nvim): various updates

This commit is contained in:
winston 2023-02-09 16:42:53 +01:00
parent ea687fe813
commit 893241c9d8
Signed by: winston
GPG key ID: 3786770EDBC2B481
11 changed files with 201 additions and 51 deletions

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, pkgs, machine, ... }:
{ {
home.sessionVariables = { home.sessionVariables = {
@ -53,7 +53,7 @@
nodePackages.yaml-language-server nodePackages.yaml-language-server
# etc # etc
deno unstable.deno
ltex-ls ltex-ls
nodePackages.prettier nodePackages.prettier
rnix-lsp rnix-lsp
@ -64,6 +64,7 @@
shfmt shfmt
tree-sitter tree-sitter
(callPackage ../packages/jq-lsp {}) (callPackage ../packages/jq-lsp {})
(callPackage ../packages/helm-ls {})
# needed for some plugin build steps # needed for some plugin build steps
cargo cargo
@ -75,7 +76,7 @@
}; };
xdg.configFile."nvim" = { xdg.configFile."nvim" = {
source = config.lib.file.mkOutOfStoreSymlink ./nvim; source = config.lib.file.mkOutOfStoreSymlink "${machine.flakePath}/modules/nvim";
recursive = true; recursive = true;
}; };
} }

View file

@ -3,16 +3,61 @@ if not present then
return return
end 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({ bufferline.setup({
highlights = require("catppuccin.groups.integrations.bufferline").get(), highlights = ctp_bufferline,
options = { options = {
show_close_icon = false, show_close_icon = false,
separator_style = "thin",
show_buffer_close_icons = false, show_buffer_close_icons = false,
offsets = { { filetype = "NvimTree" } }, offsets = {
{
filetype = "NvimTree",
text = "  neovim " .. vStr,
text_align = "left",
separator = "",
},
},
left_mouse_command = "buffer %d", left_mouse_command = "buffer %d",
middle_mouse_command = "bdelete! %d", middle_mouse_command = "bdelete! %d",
right_mouse_command = nil, right_mouse_command = nil,
indicator = { icon = "" },
numbers = function(tab)
local roman = {
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"XⅢ",
"XⅣ",
"",
"ⅩⅥ",
"ⅩⅦ",
"ⅩⅧ",
"ⅩⅨ",
"",
}
return string.format("%s ", roman[tab.ordinal])
end,
}, },
}) })

View file

@ -86,6 +86,10 @@ catppuccin.setup({
TelescopeSelectionCaret = { link = "Selection" }, TelescopeSelectionCaret = { link = "Selection" },
-- pmenu -- pmenu
PmenuSel = { link = "Selection" }, PmenuSel = { link = "Selection" },
-- bufferline
BufferLineTabSeparator = { link = "FloatBorder" },
BufferLineSeparator = { link = "FloatBorder" },
BufferLineOffsetSeparator = { link = "FloatBorder" },
} }
end, end,
mocha = function(colors) mocha = function(colors)

View file

@ -1,12 +1,16 @@
local ctp_present, ctp_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
local present, feline = pcall(require, "feline")
local ctp_present, ctp_feline =
pcall(require, "catppuccin.groups.integrations.feline") pcall(require, "catppuccin.groups.integrations.feline")
local present, feline = pcall(require, "feline")
if not present then if not (present and ctp_present) then
return return
end end
if ctp_present then
local clrs = require("catppuccin.palettes").get_palette() local clrs = require("catppuccin.palettes").get_palette()
ctp_feline.setup({ ctp_feline.setup({
assets = { assets = {
@ -14,17 +18,20 @@ if ctp_present then
right_separator = "", right_separator = "",
bar = "", bar = "",
mode_icon = "", mode_icon = "",
dir = " ", dir = "",
file = " ", file = "",
git = { git = {
branch = "", branch = "",
added = "",
changed = "",
removed = "",
}, },
lsp = { lsp = {
server = "", server = "",
error = " ", error = "",
warning = " ", warning = "",
info = " ", info = "",
hint = " ", hint = "",
}, },
}, },
sett = { sett = {
@ -37,9 +44,8 @@ if ctp_present then
["n"] = { "NORMAL", clrs.blue }, ["n"] = { "NORMAL", clrs.blue },
}, },
}) })
end
feline.setup({ feline.setup({
components = ctp_feline.get(), components = ctp_feline.get(),
force_inactive = { force_inactive = {
filetypes = { filetypes = {
@ -54,4 +60,14 @@ feline.setup({
}, },
bufnames = {}, bufnames = {},
}, },
})
end
get_config()
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "*",
callback = function()
get_config()
end,
}) })

View file

@ -435,3 +435,23 @@ require("py_lsp").setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = on_attach, 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,
})

View file

@ -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,
},
})

View file

@ -1,5 +1,20 @@
local present, treesitter = pcall(require, "nvim-treesitter.configs") 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({ treesitter.setup({
auto_install = true, auto_install = true,

View file

@ -32,6 +32,16 @@ vim.o.shiftwidth = 2
vim.o.tabstop = 2 vim.o.tabstop = 2
vim.o.softtabstop = 0 vim.o.softtabstop = 0
vim.o.expandtab = true 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, "plugins")
pcall(require, "binds") pcall(require, "binds")

View file

@ -19,26 +19,26 @@
"fidget.nvim": { "branch": "main", "commit": "9dc6d15fdb877b2fb09ea0ba2dfde9beccb5965a" }, "fidget.nvim": { "branch": "main", "commit": "9dc6d15fdb877b2fb09ea0ba2dfde9beccb5965a" },
"friendly-snippets": { "branch": "main", "commit": "a6f7a1609addb4e57daa6bedc300f77f8d225ab7" }, "friendly-snippets": { "branch": "main", "commit": "a6f7a1609addb4e57daa6bedc300f77f8d225ab7" },
"gitsigns.nvim": { "branch": "main", "commit": "ec4742a7eebf68bec663041d359b95637242b5c3" }, "gitsigns.nvim": { "branch": "main", "commit": "ec4742a7eebf68bec663041d359b95637242b5c3" },
"go.nvim": { "branch": "master", "commit": "87263fbeff01d796cc38523bf8488cc0a2fb7a42" }, "go.nvim": { "branch": "master", "commit": "470349cff528448969efeca65b2f9bdb64730e1b" },
"guihua.lua": { "branch": "master", "commit": "dca755457a994d99f3fe63ee29dbf8e2ac20ae3a" }, "guihua.lua": { "branch": "master", "commit": "dca755457a994d99f3fe63ee29dbf8e2ac20ae3a" },
"indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" }, "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" }, "lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, "lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
"ltex-extra.nvim": { "branch": "master", "commit": "1d2f288ceedc70d5a9c00f55c0d0cc788b5164f2" }, "ltex-extra.nvim": { "branch": "master", "commit": "1d2f288ceedc70d5a9c00f55c0d0cc788b5164f2" },
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
"neogit": { "branch": "master", "commit": "089d388876a535032ac6a3f80e19420f09e4ddda" }, "neogit": { "branch": "master", "commit": "089d388876a535032ac6a3f80e19420f09e4ddda" },
"null-ls.nvim": { "branch": "main", "commit": "60b4a7167c79c7d04d1ff48b55f2235bf58158a7" }, "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-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" },
"nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" }, "nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" },
"nvim-dap": { "branch": "master", "commit": "0e376f00e7fac143e29e1017d2ac2cc3df13d185" }, "nvim-dap": { "branch": "master", "commit": "0d77088e0a3532ae653996abbefb8d951b4ed7ac" },
"nvim-dap-ui": { "branch": "master", "commit": "885e958ff9de30cfbc359259eccf28cc493ad46b" }, "nvim-dap-ui": { "branch": "master", "commit": "94aa67d7bd60d3dffa5cd1967c2cefa6ba906406" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "7f7f2af549e72a0b7bddc3b4f827beb027ea8ce3" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "7f7f2af549e72a0b7bddc3b4f827beb027ea8ce3" },
"nvim-lspconfig": { "branch": "master", "commit": "d3c82d2f9a6fd91ec1ffee645664d2cc57e706d9" }, "nvim-lspconfig": { "branch": "master", "commit": "aeb76066212b09c7c01a3abb42fe82f0130ef402" },
"nvim-surround": { "branch": "main", "commit": "ad56e6234bf42fb7f7e4dccc7752e25abd5ec80e" }, "nvim-surround": { "branch": "main", "commit": "c0835d2a33898b1509e804b7a3ad49737b90d98a" },
"nvim-tree.lua": { "branch": "master", "commit": "02fdc262eba188198a7deb2117b3b996e6763d65" }, "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-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" },
"nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" }, "nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" },
"nvim-web-devicons": { "branch": "master", "commit": "ade34ca7d19543904b28b903e606be8930fb9ee3" }, "nvim-web-devicons": { "branch": "master", "commit": "ade34ca7d19543904b28b903e606be8930fb9ee3" },
@ -55,8 +55,7 @@
"telescope-project.nvim": { "branch": "master", "commit": "8e8ee37b7210761502cdf2c3a82b5ba8fb5b2972" }, "telescope-project.nvim": { "branch": "master", "commit": "8e8ee37b7210761502cdf2c3a82b5ba8fb5b2972" },
"telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" }, "telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" },
"todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" }, "todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" },
"tree-sitter-just": { "branch": "main", "commit": "8af0aab79854aaf25b620a52c39485849922f766" }, "trouble.nvim": { "branch": "main", "commit": "fc003424b02109f1453af6b40dadff6019b97187" },
"trouble.nvim": { "branch": "main", "commit": "490f7fe6d227f4f7a64f00be8c7dcd7a508ed271" },
"true-zen.nvim": { "branch": "main", "commit": "98740c76254c65576ec294551028b65081053588" }, "true-zen.nvim": { "branch": "main", "commit": "98740c76254c65576ec294551028b65081053588" },
"vim-astro": { "branch": "main", "commit": "34732be5e9a5c28c2409f4490edf92d46d8b55a9" }, "vim-astro": { "branch": "main", "commit": "34732be5e9a5c28c2409f4490edf92d46d8b55a9" },
"vim-dadbod": { "branch": "master", "commit": "a09e40664e9cd30cd2b3f8866b796598302070f6" }, "vim-dadbod": { "branch": "master", "commit": "a09e40664e9cd30cd2b3f8866b796598302070f6" },
@ -64,6 +63,7 @@
"vim-dadbod-ui": { "branch": "master", "commit": "f4ead480930a37dd2b0cf917a8c387ed36c2d86a" }, "vim-dadbod-ui": { "branch": "master", "commit": "f4ead480930a37dd2b0cf917a8c387ed36c2d86a" },
"vim-fugitive": { "branch": "master", "commit": "2019e0e4139390f485a024d7a2411218b004a5b3" }, "vim-fugitive": { "branch": "master", "commit": "2019e0e4139390f485a024d7a2411218b004a5b3" },
"vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" }, "vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" },
"vim-helm": { "branch": "master", "commit": "c2e7b85711d410e1d73e64eb5df7b70b1c4c10eb" },
"vim-table-mode": { "branch": "master", "commit": "9555a3e6e5bcf285ec181b7fc983eea90500feb4" }, "vim-table-mode": { "branch": "master", "commit": "9555a3e6e5bcf285ec181b7fc983eea90500feb4" },
"vim-vsnip": { "branch": "master", "commit": "8dde8c0ef10bb1afdbb301e2bd7eb1c153dd558e" }, "vim-vsnip": { "branch": "master", "commit": "8dde8c0ef10bb1afdbb301e2bd7eb1c153dd558e" },
"which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" } "which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" }

View file

@ -89,7 +89,7 @@ local plugins = {
-- nvimtree -- nvimtree
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
{ "nvim-tree/nvim-tree.lua", opts = {} }, "nvim-tree/nvim-tree.lua",
"stevearc/dressing.nvim", "stevearc/dressing.nvim",
@ -97,6 +97,7 @@ local plugins = {
"andweeb/presence.nvim", "andweeb/presence.nvim",
{ "iamcco/markdown-preview.nvim", build = "cd app && yarn install" }, { "iamcco/markdown-preview.nvim", build = "cd app && yarn install" },
"towolf/vim-helm",
-- LSP -- LSP
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",

View file

@ -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 ];
};
}