diff --git a/flake.lock b/flake.lock index 2c35989..a3169b1 100644 --- a/flake.lock +++ b/flake.lock @@ -43,11 +43,11 @@ ] }, "locked": { - "lastModified": 1744902080, - "narHash": "sha256-px7OEMQYhS9StY3sTYYeM/jJspk6SXgoPU7OmOSx+1c=", + "lastModified": 1741955947, + "narHash": "sha256-2lbURKclgKqBNm7hVRtWh0A7NrdsibD0EaWhahUVhhY=", "owner": "nix-community", "repo": "home-manager", - "rev": "2c71aae678c03a39c2542e136b87bd040ae1b3cb", + "rev": "4e12151c9e014e2449e0beca2c0e9534b96a26b4", "type": "github" }, "original": { @@ -79,11 +79,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "lastModified": 1741851582, + "narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "rev": "6607cf789e541e7873d40d3a8f7815ea92204f32", "type": "github" }, "original": { @@ -94,11 +94,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "lastModified": 1741851582, + "narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "rev": "6607cf789e541e7873d40d3a8f7815ea92204f32", "type": "github" }, "original": { @@ -115,11 +115,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1744904898, - "narHash": "sha256-wLepe0sdFFgXUOLY2t+GrfjBquiGFgNydQkQYGh6UwQ=", + "lastModified": 1741973126, + "narHash": "sha256-CcmVOjj2vrxnm16i8k7+yOQ8OKEkQoC+CZGkk69xx+s=", "owner": "nix-community", "repo": "NUR", - "rev": "9ea0c40c52673079dfe50e82ddbb78679723be05", + "rev": "1ebb46ef6ac07fe695984eec8b4f936e92f4dce5", "type": "github" }, "original": { @@ -144,11 +144,11 @@ ] }, "locked": { - "lastModified": 1744669848, - "narHash": "sha256-pXyanHLUzLNd3MX9vsWG+6Z2hTU8niyphWstYEP3/GU=", + "lastModified": 1741861888, + "narHash": "sha256-ynOgXAyToeE1UdLNfrUn/hL7MN0OpIS2BtNdLjpjPf0=", "owner": "Mic92", "repo": "sops-nix", - "rev": "61154300d945f0b147b30d24ddcafa159148026a", + "rev": "d016ce0365b87d848a57c12ffcfdc71da7a2b55f", "type": "github" }, "original": { diff --git a/hosts/rick/home-config.nix b/hosts/rick/home-config.nix index 5a6295c..6ba8027 100644 --- a/hosts/rick/home-config.nix +++ b/hosts/rick/home-config.nix @@ -15,7 +15,6 @@ git.enable = true; neovim.enable = true; starship.enable = true; - tmux.enable = true; utils.enable = true; vifm.enable = true; zsh.enable = true; diff --git a/hosts/work/home-config.nix b/hosts/work/home-config.nix index e1b4578..724fc54 100644 --- a/hosts/work/home-config.nix +++ b/hosts/work/home-config.nix @@ -16,7 +16,6 @@ userEmail = "ybarbanneau@sellsy.com"; signingKey ="6E1A834E282FBD98B48069444447A19BBEDB8DBA"; signByDefault = true; - signingKey="6E1A834E282FBD98B48069444447A19BBEDB8DBA"; }; neovim.enable = true; starship.enable = true; diff --git a/modules/home-manager/cli/neovim/default.nix b/modules/home-manager/cli/neovim/default.nix index 507e21f..7cf7d45 100644 --- a/modules/home-manager/cli/neovim/default.nix +++ b/modules/home-manager/cli/neovim/default.nix @@ -10,13 +10,13 @@ let url = "https://ftp.nluug.nl/vim/runtime/spell/fr.utf-8.sug"; sha256 = "0294bc32b42c90bbb286a89e23ca3773b7ef50eff1ab523b1513d6a25c6b3f58"; }; - nvim-k8s-lsp = pkgs.vimUtils.buildVimPlugin { - pname = "nvim-k8s-lsp"; + yaml-companion = pkgs.vimUtils.buildVimPlugin { + pname = "yaml-companion"; version = "main"; src = builtins.fetchGit { - url = "https://github.com/tonychg/nvim-k8s-lsp.git"; - rev = "5e8221cce09cb71b7604c0c7469bf9053dd877ca"; - ref = "feat/add-helm-ls-support"; + url = "https://github.com/someone-stole-my-name/yaml-companion.nvim.git"; + rev = "131b0d67bd2e0f1a02e0daf2f3460482221ce3c0"; + ref = "main"; }; }; in @@ -27,16 +27,6 @@ in config = mkIf cfg.enable { home.file."${config.xdg.configHome}/nvim/spell/fr.utf-8.spl".source = nvim-spell-fr-utf8-dictionary; home.file."${config.xdg.configHome}/nvim/spell/fr.utf-8.sug".source = nvim-spell-fr-utf8-suggestions; - - home.file."${config.xdg.configHome}/nvim/lsp/bash.lua".source = ./files/lsp/bash.lua; - home.file."${config.xdg.configHome}/nvim/lsp/helm.lua".source = ./files/lsp/helm.lua; - home.file."${config.xdg.configHome}/nvim/lsp/lua.lua".source = ./files/lsp/lua.lua; - home.file."${config.xdg.configHome}/nvim/lsp/nills.lua".source = ./files/lsp/nills.lua; - home.file."${config.xdg.configHome}/nvim/lsp/pylsp.lua".source = ./files/lsp/pylsp.lua; - home.file."${config.xdg.configHome}/nvim/lsp/terraformls.lua".source = ./files/lsp/terraformls.lua; - home.file."${config.xdg.configHome}/nvim/lsp/tflint.lua".source = ./files/lsp/tflint.lua; - home.file."${config.xdg.configHome}/nvim/lsp/yaml.lua".source = ./files/lsp/yaml.lua; - programs.neovim = { enable = true; defaultEditor = true; @@ -65,11 +55,7 @@ in shfmt yamlfmt ]; - extraLuaConfig = - (builtins.readFile ./files/options.lua) - + (builtins.readFile ./files/keybindings.lua) - + (builtins.readFile ./files/lsp.lua) - ; + extraLuaConfig = (builtins.readFile ./files/options.lua); plugins = with pkgs.vimPlugins; [ { plugin = nvim-autopairs; @@ -81,29 +67,32 @@ in { plugin = catppuccin-nvim; type = "lua"; - config = (builtins.readFile ./files/plugins/theme.lua); + config = (builtins.readFile ./files/theme.lua); } { - plugin = blink-cmp; + plugin = nvim-cmp; type = "lua"; - config = (builtins.readFile ./files/plugins/blink-cmp.lua); + config = (builtins.readFile ./files/cmp.lua); } - blink-emoji-nvim - blink-cmp-dictionary + cmp-buffer + cmp-nvim-lsp + cmp-path + cmp-cmdline + cmp_luasnip { plugin = conform-nvim; type = "lua"; - config = (builtins.readFile ./files/plugins/conform.lua); + config = (builtins.readFile ./files/conform.lua); } { plugin = fzf-lua; type = "lua"; - config = (builtins.readFile ./files/plugins/fzf-lua.lua); + config = (builtins.readFile ./files/fzf-lua.lua); } { plugin = gitsigns-nvim; type = "lua"; - config = (builtins.readFile ./files/plugins/luasnip.lua); + config = (builtins.readFile ./files/luasnip.lua); } { plugin = indent-blankline-nvim; @@ -114,15 +103,26 @@ in } ''; } + { + plugin = lsp_lines-nvim; + type = "lua"; + config = (builtins.readFile ./files/lsp-line.lua); + } + { + plugin = nvim-lspconfig; + type = "lua"; + config = (builtins.readFile ./files/lspconfig.lua); + } { plugin = lualine-nvim; type = "lua"; - config = (builtins.readFile ./files/plugins/lualine.lua); + config = (builtins.readFile ./files/lualine.lua); } + luasnip { plugin = neo-tree-nvim; type = "lua"; - config = (builtins.readFile ./files/plugins/neotree.lua); + config = (builtins.readFile ./files/neotree.lua); } nui-nvim { @@ -135,12 +135,12 @@ in { plugin = nvim-lint; type = "lua"; - config = ( builtins.readFile ./files/plugins/nvim-lint.lua); + config = ( builtins.readFile ./files/nvim-lint.lua); } { plugin = nvim-sops; type = "lua"; - config = (builtins.readFile ./files/plugins/nvim-sops.lua); + config = (builtins.readFile ./files/nvim-sops.lua); } plenary-nvim { @@ -169,12 +169,12 @@ in ]) ); type = "lua"; - config = ( builtins.readFile ./files/plugins/treesitter.lua); + config = ( builtins.readFile ./files/treesitter.lua); } { plugin = nvim-treesitter-context; type = "lua"; - config = ( builtins.readFile ./files/plugins/treesitter_context.lua); + config = ( builtins.readFile ./files/treesitter_context.lua); } { @@ -194,12 +194,15 @@ in { plugin = which-key-nvim; type = "lua"; - config = ( builtins.readFile ./files/plugins/whichkey.lua ); + config = ( builtins.readFile ./files/whichkey.lua ); } { - plugin = nvim-k8s-lsp ; + plugin = yaml-companion.overrideAttrs { + dependencies = [ + nvim-lspconfig + ]; + }; type = "lua"; - config = ( builtins.readFile ./files/plugins/nvim-k8s-lsp.lua ); } vim-helm ]; diff --git a/modules/home-manager/cli/neovim/files/cmp.lua b/modules/home-manager/cli/neovim/files/cmp.lua new file mode 100644 index 0000000..dfbc0ff --- /dev/null +++ b/modules/home-manager/cli/neovim/files/cmp.lua @@ -0,0 +1,98 @@ +local has_words_before = function() + unpack = unpack or table.unpack + 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') == nil +end + +local get_ws = function (max, len) + return (" "):rep(max - len) +end + +-- Add additional capabilities supported by nvim-cmp +local capabilities = require('cmp_nvim_lsp').default_capabilities() +local luasnip = require("luasnip") +local kind_icons = { + Text = "", + Method = "󰆧", + Function = "󰊕", + Constructor = "", + Field = "󰇽", + Variable = "󰂡", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "", + Event = "", + Operator = "󰆕", + TypeParameter = "󰅲", +} +-- nvim-cmp setup +local cmp = require 'cmp' +cmp.setup { + mapping = { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + 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() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}), + [""] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}), + [""] = cmp.mapping(cmp.mapping.complete(), {'i', 'c'}), + [""] = cmp.mapping({ i = cmp.mapping.close(), c = cmp.mapping.close() }), + }, + formatting = { + format = function(_, vim_item) + vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) + + local content = vim_item.abbr + if #content > 25 then + vim_item.abbr = vim.fn.strcharpart(content, 0, 25) .. "…" + else + vim_item.abbr = content .. get_ws(25, #content) + end + + return vim_item + end, + }, + sources = { + {name = 'path'}, + {name = 'nvim_lsp', keyword_length = 1}, + {name = 'buffer', keyword_length = 3}, + {name = 'luasnip', keyword_length = 2}, + }, +} diff --git a/modules/home-manager/cli/neovim/files/plugins/conform.lua b/modules/home-manager/cli/neovim/files/conform.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/conform.lua rename to modules/home-manager/cli/neovim/files/conform.lua diff --git a/modules/home-manager/cli/neovim/files/plugins/fzf-lua.lua b/modules/home-manager/cli/neovim/files/fzf-lua.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/fzf-lua.lua rename to modules/home-manager/cli/neovim/files/fzf-lua.lua diff --git a/modules/home-manager/cli/neovim/files/keybindings.lua b/modules/home-manager/cli/neovim/files/keybindings.lua deleted file mode 100644 index aeaabe3..0000000 --- a/modules/home-manager/cli/neovim/files/keybindings.lua +++ /dev/null @@ -1,49 +0,0 @@ --- clear search -vim.keymap.set('n', 'l', ':nohlsearch', { desc = 'Clear search', remap = true, silent = true }) - --- Switch between windows. -vim.keymap.set('n', '', 'h', { desc = 'Move to the left window', remap = true }) -vim.keymap.set('n', '', 'j', { desc = 'Move to the bottom window', remap = true }) -vim.keymap.set('n', '', 'k', { desc = 'Move to the top window', remap = true }) -vim.keymap.set('n', '', 'l', { desc = 'Move to the right window', remap = true }) - --- autocenter on search -vim.keymap.set('n', 'n', 'nzzzv', { desc = 'Next result' }) -vim.keymap.set('n', 'N', 'Nzzzv', { desc = 'Previous result' }) - --- Move tabs with \[ and \] -vim.keymap.set('n', ']', ':tabnext', { desc = "Goto next tab", remap = true, silent = true }) -vim.keymap.set('n', '[', ':tabprev', { desc = "Goto previous tab", remap = true, silent = true}) -vim.keymap.set('n', 'tc', ':tabclose', { desc = "Tab [c]lose", remap = true, silent = true}) -vim.keymap.set('n', 'tn', ':tabnew', { desc = "Tab [n]ew", remap = true, silent = true}) - --- Show all caracters -vim.keymap.set('n', 'l', ':set list!', { desc = "Show a[l]l caraters", remap = true, silent = true}) - --- neotree --- ------- -vim.keymap.set('n', 'nc', ':Neotree close', {desc='Neotree [c]lose'}) -vim.keymap.set('n', 'nf', ':Neotree focus filesystem', {desc='Neotree [f]ocus'}) -vim.keymap.set('n', 'nb', ':Neotree focus buffers', {desc='Neotree Nvim [b]uffers'}) -vim.keymap.set('n', 'ng', ':Neotree focus git_status', {desc='Neotree [g]it status'}) - --- fzf-lua --- ------ -vim.keymap.set('n', 'fb', function() require('fzf-lua').buffers() end, {desc='open [b]uffers'}) -vim.keymap.set('n', 'ff', function() require('fzf-lua').files() end, {desc='[r]esume last command'}) -vim.keymap.set('n', 'fr', function() require('fzf-lua').files() end, {desc='[f]iles'}) - --- git related keymaps -vim.keymap.set('n', 'fgb', function() require('fzf-lua').git_branches() end, {desc='Git [b]ranches'}) -vim.keymap.set('n', 'fgc', function() require('fzf-lua').git_commits() end, {desc='Git [c]ommits'}) -vim.keymap.set('n', 'fgC', function() require('fzf-lua').git_bcommits() end, {desc='Git current buffer [C]ommits'}) -vim.keymap.set('n', 'fgf', function() require('fzf-lua').git_files() end, {desc='Git [f]iles'}) -vim.keymap.set('n', 'fgs', function() require('fzf-lua').git_stash() end, {desc='Git [s]tash'}) -vim.keymap.set('n', 'fgS', function() require('fzf-lua').git_status() end, {desc='Git [S]tash'}) - --- grep related keymaps -vim.keymap.set('n', 'fGb', function() require('fzf-lua').grep_curbuf() end, {desc='grep in current [b]uffer'}) -vim.keymap.set('n', 'fGc', function() require('fzf-lua').grep_cword() end, {desc='grep word under the [c]ursor'}) -vim.keymap.set('n', 'fGg', function() require('fzf-lua').grep() end, {desc='[g]rep'}) -vim.keymap.set('n', 'fGl', function() require('fzf-lua').live_grep() end, {desc='[l]ive grep'}) -vim.keymap.set('n', 'fGr', function() require('fzf-lua').grep_last() end, {desc='[r]erun last grep'}) diff --git a/modules/home-manager/cli/neovim/files/lsp-line.lua b/modules/home-manager/cli/neovim/files/lsp-line.lua new file mode 100644 index 0000000..78aa9ad --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp-line.lua @@ -0,0 +1,7 @@ +require('lsp_lines').setup() +vim.diagnostic.config({ virtual_lines = true }) + +-- Disable virtual_text since it's redundant due to lsp_lines. +vim.diagnostic.config({ + virtual_text = false, +}) diff --git a/modules/home-manager/cli/neovim/files/lsp.lua b/modules/home-manager/cli/neovim/files/lsp.lua deleted file mode 100644 index 4b2a932..0000000 --- a/modules/home-manager/cli/neovim/files/lsp.lua +++ /dev/null @@ -1,9 +0,0 @@ --- LSP configuration -vim.lsp.enable('bash') -vim.lsp.enable('helm') -vim.lsp.enable('lua') -vim.lsp.enable('nills') -vim.lsp.enable('pylsp') -vim.lsp.enable('terraformls') -vim.lsp.enable('tflint') -vim.lsp.enable('yaml') diff --git a/modules/home-manager/cli/neovim/files/lsp/bash.lua b/modules/home-manager/cli/neovim/files/lsp/bash.lua deleted file mode 100644 index 27f9131..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/bash.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - cmd = { 'bash-language-server', 'start' }, - settings = { - bashIde = { - -- Glob pattern for finding and parsing shell script files in the workspace. - -- Used by the background analysis features across files. - - -- Prevent recursive scanning which will cause issues when opening a file - -- directly in the home directory (e.g. ~/foo.sh). - -- - -- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)". - globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)', - }, - }, - filetypes = { 'bash', 'sh' }, - root_markers = { '.git' }, -} diff --git a/modules/home-manager/cli/neovim/files/lsp/helm.lua b/modules/home-manager/cli/neovim/files/lsp/helm.lua deleted file mode 100644 index 8086a4a..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/helm.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - cmd = { 'helm_ls', 'serve' }, - filetypes = { 'helm' }, - root_markers = { 'Chart.yaml' }, - capabilities = { - workspace = { - didChangeWatchedFiles = { - dynamicRegistration = true, - }, - }, - }, - settings = { - ['helm-ls'] = { - yamlls = { - enabled = true, - enabledforfilesglob = "*.{yaml,yml}", - diagnosticslimit = 50, - showdiagnosticsdirectly = false, - path = "yaml-language-server", - config = { - schemas = { - kubernetes = "template/**", - }, - completion = true, - hover = true, - } - } - } - } -} diff --git a/modules/home-manager/cli/neovim/files/lsp/lua.lua b/modules/home-manager/cli/neovim/files/lsp/lua.lua deleted file mode 100644 index 4ab1145..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/lua.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - cmd = { 'lua-language-server' }, - filetypes = { 'lua' }, - root_markers = { - '.luarc.json', - '.luarc.jsonc', - '.luacheckrc', - '.stylua.toml', - 'stylua.toml', - 'selene.toml', - 'selene.yml', - '.git', - }, - settings = { - Lua = { - diagnostics = { - globals = {'vim'} -- Add any globals you want to ignore as undefined - }, - workspace = { - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true - } - }, - telemetry = { - enable = false -- Disable telemetry - } - } - }, - flags = { - debounce_text_changes = 150, - } -} diff --git a/modules/home-manager/cli/neovim/files/lsp/marksman.lua b/modules/home-manager/cli/neovim/files/lsp/marksman.lua deleted file mode 100644 index 4c74725..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/marksman.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - cmd = { 'marksman' }, - filetypes = { 'markdown', 'markdown.mdx' }, - root_markers = { '.marksman.toml', '.git' }, -} diff --git a/modules/home-manager/cli/neovim/files/lsp/nills.lua b/modules/home-manager/cli/neovim/files/lsp/nills.lua deleted file mode 100644 index 2829674..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/nills.lua +++ /dev/null @@ -1,15 +0,0 @@ ----@brief ---- --- https://github.com/oxalica/nil --- --- A new language server for Nix Expression Language. --- --- If you are using Nix with Flakes support, run `nix profile install github:oxalica/nil` to install. --- Check the repository README for more information. --- --- _See an example config at https://github.com/oxalica/nil/blob/main/dev/nvim-lsp.nix._ -return { - cmd = { 'nil' }, - filetypes = { 'nix' }, - root_markers = { 'flake.nix', '.git' }, -} diff --git a/modules/home-manager/cli/neovim/files/lsp/pylsp.lua b/modules/home-manager/cli/neovim/files/lsp/pylsp.lua deleted file mode 100644 index 1da4a02..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/pylsp.lua +++ /dev/null @@ -1,21 +0,0 @@ -return { - cmd = { 'pylsp' }, - filetypes = { 'python' }, - root_markers = { - 'pyproject.toml', - 'setup.py', - 'setup.cfg', - 'requirements.txt', - 'Pipfile', - '.git', - }, - settings = { - pylsp = { - plugins = { - pylint = { - enabled = true - } - } - } - } -} diff --git a/modules/home-manager/cli/neovim/files/lsp/terraformls.lua b/modules/home-manager/cli/neovim/files/lsp/terraformls.lua deleted file mode 100644 index 4a875c3..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/terraformls.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - cmd = { 'terraform-ls', 'serve' }, - filetypes = { 'terraform', 'terraform-vars' }, - root_markers = { '.terraform', '.git' }, -} diff --git a/modules/home-manager/cli/neovim/files/lsp/tflint.lua b/modules/home-manager/cli/neovim/files/lsp/tflint.lua deleted file mode 100644 index 0074cdf..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/tflint.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - cmd = { 'tflint', '--langserver' }, - filetypes = { 'terraform' }, - root_markers = { '.terraform', '.git', '.tflint.hcl' }, -} diff --git a/modules/home-manager/cli/neovim/files/lsp/yaml.lua b/modules/home-manager/cli/neovim/files/lsp/yaml.lua deleted file mode 100644 index 9e304dd..0000000 --- a/modules/home-manager/cli/neovim/files/lsp/yaml.lua +++ /dev/null @@ -1,33 +0,0 @@ --- most used yaml schemas -local gitlab_ci = "https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json" -local taskfile = "https://taskfile.dev/schema.json" -local lefthook = "https://raw.githubusercontent.com/evilmartians/lefthook/refs/heads/master/schema.json" -local github_workflow = "https://json.schemastore.org/github-workflow.json" - -return { - cmd = { 'yaml-language-server', '--stdio' }, - filetypes = { 'yaml', 'yaml.docker-compose', 'yaml.gitlab' }, - root_markers = { '.git' }, - settings = { - yaml = { - schemas = { - [gitlab_ci] = { - "ci/*.{yaml,yml}", - ".gitlab/**/*.{yaml,yml}", - ".gitlab-ci.{yaml,yml}", - }, - [taskfile] = { - "Taskfile*.{yaml,yml}", - "taskfile*.{yaml,yml}", - "taskfiles/**/*.{yaml,yml}", - }, - [lefthook] = { - "lefthook.{yaml,yml}", - }, - [github_workflow] = { - ".github/workflow/**/*.{yaml,yml}", - } - }, - }, - }, -} diff --git a/modules/home-manager/cli/neovim/files/lspconfig.lua b/modules/home-manager/cli/neovim/files/lspconfig.lua new file mode 100644 index 0000000..8a08268 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lspconfig.lua @@ -0,0 +1,238 @@ +local lspconfig = require('lspconfig') +local capabilities = require("cmp_nvim_lsp").default_capabilities() +require("yaml-companion").open_ui_select() + +lspconfig.bashls.setup { + capabilities = capabilities, +} + +lspconfig.clangd.setup { + capabilities = capabilities, +} + +lspconfig.eslint.setup{ + capabilities = capabilities, +} + +-- YAML variables and Helm LS (quite big!) +local schemas = {} + +local kubernetes = "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/refs/heads/master/v1.29.6-standalone-strict/all.json" +local flux2 = "https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/refs/heads/main/all.json" +local gitlab_ci = "https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json" +local taskfile = "https://taskfile.dev/schema.json" +local podmonitor = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/monitoring.coreos.com/podmonitor_v1.json" +local servicemonitor = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/monitoring.coreos.com/servicemonitor_v1.json" +local prometheus = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/monitoring.coreos.com/prometheus_v1.json" +local ingress = "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/refs/heads/master/v1.30.1/ingress-networking-v1.json" +local lefthook = "https://raw.githubusercontent.com/evilmartians/lefthook/refs/heads/master/schema.json" +local github_workflow = "https://json.schemastore.org/github-workflow.json" + +schemas[kubernetes] = { + "templates/*deployment.yaml", + "templates/*service.yaml", + "templates/*secret.yaml", + "templates/*configmap.yaml", + "templates/*daemonset.yaml", + "templates/*replicaset.yaml", + "templates/*persistentvolume.yaml", + "templates/*persistentvolumeclaim.yaml", + "templates/*serviceaccount.yaml", + "templates/*role.yaml", + "templates/*rolebinding.yaml", + "templates/*clusterrole.yaml", + "templates/*clusterrolebinding.yaml", + "templates/*job*.yaml", +} +schemas[podmonitor] = "templates/*podmonitor*" +schemas[servicemonitor] = "templates/*servicemonitor*" +schemas[ingress] = "templates/*ingress*" + +lspconfig.helm_ls.setup { + capabilities = capabilities, + settings = { + ['helm-ls'] = { + yamlls = { + enabled = true, + enabledForFilesGlob = "*.{yaml,yml}", + diagnosticsLimit = 50, + showDiagnosticsDirectly = false, + path = "yaml-language-server", + config = { + schemas = schemas, + completion = true, + hover = true, + } + } + } + } +} + +-- restart LSP server avoir problems with Helm-ls +vim.api.nvim_create_autocmd("FileType", { + pattern = "helm", + command = "LspRestart", +}) + +lspconfig.lua_ls.setup { + capabilities = capabilities, + single_file_support = true, + settings = { + Lua = { + diagnostics = { + globals = {'vim'} -- Add any globals you want to ignore as undefined + }, + workspace = { + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true + } + }, + telemetry = { + enable = false -- Disable telemetry + } + } + }, + flags = { + debounce_text_changes = 150, + } +} + +lspconfig.marksman.setup{ + capabilities = capabilities, +} + +lspconfig.nil_ls.setup { + capabilities = capabilities, +} + +lspconfig.pylsp.setup { + capabilities = capabilities, + settings = { + pylsp = { + plugins = { + pylint = { + enabled = true + } + } + } + } +} + +lspconfig.terraformls.setup{ + capabilities = capabilities, +} + +lspconfig.tflint.setup{ + capabilities = capabilities, +} + +-- YAML configuration (quite big!) + +local cfg = require("yaml-companion").setup({ + schemas = { + { name = "Flux2", uri = flux2 }, + { name = "Gitlab", uri = gitlab_ci }, + { name = "Taskfile", uri = taskfile }, + { name = "PodMonitor", uri = podmonitor }, + { name = "ServiceMonitor", uri = servicemonitor }, + { name = "Prometheus", uri = prometheus }, + { name = "Kubernetes", uri = kubernetes }, + { name = "Lefthook", uri = lefthook }, + { name = "Github Workflow", uri = github_workflow}, + }, + lspconfig = { + capabilities = capabilities, + settings = { + yaml = { + schemas = { + [flux2] = { + "*.{alert,provider,receiver,helmrelease,helmrepository,gitrepository}.yaml", + "gotk-sync.yaml", + "gotk-*.yaml", + }, + [gitlab_ci] = { + "ci/*.{yaml,yml}", + ".gitlab/**/*.{yaml,yml}", + ".gitlab-ci.{yaml,yml}", + }, + [taskfile] = { + "Taskfile*.{yaml,yml}", + "taskfile*.{yaml,yml}", + "taskfiles/**/*.{yaml,yml}", + }, + [podmonitor] = { + "*podmonitor*.{yaml,yml}", + }, + [servicemonitor] = { + "*servicemonitor*.{yaml,yml}", + }, + [prometheus] = { + "*prometheus*.{yaml,yml}", + }, + [ingress] = { + "*ingress*.{yaml,yml}", + }, + [lefthook] = { + "lefthook.{yaml,yml}", + }, + [github_workflow] = { + ".github/workflow/**/*.{yaml,yml}", + } + }, + }, + }, + }, +}) + +lspconfig.yamlls.setup{cfg} + +vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(ev) + local bufmap = function(mode, lhs, rhs) + local opts = {buffer = true} + vim.keymap.set(mode, lhs, rhs, opts) + end + + -- Displays hover information about the symbol under the cursor + bufmap('n', 'K', 'lua vim.lsp.buf.hover()') + + -- Jump to the definition + bufmap('n', 'gd', 'lua vim.lsp.buf.definition()') + + -- Jump to declaration + bufmap('n', 'gD', 'lua vim.lsp.buf.declaration()') + + -- Lists all the implementations for the symbol under the cursor + bufmap('n', 'gi', 'lua vim.lsp.buf.implementation()') + + -- Jumps to the definition of the type symbol + bufmap('n', 'go', 'lua vim.lsp.buf.type_definition()') + + -- Lists all the references + bufmap('n', 'gr', 'lua vim.lsp.buf.references()') + + -- Displays a function's signature information + bufmap('n', 'gs', 'lua vim.lsp.buf.signature_help()') + + -- Renames all references to the symbol under the cursor + bufmap('n', '', 'lua vim.lsp.buf.rename()') + + -- Selects a code action available at the current cursor position + bufmap('n', '', 'lua vim.lsp.buf.code_action()') + bufmap('x', '', 'lua vim.lsp.buf.range_code_action()') + + -- Show diagnostics in a floating window + bufmap('n', 'gl', 'lua vim.diagnostic.open_float()') + + -- Move to the previous diagnostic + bufmap('n', '[d', 'lua vim.diagnostic.goto_prev()') + + -- Move to the next diagnostic + bufmap('n', ']d', 'lua vim.diagnostic.goto_next()') + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client and (client.name == "yamlls" or client.name == "helm_ls") then + bufmap ('n', '', 'lua require("yaml-companion").open_ui_select()') + end + end +}) diff --git a/modules/home-manager/cli/neovim/files/plugins/lualine.lua b/modules/home-manager/cli/neovim/files/lualine.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/lualine.lua rename to modules/home-manager/cli/neovim/files/lualine.lua diff --git a/modules/home-manager/cli/neovim/files/plugins/luasnip.lua b/modules/home-manager/cli/neovim/files/luasnip.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/luasnip.lua rename to modules/home-manager/cli/neovim/files/luasnip.lua diff --git a/modules/home-manager/cli/neovim/files/plugins/neotree.lua b/modules/home-manager/cli/neovim/files/neotree.lua similarity index 61% rename from modules/home-manager/cli/neovim/files/plugins/neotree.lua rename to modules/home-manager/cli/neovim/files/neotree.lua index d1fd640..c252b7f 100644 --- a/modules/home-manager/cli/neovim/files/plugins/neotree.lua +++ b/modules/home-manager/cli/neovim/files/neotree.lua @@ -3,14 +3,14 @@ neotree.setup({ close_if_last_window = true, filesystem = { filtered_items = { - -- when true, they will just be displayed differently + -- when true, they will just be displayed differently -- than normal items visible = false, hide_dotfiles = false, hide_gitignored = true, }, follow_current_file = { - -- follow file in current buffer even iof the file is + -- follow file in current buffer even iof the file is -- loaded while tree is open enabled = true, -- do not autoclose expanded dirs @@ -18,3 +18,8 @@ neotree.setup({ }, } }) + +vim.keymap.set('n', 'nc', ':Neotree close', {desc='Neotree [c]lose'}) +vim.keymap.set('n', 'nf', ':Neotree focus filesystem', {desc='Neotree [f]ocus'}) +vim.keymap.set('n', 'nb', ':Neotree focus buffers', {desc='Neotree Nvim [b]uffers'}) +vim.keymap.set('n', 'ng', ':Neotree focus git_status', {desc='Neotree [g]it status'}) diff --git a/modules/home-manager/cli/neovim/files/plugins/nvim-lint.lua b/modules/home-manager/cli/neovim/files/nvim-lint.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/nvim-lint.lua rename to modules/home-manager/cli/neovim/files/nvim-lint.lua diff --git a/modules/home-manager/cli/neovim/files/plugins/nvim-sops.lua b/modules/home-manager/cli/neovim/files/nvim-sops.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/nvim-sops.lua rename to modules/home-manager/cli/neovim/files/nvim-sops.lua diff --git a/modules/home-manager/cli/neovim/files/options.lua b/modules/home-manager/cli/neovim/files/options.lua index bee83db..a33b8c4 100644 --- a/modules/home-manager/cli/neovim/files/options.lua +++ b/modules/home-manager/cli/neovim/files/options.lua @@ -121,15 +121,3 @@ vim.lsp.set_log_level("off") -- define a timeout for match parens vim.g.matchparen_timeout = 2 vim.g.matchparen_insert_timeout = 2 - --- activate virtual lines for diagnistics --- no more plugins needed -vim.diagnostic.config({ - virtual_lines = true - - -- Alternatively, customize specific options - -- virtual_lines = { - -- -- Only show virtual line diagnostics for the current cursor line - -- current_line = true, - -- }, -}) diff --git a/modules/home-manager/cli/neovim/files/plugins/blink-cmp.lua b/modules/home-manager/cli/neovim/files/plugins/blink-cmp.lua deleted file mode 100644 index 1d42f63..0000000 --- a/modules/home-manager/cli/neovim/files/plugins/blink-cmp.lua +++ /dev/null @@ -1,99 +0,0 @@ -require("blink.cmp").setup({ - keymap = { - preset = "cmdline", - [''] = { 'scroll_documentation_up', 'fallback' }, - [''] = { 'scroll_documentation_down', 'fallback' }, - }, - completion = { - menu = { - draw = { - components = { - label = { - width = { fill = true, max = 60, }, - }, - }, - columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind" } }, - }, - }, - documentation = { auto_show = true }, - list = { - max_items = 30; - selection = { - preselect = false, - auto_insert = true, - }, - cycle = { - from_bottom = true, - from_top = true, - }, - }, - }, - sources = { - default = { - "lsp", - "path", - "snippets", - "buffer", - "emoji", - "dictionary", - }, - providers = { - emoji = { - module = "blink-emoji", - name = "Emoji", - score_offset = 15, -- Tune by preference - opts = { insert = true }, -- Insert emoji (default) or complete its name - should_show_items = function() - return vim.tbl_contains({ "gitcommit", "markdown" }, vim.o.filetype) - end, - }, - dictionary = { - module = "blink-cmp-dictionary", - name = "Dict", - min_keyword_length = 3, - max_items = 10, - opts = { - dictionary_files = function() - if vim.bo.filetype == "markdown" or vim.bo.filetype == "gitcommit" then - return {} - end - return {} - end, - }, - }, - }, - }, - cmdline = { - enabled = false, - }, - appearance = { - nerd_font_variant = "normal", - kind_icons = { - Text = "", - Method = "󰆧", - Function = "󰊕", - Constructor = "", - Field = "󰇽", - Variable = "󰂡", - Class = "󰠱", - Interface = "", - Module = "", - Property = "󰜢", - Unit = "", - Value = "󰎠", - Enum = "", - Keyword = "󰌋", - Snippet = "", - Color = "󰏘", - File = "󰈙", - Reference = "", - Folder = "󰉋", - EnumMember = "", - Constant = "󰏿", - Struct = "", - Event = "", - Operator = "󰆕", - TypeParameter = "󰅲", - } - } -}) diff --git a/modules/home-manager/cli/neovim/files/plugins/nvim-k8s-lsp.lua b/modules/home-manager/cli/neovim/files/plugins/nvim-k8s-lsp.lua deleted file mode 100644 index a2176c6..0000000 --- a/modules/home-manager/cli/neovim/files/plugins/nvim-k8s-lsp.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("nvim-k8s-lsp").setup({ - kubernetes_version = "v1.32.2", - integrations = { - lualine = false, - } -}) diff --git a/modules/home-manager/cli/neovim/files/plugins/theme.lua b/modules/home-manager/cli/neovim/files/theme.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/theme.lua rename to modules/home-manager/cli/neovim/files/theme.lua diff --git a/modules/home-manager/cli/neovim/files/plugins/treesitter.lua b/modules/home-manager/cli/neovim/files/treesitter.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/treesitter.lua rename to modules/home-manager/cli/neovim/files/treesitter.lua diff --git a/modules/home-manager/cli/neovim/files/plugins/treesitter_context.lua b/modules/home-manager/cli/neovim/files/treesitter_context.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/treesitter_context.lua rename to modules/home-manager/cli/neovim/files/treesitter_context.lua diff --git a/modules/home-manager/cli/neovim/files/plugins/whichkey.lua b/modules/home-manager/cli/neovim/files/whichkey.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/plugins/whichkey.lua rename to modules/home-manager/cli/neovim/files/whichkey.lua diff --git a/modules/home-manager/web/firefox/conf/preferences.nix b/modules/home-manager/web/firefox/conf/preferences.nix index 5c58f7d..1e4afa0 100644 --- a/modules/home-manager/web/firefox/conf/preferences.nix +++ b/modules/home-manager/web/firefox/conf/preferences.nix @@ -45,10 +45,5 @@ "browser.sessionstore.resume_session_once" = true; # Disable translation - "browser.translations.enabled" = false; - -# disable AI shit - "browser.ml.chat.enabled" = false; - "browser.ml.chat.shortcuts" = false; - "browser.ml.chat.sidebar" = false; + "browser.translations.enabled " = false; } diff --git a/modules/home-manager/web/firefox/default.nix b/modules/home-manager/web/firefox/default.nix index 191bdae..a66ecd4 100644 --- a/modules/home-manager/web/firefox/default.nix +++ b/modules/home-manager/web/firefox/default.nix @@ -107,7 +107,7 @@ in extensions.packages = allExtensions; search = { force = true; - default = "ddg"; + default = "DuckDuckGo"; engines = { "Nix Packages" = { urls = [{ @@ -123,13 +123,13 @@ in "NixOS Wiki" = { urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }]; - icon = "https://nixos.wiki/favicon.png"; + iconUpdateURL = "https://nixos.wiki/favicon.png"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ "@nw" ]; }; - "bing".metaData.hidden = true; - "google".metaData.hidden = true; + "Bing".metaData.hidden = true; + "Google".metaData.hidden = true; "Amazon.fr".metaData.hidden = true; "Facebook".metaData.hidden = true; "youtube".metaData.hidden = true;