diff --git a/flake.lock b/flake.lock index a3169b1..2c35989 100644 --- a/flake.lock +++ b/flake.lock @@ -43,11 +43,11 @@ ] }, "locked": { - "lastModified": 1741955947, - "narHash": "sha256-2lbURKclgKqBNm7hVRtWh0A7NrdsibD0EaWhahUVhhY=", + "lastModified": 1744902080, + "narHash": "sha256-px7OEMQYhS9StY3sTYYeM/jJspk6SXgoPU7OmOSx+1c=", "owner": "nix-community", "repo": "home-manager", - "rev": "4e12151c9e014e2449e0beca2c0e9534b96a26b4", + "rev": "2c71aae678c03a39c2542e136b87bd040ae1b3cb", "type": "github" }, "original": { @@ -79,11 +79,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1741851582, - "narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=", + "lastModified": 1744463964, + "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6607cf789e541e7873d40d3a8f7815ea92204f32", + "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", "type": "github" }, "original": { @@ -94,11 +94,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1741851582, - "narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=", + "lastModified": 1744463964, + "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6607cf789e541e7873d40d3a8f7815ea92204f32", + "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", "type": "github" }, "original": { @@ -115,11 +115,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1741973126, - "narHash": "sha256-CcmVOjj2vrxnm16i8k7+yOQ8OKEkQoC+CZGkk69xx+s=", + "lastModified": 1744904898, + "narHash": "sha256-wLepe0sdFFgXUOLY2t+GrfjBquiGFgNydQkQYGh6UwQ=", "owner": "nix-community", "repo": "NUR", - "rev": "1ebb46ef6ac07fe695984eec8b4f936e92f4dce5", + "rev": "9ea0c40c52673079dfe50e82ddbb78679723be05", "type": "github" }, "original": { @@ -144,11 +144,11 @@ ] }, "locked": { - "lastModified": 1741861888, - "narHash": "sha256-ynOgXAyToeE1UdLNfrUn/hL7MN0OpIS2BtNdLjpjPf0=", + "lastModified": 1744669848, + "narHash": "sha256-pXyanHLUzLNd3MX9vsWG+6Z2hTU8niyphWstYEP3/GU=", "owner": "Mic92", "repo": "sops-nix", - "rev": "d016ce0365b87d848a57c12ffcfdc71da7a2b55f", + "rev": "61154300d945f0b147b30d24ddcafa159148026a", "type": "github" }, "original": { diff --git a/hosts/rick/home-config.nix b/hosts/rick/home-config.nix index 6ba8027..5a6295c 100644 --- a/hosts/rick/home-config.nix +++ b/hosts/rick/home-config.nix @@ -15,6 +15,7 @@ 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 724fc54..e1b4578 100644 --- a/hosts/work/home-config.nix +++ b/hosts/work/home-config.nix @@ -16,6 +16,7 @@ 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 7cf7d45..507e21f 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"; }; - yaml-companion = pkgs.vimUtils.buildVimPlugin { - pname = "yaml-companion"; + nvim-k8s-lsp = pkgs.vimUtils.buildVimPlugin { + pname = "nvim-k8s-lsp"; version = "main"; src = builtins.fetchGit { - url = "https://github.com/someone-stole-my-name/yaml-companion.nvim.git"; - rev = "131b0d67bd2e0f1a02e0daf2f3460482221ce3c0"; - ref = "main"; + url = "https://github.com/tonychg/nvim-k8s-lsp.git"; + rev = "5e8221cce09cb71b7604c0c7469bf9053dd877ca"; + ref = "feat/add-helm-ls-support"; }; }; in @@ -27,6 +27,16 @@ 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; @@ -55,7 +65,11 @@ in shfmt yamlfmt ]; - extraLuaConfig = (builtins.readFile ./files/options.lua); + extraLuaConfig = + (builtins.readFile ./files/options.lua) + + (builtins.readFile ./files/keybindings.lua) + + (builtins.readFile ./files/lsp.lua) + ; plugins = with pkgs.vimPlugins; [ { plugin = nvim-autopairs; @@ -67,32 +81,29 @@ in { plugin = catppuccin-nvim; type = "lua"; - config = (builtins.readFile ./files/theme.lua); + config = (builtins.readFile ./files/plugins/theme.lua); } { - plugin = nvim-cmp; + plugin = blink-cmp; type = "lua"; - config = (builtins.readFile ./files/cmp.lua); + config = (builtins.readFile ./files/plugins/blink-cmp.lua); } - cmp-buffer - cmp-nvim-lsp - cmp-path - cmp-cmdline - cmp_luasnip + blink-emoji-nvim + blink-cmp-dictionary { plugin = conform-nvim; type = "lua"; - config = (builtins.readFile ./files/conform.lua); + config = (builtins.readFile ./files/plugins/conform.lua); } { plugin = fzf-lua; type = "lua"; - config = (builtins.readFile ./files/fzf-lua.lua); + config = (builtins.readFile ./files/plugins/fzf-lua.lua); } { plugin = gitsigns-nvim; type = "lua"; - config = (builtins.readFile ./files/luasnip.lua); + config = (builtins.readFile ./files/plugins/luasnip.lua); } { plugin = indent-blankline-nvim; @@ -103,26 +114,15 @@ 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/lualine.lua); + config = (builtins.readFile ./files/plugins/lualine.lua); } - luasnip { plugin = neo-tree-nvim; type = "lua"; - config = (builtins.readFile ./files/neotree.lua); + config = (builtins.readFile ./files/plugins/neotree.lua); } nui-nvim { @@ -135,12 +135,12 @@ in { plugin = nvim-lint; type = "lua"; - config = ( builtins.readFile ./files/nvim-lint.lua); + config = ( builtins.readFile ./files/plugins/nvim-lint.lua); } { plugin = nvim-sops; type = "lua"; - config = (builtins.readFile ./files/nvim-sops.lua); + config = (builtins.readFile ./files/plugins/nvim-sops.lua); } plenary-nvim { @@ -169,12 +169,12 @@ in ]) ); type = "lua"; - config = ( builtins.readFile ./files/treesitter.lua); + config = ( builtins.readFile ./files/plugins/treesitter.lua); } { plugin = nvim-treesitter-context; type = "lua"; - config = ( builtins.readFile ./files/treesitter_context.lua); + config = ( builtins.readFile ./files/plugins/treesitter_context.lua); } { @@ -194,15 +194,12 @@ in { plugin = which-key-nvim; type = "lua"; - config = ( builtins.readFile ./files/whichkey.lua ); + config = ( builtins.readFile ./files/plugins/whichkey.lua ); } { - plugin = yaml-companion.overrideAttrs { - dependencies = [ - nvim-lspconfig - ]; - }; + plugin = nvim-k8s-lsp ; 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 deleted file mode 100644 index dfbc0ff..0000000 --- a/modules/home-manager/cli/neovim/files/cmp.lua +++ /dev/null @@ -1,98 +0,0 @@ -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/keybindings.lua b/modules/home-manager/cli/neovim/files/keybindings.lua new file mode 100644 index 0000000..aeaabe3 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/keybindings.lua @@ -0,0 +1,49 @@ +-- 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 deleted file mode 100644 index 78aa9ad..0000000 --- a/modules/home-manager/cli/neovim/files/lsp-line.lua +++ /dev/null @@ -1,7 +0,0 @@ -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 new file mode 100644 index 0000000..4b2a932 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp.lua @@ -0,0 +1,9 @@ +-- 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 new file mode 100644 index 0000000..27f9131 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/bash.lua @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..8086a4a --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/helm.lua @@ -0,0 +1,30 @@ +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 new file mode 100644 index 0000000..4ab1145 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/lua.lua @@ -0,0 +1,32 @@ +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 new file mode 100644 index 0000000..4c74725 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/marksman.lua @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..2829674 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/nills.lua @@ -0,0 +1,15 @@ +---@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 new file mode 100644 index 0000000..1da4a02 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/pylsp.lua @@ -0,0 +1,21 @@ +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 new file mode 100644 index 0000000..4a875c3 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/terraformls.lua @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..0074cdf --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/tflint.lua @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..9e304dd --- /dev/null +++ b/modules/home-manager/cli/neovim/files/lsp/yaml.lua @@ -0,0 +1,33 @@ +-- 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 deleted file mode 100644 index 8a08268..0000000 --- a/modules/home-manager/cli/neovim/files/lspconfig.lua +++ /dev/null @@ -1,238 +0,0 @@ -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/options.lua b/modules/home-manager/cli/neovim/files/options.lua index a33b8c4..bee83db 100644 --- a/modules/home-manager/cli/neovim/files/options.lua +++ b/modules/home-manager/cli/neovim/files/options.lua @@ -121,3 +121,15 @@ 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 new file mode 100644 index 0000000..1d42f63 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/plugins/blink-cmp.lua @@ -0,0 +1,99 @@ +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/conform.lua b/modules/home-manager/cli/neovim/files/plugins/conform.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/conform.lua rename to modules/home-manager/cli/neovim/files/plugins/conform.lua diff --git a/modules/home-manager/cli/neovim/files/fzf-lua.lua b/modules/home-manager/cli/neovim/files/plugins/fzf-lua.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/fzf-lua.lua rename to modules/home-manager/cli/neovim/files/plugins/fzf-lua.lua diff --git a/modules/home-manager/cli/neovim/files/lualine.lua b/modules/home-manager/cli/neovim/files/plugins/lualine.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/lualine.lua rename to modules/home-manager/cli/neovim/files/plugins/lualine.lua diff --git a/modules/home-manager/cli/neovim/files/luasnip.lua b/modules/home-manager/cli/neovim/files/plugins/luasnip.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/luasnip.lua rename to modules/home-manager/cli/neovim/files/plugins/luasnip.lua diff --git a/modules/home-manager/cli/neovim/files/neotree.lua b/modules/home-manager/cli/neovim/files/plugins/neotree.lua similarity index 61% rename from modules/home-manager/cli/neovim/files/neotree.lua rename to modules/home-manager/cli/neovim/files/plugins/neotree.lua index c252b7f..d1fd640 100644 --- a/modules/home-manager/cli/neovim/files/neotree.lua +++ b/modules/home-manager/cli/neovim/files/plugins/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,8 +18,3 @@ 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-k8s-lsp.lua b/modules/home-manager/cli/neovim/files/plugins/nvim-k8s-lsp.lua new file mode 100644 index 0000000..a2176c6 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/plugins/nvim-k8s-lsp.lua @@ -0,0 +1,6 @@ +require("nvim-k8s-lsp").setup({ + kubernetes_version = "v1.32.2", + integrations = { + lualine = false, + } +}) diff --git a/modules/home-manager/cli/neovim/files/nvim-lint.lua b/modules/home-manager/cli/neovim/files/plugins/nvim-lint.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/nvim-lint.lua rename to modules/home-manager/cli/neovim/files/plugins/nvim-lint.lua diff --git a/modules/home-manager/cli/neovim/files/nvim-sops.lua b/modules/home-manager/cli/neovim/files/plugins/nvim-sops.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/nvim-sops.lua rename to modules/home-manager/cli/neovim/files/plugins/nvim-sops.lua diff --git a/modules/home-manager/cli/neovim/files/theme.lua b/modules/home-manager/cli/neovim/files/plugins/theme.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/theme.lua rename to modules/home-manager/cli/neovim/files/plugins/theme.lua diff --git a/modules/home-manager/cli/neovim/files/treesitter.lua b/modules/home-manager/cli/neovim/files/plugins/treesitter.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/treesitter.lua rename to modules/home-manager/cli/neovim/files/plugins/treesitter.lua diff --git a/modules/home-manager/cli/neovim/files/treesitter_context.lua b/modules/home-manager/cli/neovim/files/plugins/treesitter_context.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/treesitter_context.lua rename to modules/home-manager/cli/neovim/files/plugins/treesitter_context.lua diff --git a/modules/home-manager/cli/neovim/files/whichkey.lua b/modules/home-manager/cli/neovim/files/plugins/whichkey.lua similarity index 100% rename from modules/home-manager/cli/neovim/files/whichkey.lua rename to modules/home-manager/cli/neovim/files/plugins/whichkey.lua diff --git a/modules/home-manager/web/firefox/conf/preferences.nix b/modules/home-manager/web/firefox/conf/preferences.nix index 1e4afa0..5c58f7d 100644 --- a/modules/home-manager/web/firefox/conf/preferences.nix +++ b/modules/home-manager/web/firefox/conf/preferences.nix @@ -45,5 +45,10 @@ "browser.sessionstore.resume_session_once" = true; # Disable translation - "browser.translations.enabled " = false; + "browser.translations.enabled" = false; + +# disable AI shit + "browser.ml.chat.enabled" = false; + "browser.ml.chat.shortcuts" = false; + "browser.ml.chat.sidebar" = false; } diff --git a/modules/home-manager/web/firefox/default.nix b/modules/home-manager/web/firefox/default.nix index a66ecd4..191bdae 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 = "DuckDuckGo"; + default = "ddg"; engines = { "Nix Packages" = { urls = [{ @@ -123,13 +123,13 @@ in "NixOS Wiki" = { urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }]; - iconUpdateURL = "https://nixos.wiki/favicon.png"; + icon = "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;