From d6bbebf7f333db63fd0a50a978728c0dd740849b Mon Sep 17 00:00:00 2001 From: cnst Date: Mon, 15 Jul 2024 12:30:44 +0200 Subject: [PATCH] added yanky --- home/extra/neovim/autocommands.nix | 8 +-- home/extra/neovim/keymappings.nix | 12 +++- home/extra/neovim/options.nix | 4 +- home/extra/neovim/plugins/conform.nix | 2 +- home/extra/neovim/plugins/default.nix | 5 +- home/extra/neovim/plugins/lsp.nix | 88 ++++++++++++++------------- home/extra/neovim/plugins/lualine.nix | 1 + home/extra/neovim/plugins/nonels.nix | 78 ++++++++++++------------ home/extra/neovim/plugins/yanky.nix | 5 ++ 9 files changed, 107 insertions(+), 96 deletions(-) create mode 100644 home/extra/neovim/plugins/yanky.nix diff --git a/home/extra/neovim/autocommands.nix b/home/extra/neovim/autocommands.nix index e8487c96..0b2d48d1 100644 --- a/home/extra/neovim/autocommands.nix +++ b/home/extra/neovim/autocommands.nix @@ -1,11 +1,5 @@ { programs.nixvim.autoCmd = [ - # Vertically center document when entering insert mode - { - event = "InsertEnter"; - command = "norm zz"; - } - # Open help in a vertical split { event = "FileType"; @@ -21,7 +15,7 @@ "latex" "markdown" ]; - command = "setlocal spell spelllang=en,fr"; + command = "setlocal spell spelllang=en,se"; } ]; } diff --git a/home/extra/neovim/keymappings.nix b/home/extra/neovim/keymappings.nix index 785cffd2..c7e79ae8 100644 --- a/home/extra/neovim/keymappings.nix +++ b/home/extra/neovim/keymappings.nix @@ -17,6 +17,7 @@ inherit action key; }) { + # "" = " %y+ "; "" = ""; # Esc to clear search results @@ -73,9 +74,18 @@ "K" = ":m '<-2gv=gv"; "J" = ":m '>+1gv=gv"; }; + insert = + lib.mapAttrsToList + (key: action: { + mode = "i"; + inherit action key; + }) + { + "" = "p"; + }; in config.nixvim.helpers.keymaps.mkKeymaps {options.silent = true;} - (normal ++ visual); + (normal ++ visual ++ insert); }; } diff --git a/home/extra/neovim/options.nix b/home/extra/neovim/options.nix index 4d50ff46..dd9bb257 100644 --- a/home/extra/neovim/options.nix +++ b/home/extra/neovim/options.nix @@ -37,10 +37,10 @@ smartcase = true; # Override the 'ignorecase' option if the search pattern contains upper # case characters scrolloff = 8; # Number of screen lines to show around the cursor - cursorline = false; # Highlight the screen line of the cursor + cursorline = true; # Highlight the screen line of the cursor cursorcolumn = false; # Highlight the screen column of the cursor signcolumn = "yes"; # Whether to show the signcolumn - colorcolumn = "100"; # Columns to highlight + colorcolumn = ""; # Columns to highlight laststatus = 3; # When to use a status line for the last window fileencoding = "utf-8"; # File-content encoding for the current buffer termguicolors = true; # Enables 24-bit RGB color in the |TUI| diff --git a/home/extra/neovim/plugins/conform.nix b/home/extra/neovim/plugins/conform.nix index e2c05766..98e1e6b4 100644 --- a/home/extra/neovim/plugins/conform.nix +++ b/home/extra/neovim/plugins/conform.nix @@ -1,5 +1,5 @@ { - plugins.conform-nvim = { + programs.nixvim.plugins.conform-nvim = { enable = true; formatOnSave = { lspFallback = true; diff --git a/home/extra/neovim/plugins/default.nix b/home/extra/neovim/plugins/default.nix index 60612a27..c9081035 100644 --- a/home/extra/neovim/plugins/default.nix +++ b/home/extra/neovim/plugins/default.nix @@ -1,5 +1,4 @@ -{pkgs, ...}: -{ +{pkgs, ...}: { imports = [ ./barbar.nix ./comment.nix @@ -17,10 +16,10 @@ ./vimtex.nix ./nonels.nix ./conform.nix + ./yanky.nix ]; programs.nixvim = { - extraPlugins = [pkgs.vimPlugins.gruvbox-material]; colorscheme = "gruvbox-material"; diff --git a/home/extra/neovim/plugins/lsp.nix b/home/extra/neovim/plugins/lsp.nix index 790d4f03..e4bd5750 100644 --- a/home/extra/neovim/plugins/lsp.nix +++ b/home/extra/neovim/plugins/lsp.nix @@ -22,59 +22,63 @@ }; }; - # Language server - servers = { - # Average webdev LSPs - tsserver.enable = false; # TS/JS - cssls.enable = true; # CSS - tailwindcss.enable = true; # TailwindCSS - html.enable = true; # HTML - astro.enable = true; # AstroJS - phpactor.enable = true; # PHP - svelte.enable = false; # Svelte - vuels.enable = false; # Vue + # Language server + servers = { + # Average webdev LSPs + cssls.enable = true; # CSS + tailwindcss.enable = true; # TailwindCSS + html.enable = true; # HTML + astro.enable = true; # AstroJS + phpactor.enable = true; # PHP + svelte.enable = false; # Svelte + vuels.enable = false; # Vue - # Python - pyright.enable = true; + # Python + pyright.enable = true; - # Markdown - marksman.enable = true; + # Markdown + marksman.enable = true; - # Nix - nil-ls.enable = true; + # Nix + nil-ls.enable = true; - # Docker - dockerls.enable = true; + # Docker + dockerls.enable = true; - # Bash - bashls.enable = true; + # Bash + bashls.enable = true; - # C/C++ - clangd.enable = true; + # C/C++ + clangd.enable = true; - # C# - csharp-ls.enable = true; + # C# + csharp-ls.enable = true; - # Lua - lua-ls = { - enable = true; - settings.telemetry.enable = false; - }; - - # Rust - rust-analyzer = { - enable = true; - installRustc = true; - installCargo = true; - settings = { - checkOnSave = true; - check = { - command = "clippy"; + # Lua + lua-ls = { + enable = true; + settings.telemetry.enable = false; + settings.diagnostics = { + globals = ["vim"]; + }; + }; + tsserver = { + enable = false; # TS/JS + }; + # Rust + rust-analyzer = { + enable = true; + installRustc = true; + installCargo = true; + settings = { + checkOnSave = true; + check = { + command = "clippy"; + }; }; }; }; }; }; - }; -}; + }; } diff --git a/home/extra/neovim/plugins/lualine.nix b/home/extra/neovim/plugins/lualine.nix index 1d184754..efed05cd 100644 --- a/home/extra/neovim/plugins/lualine.nix +++ b/home/extra/neovim/plugins/lualine.nix @@ -1,6 +1,7 @@ { programs.nixvim.plugins.lualine = { enable = true; + theme = "gruvbox-material"; globalstatus = true; diff --git a/home/extra/neovim/plugins/nonels.nix b/home/extra/neovim/plugins/nonels.nix index b4c41392..1debe4cb 100644 --- a/home/extra/neovim/plugins/nonels.nix +++ b/home/extra/neovim/plugins/nonels.nix @@ -1,46 +1,44 @@ { - -programs.nixvim.plugins.none-ls = { - enable = true; - settings = { - cmd = ["bash -c nvim"]; - debug = true; + programs.nixvim.plugins.none-ls = { + enable = true; + settings = { + cmd = ["bash -c nvim"]; + debug = true; + }; + sources = { + code_actions = { + statix.enable = true; + gitsigns.enable = true; }; - sources = { - code_actions = { - statix.enable = true; - gitsigns.enable = true; + diagnostics = { + statix.enable = true; + deadnix.enable = true; + pylint.enable = true; + checkstyle.enable = true; + }; + formatting = { + alejandra.enable = true; + stylua.enable = true; + shfmt.enable = true; + nixpkgs_fmt.enable = true; + google_java_format.enable = false; + prettier = { + enable = true; + disableTsServerFormatter = true; }; - diagnostics = { - statix.enable = true; - deadnix.enable = true; - pylint.enable = true; - checkstyle.enable = true; - }; - formatting = { - alejandra.enable = true; - stylua.enable = true; - shfmt.enable = true; - nixpkgs_fmt.enable = true; - google_java_format.enable = false; - prettier = { - enable = true; - disableTsServerFormatter = true; - }; - black = { - enable = true; - withArgs = '' - { - extra_args = { "--fast" }, - } - ''; - - }; - }; - completion = { - luasnip.enable = true; - spell.enable = true; + black = { + enable = true; + withArgs = '' + { + extra_args = { "--fast" }, + } + ''; }; }; + completion = { + luasnip.enable = true; + spell.enable = true; + }; }; - } + }; +} diff --git a/home/extra/neovim/plugins/yanky.nix b/home/extra/neovim/plugins/yanky.nix new file mode 100644 index 00000000..31437cf2 --- /dev/null +++ b/home/extra/neovim/plugins/yanky.nix @@ -0,0 +1,5 @@ +{ + programs.nixvim.plugins.yanky = { + enable = true; + }; +}