diff --git a/config/programs/vim/configuration.nix b/config/programs/vim/configuration.nix index ea3f0a00..cceb088d 100644 --- a/config/programs/vim/configuration.nix +++ b/config/programs/vim/configuration.nix @@ -1,19 +1,19 @@ -{ pkgs, lib, ... }: - +{ + pkgs, + lib, + ... +}: with lib; -with builtins; - -let - getNixFiles = dir: - let - recu = n: k: - if k == "directory" then - getNixFiles "${dir}/${n}" - else if hasSuffix "nix" n then - [ "${dir}/${n}" ] - else - [ ]; - in flatten (mapAttrsToList recu (readDir dir)); +with builtins; let + getNixFiles = dir: let + recu = n: k: + if k == "directory" + then getNixFiles "${dir}/${n}" + else if hasSuffix "nix" n + then ["${dir}/${n}"] + else []; + in + flatten (mapAttrsToList recu (readDir dir)); in { imports = getNixFiles ./modules; @@ -27,7 +27,7 @@ in { output.path.style = "impure"; output.makeWrapper = "--set LUA_PATH '${./modules/lua}/?.lua;;'"; - output.path.path = with pkgs; [ wl-clipboard ]; + output.path.path = with pkgs; [wl-clipboard]; output.extraConfig = '' " Keybindings @@ -36,6 +36,6 @@ in { " TODO: Set clipboard tool with g:clipboard ''; } - # TODO: # https://idie.ru/posts/vim-modern-cpp + diff --git a/config/programs/vim/modules/base.nix b/config/programs/vim/modules/base.nix index 00abca1f..85124d0d 100644 --- a/config/programs/vim/modules/base.nix +++ b/config/programs/vim/modules/base.nix @@ -24,28 +24,28 @@ # Wildmode wildmenu = true; wildignorecase = true; - wildignore = [ "*.o" "*~" "*.out" ]; - wildmode = [ "longest" "list" "full" ]; + wildignore = ["*.o" "*~" "*.out"]; + wildmode = ["longest" "list" "full"]; + }; - # Clipboard command - clipboard = { - name = "kitty"; - copy = { - "+" = "${pkgs.kitty}/bin/kitty +kitten clipboard"; - "*" = "${pkgs.kitty}/bin/kitty +kitten clipboard --use-primary"; - }; - paste = { - "+" = "${pkgs.kitty}/bin/kitty +kitten clipboard --get-clipboard"; - "*" = "${pkgs.kitty}/bin/kitty +kitten clipboard --get-clipboard --use-primary"; - }; + # Clipboard command + vim.g.clipboard = { + name = "kitty"; + copy = { + "+" = "${pkgs.kitty}/bin/kitty +kitten clipboard"; + "*" = "${pkgs.kitty}/bin/kitty +kitten clipboard --use-primary"; + }; + paste = { + "+" = "${pkgs.kitty}/bin/kitty +kitten clipboard --get-clipboard"; + "*" = "${pkgs.kitty}/bin/kitty +kitten clipboard --get-clipboard --use-primary"; }; }; vim.keybindings.keybindings-shortened = { - j = { command = "gj"; }; - k = { command = "gk"; }; - "0" = { command = "g0"; }; - "$" = { command = "g$"; }; + j = {command = "gj";}; + k = {command = "gk";}; + "0" = {command = "g0";}; + "$" = {command = "g$";}; "Y" = { command = "yy"; mode = "n"; diff --git a/config/programs/vim/modules/dev/lazygit.nix b/config/programs/vim/modules/dev/lazygit.nix index 8a8af400..d63c7276 100644 --- a/config/programs/vim/modules/dev/lazygit.nix +++ b/config/programs/vim/modules/dev/lazygit.nix @@ -1,11 +1,14 @@ -{ pkgs, lib, config, ... }: - { + pkgs, + lib, + config, + ... +}: { vim.keybindings.keybindings-shortened."gg" = { command = ":LazyGit"; label = "lazygit"; }; - output.plugins = with pkgs.vimPlugins; [ lazygit-nvim ]; - output.path.path = with pkgs; [ lazygit git ]; + output.plugins = with pkgs.vimPlugins; [lazygit-nvim]; + output.path.path = with pkgs; [lazygit git]; } diff --git a/config/programs/vim/modules/dev/nerdcommenter.nix b/config/programs/vim/modules/dev/nerdcommenter.nix index 336ffca0..54bcc6ee 100644 --- a/config/programs/vim/modules/dev/nerdcommenter.nix +++ b/config/programs/vim/modules/dev/nerdcommenter.nix @@ -1,11 +1,9 @@ -{ pkgs, ... }: +{pkgs, ...}: { + vim.g = { + NERDCreateDefaultMappings = 0; + NERDSpaceDelims = 1; + NERDTrimTrailingWhitespace = 1; + }; -{ - vim.g = { - NERDCreateDefaultMappings = 0; - NERDSpaceDelims = 1; - NERDTrimTrailingWhitespace = 1; - }; - - output.plugins = with pkgs.vimPlugins; [ nerdcommenter ]; - } + output.plugins = with pkgs.vimPlugins; [nerdcommenter]; +} diff --git a/config/programs/vim/modules/dev/vimux.nix b/config/programs/vim/modules/dev/vimux.nix index f2bcef0a..e2450333 100644 --- a/config/programs/vim/modules/dev/vimux.nix +++ b/config/programs/vim/modules/dev/vimux.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { # TODO: Don't let the runner inherit nix-neovim's PATH vim.g = { @@ -12,14 +10,29 @@ vim.keybindings.keybindings."" = { # It's possible to also use vim-tmux-navigator's :TmuxNavigatePrevious # Not too keen on it yet though - rr = { command = "VimuxRunLastCommand"; label = "Rerun Command"; }; - rp = { command = "VimuxPromptCommand"; label = "Prompt Command"; }; + rr = { + command = "VimuxRunLastCommand"; + label = "Rerun Command"; + }; + rp = { + command = "VimuxPromptCommand"; + label = "Prompt Command"; + }; - ro = { command = "VimuxOpenRunner"; label = "Open Runner"; }; - rq = { command = "VimuxCloseRunner"; label = "Close Runner"; }; + ro = { + command = "VimuxOpenRunner"; + label = "Open Runner"; + }; + rq = { + command = "VimuxCloseRunner"; + label = "Close Runner"; + }; - ry = { command = "VimuxInspectRunner"; label = "Copy Mode"; }; + ry = { + command = "VimuxInspectRunner"; + label = "Copy Mode"; + }; }; - output.plugins = with pkgs.vimPlugins; [ vimux ]; + output.plugins = with pkgs.vimPlugins; [vimux]; } diff --git a/config/programs/vim/modules/keybindings.nix b/config/programs/vim/modules/keybindings.nix index 7eae9ac3..d188f58c 100644 --- a/config/programs/vim/modules/keybindings.nix +++ b/config/programs/vim/modules/keybindings.nix @@ -5,7 +5,6 @@ # Documented keybindings accessible via SPC keybindings."" = { - ### LaTeX commands l = { # name = "LaTeX"; @@ -32,7 +31,6 @@ }; }; - ### Git commands v = { # name = "git"; @@ -80,11 +78,10 @@ # Quick and dirty general keybindings keybindings-shortened = { - k = { command = "gk"; }; - j = { command = "gj"; }; - "0" = { command = "g0"; }; - "$" = { command = "g$"; }; + k = {command = "gk";}; + j = {command = "gj";}; + "0" = {command = "g0";}; + "$" = {command = "g$";}; }; - }; } diff --git a/config/programs/vim/modules/languages/config/nix.nix b/config/programs/vim/modules/languages/config/nix.nix index 224380c1..1ab2442a 100644 --- a/config/programs/vim/modules/languages/config/nix.nix +++ b/config/programs/vim/modules/languages/config/nix.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - -{ - output.plugins = with pkgs.vimPlugins; [ vim-nix ]; +{pkgs, ...}: { + output.plugins = with pkgs.vimPlugins; [vim-nix]; } diff --git a/config/programs/vim/modules/languages/copilot.nix b/config/programs/vim/modules/languages/copilot.nix index da803444..93db8186 100644 --- a/config/programs/vim/modules/languages/copilot.nix +++ b/config/programs/vim/modules/languages/copilot.nix @@ -1,11 +1,9 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { vim.g = { copilot_filetypes = { "*" = true; }; copilot_node_command = "${pkgs.nodejs-16_x}/bin/node"; }; - output.plugins = with pkgs.vimPlugins; [ copilot-vim ]; + output.plugins = with pkgs.vimPlugins; [copilot-vim]; } diff --git a/config/programs/vim/modules/languages/java.nix b/config/programs/vim/modules/languages/java.nix index ef1bc6ba..f690bc2f 100644 --- a/config/programs/vim/modules/languages/java.nix +++ b/config/programs/vim/modules/languages/java.nix @@ -4,11 +4,9 @@ ... }: with builtins; -with lib; -let - jdtls-lua = replaceStrings ["@jdt-language-server@" "@openjdk@"] ["${pkgs.jdt-language-server}" "${pkgs.openjdk}" ] (readFile ../lua/jdtls.lua); -in -{ +with lib; let + jdtls-lua = replaceStrings ["@jdt-language-server@" "@openjdk@"] ["${pkgs.jdt-language-server}" "${pkgs.openjdk}"] (readFile ../lua/jdtls.lua); +in { output.config_file = '' lua << EOF ${jdtls-lua} diff --git a/config/programs/vim/modules/languages/nvim-cmp.nix b/config/programs/vim/modules/languages/nvim-cmp.nix index 93809987..d9e67770 100644 --- a/config/programs/vim/modules/languages/nvim-cmp.nix +++ b/config/programs/vim/modules/languages/nvim-cmp.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { output.plugins = with pkgs.vimPlugins; [ nvim-cmp @@ -18,12 +16,12 @@ # See :help cmp-mapping sources = [ - { name = "path"; } - { name = "calc"; } - { name = "nvim_lsp"; } - { name = "nvim_lua"; } - { name = "latex_symbols"; } - { name = "buffer"; } + {name = "path";} + {name = "calc";} + {name = "nvim_lsp";} + {name = "nvim_lua";} + {name = "latex_symbols";} + {name = "buffer";} ]; }; } diff --git a/config/programs/vim/modules/languages/treesitter.nix b/config/programs/vim/modules/languages/treesitter.nix index 357ca5bb..25e4f9c5 100644 --- a/config/programs/vim/modules/languages/treesitter.nix +++ b/config/programs/vim/modules/languages/treesitter.nix @@ -1,8 +1,10 @@ -{ pkgs, lib, config, ... }: - -with lib; - -let +{ + pkgs, + lib, + config, + ... +}: +with lib; let cfg = config.treesitter; grammars = pkgs.tree-sitter.builtGrammars; in { @@ -13,7 +15,6 @@ in { highlight.enable = true; }; - output.plugins = with pkgs.vimPlugins; - [ (nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars)) ]; + output.plugins = with pkgs.vimPlugins; [(nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))]; }; } diff --git a/config/programs/vim/modules/ux/telescope.nix b/config/programs/vim/modules/ux/telescope.nix index cbfc320c..a59da81e 100644 --- a/config/programs/vim/modules/ux/telescope.nix +++ b/config/programs/vim/modules/ux/telescope.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { output.extraConfig = '' lua <" "g" "z" "" "\"" ]; + triggers = ["" "g" "z" "" "\""]; }; } diff --git a/config/programs/vim/modules/vim-stuff/vim-repeat.nix b/config/programs/vim/modules/vim-stuff/vim-repeat.nix index 3117f2ad..fcf68315 100644 --- a/config/programs/vim/modules/vim-stuff/vim-repeat.nix +++ b/config/programs/vim/modules/vim-stuff/vim-repeat.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - -{ - output.plugins = with pkgs.vimPlugins; [ vim-repeat ]; +{pkgs, ...}: { + output.plugins = with pkgs.vimPlugins; [vim-repeat]; } diff --git a/config/programs/vim/modules/vim-stuff/vim-surround.nix b/config/programs/vim/modules/vim-stuff/vim-surround.nix index e11e5174..382c1cbe 100644 --- a/config/programs/vim/modules/vim-stuff/vim-surround.nix +++ b/config/programs/vim/modules/vim-stuff/vim-surround.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - -{ - output.plugins = with pkgs.vimPlugins; [ vim-surround ]; +{pkgs, ...}: { + output.plugins = with pkgs.vimPlugins; [vim-surround]; } diff --git a/config/programs/vim/modules/visual/colourscheme.nix b/config/programs/vim/modules/visual/colourscheme.nix index 3f9a7d9e..6a5f4fb8 100644 --- a/config/programs/vim/modules/visual/colourscheme.nix +++ b/config/programs/vim/modules/visual/colourscheme.nix @@ -1,11 +1,10 @@ -{ pkgs, ... }: - -let scheme = "gruvbox"; +{pkgs, ...}: let + scheme = "gruvbox"; in { output.config_file = "colo ${scheme}"; vim.g.lightline.colorscheme = scheme; vim.g.tokyonight_style = "storm"; - output.plugins = with pkgs.vimPlugins; [ gruvbox tokyonight-nvim ]; + output.plugins = with pkgs.vimPlugins; [gruvbox tokyonight-nvim]; } diff --git a/config/programs/vim/modules/visual/dashboard.nix b/config/programs/vim/modules/visual/dashboard.nix index 42b033b9..8fec725d 100644 --- a/config/programs/vim/modules/visual/dashboard.nix +++ b/config/programs/vim/modules/visual/dashboard.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { vim.g = { dashboard_custom_footer = [ "It's pretty hard to tell what does bring happiness; poverty and wealth" @@ -29,27 +27,27 @@ dashboard_default_executive = "telescope"; dashboard_custom_section = { "1_oldfiles" = { - description = [ " Open History -" ]; + description = [" Open History -"]; command = "Telescope oldfiles"; }; "2_find_files" = { - description = [ " Find File SPC f o" ]; + description = [" Find File SPC f o"]; command = "Telescope find_files"; }; "3_new_file" = { - description = [ " New File -" ]; + description = [" New File -"]; command = "enew"; }; "4_lazygit" = { - description = [ " lazygit SPC g g" ]; + description = [" lazygit SPC g g"]; command = "LazyGit"; }; "5_live_grep" = { - description = [ " Live Grep SPC f /" ]; + description = [" Live Grep SPC f /"]; command = "Telescope live_grep"; }; }; }; - output.plugins = with pkgs.vimPlugins; [ dashboard-nvim ]; + output.plugins = with pkgs.vimPlugins; [dashboard-nvim]; } diff --git a/config/programs/vim/modules/visual/gitsigns.nix b/config/programs/vim/modules/visual/gitsigns.nix index b2cfd277..45d78f37 100644 --- a/config/programs/vim/modules/visual/gitsigns.nix +++ b/config/programs/vim/modules/visual/gitsigns.nix @@ -1,11 +1,9 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { plugin.setup.gitsigns = { # Disable default keybindings keymaps = {}; }; - output.plugins = with pkgs.vimPlugins; [ gitsigns-nvim ]; - output.path.path = with pkgs; [ git ]; + output.plugins = with pkgs.vimPlugins; [gitsigns-nvim]; + output.path.path = with pkgs; [git]; } diff --git a/config/programs/vim/modules/visual/lightline.nix b/config/programs/vim/modules/visual/lightline.nix index 4ef464d9..51b0d616 100644 --- a/config/programs/vim/modules/visual/lightline.nix +++ b/config/programs/vim/modules/visual/lightline.nix @@ -1,15 +1,13 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { vim.opt.showmode = false; vim.g.lightline = { active = { - left = [ [ "mode" "paste" ] [ "readonly" "filename" "modified" ] ]; + left = [["mode" "paste"] ["readonly" "filename" "modified"]]; right = [ - [ "lineinfo" ] - [ "percent" ] - [ "fileformat" "fileencoding" "filetype" ] + ["lineinfo"] + ["percent"] + ["fileformat" "fileencoding" "filetype"] ]; }; separator = { @@ -22,5 +20,5 @@ }; }; - output.plugins = with pkgs.vimPlugins; [ lightline-vim ]; + output.plugins = with pkgs.vimPlugins; [lightline-vim]; } diff --git a/config/programs/vim/modules/visual/todo-comments.nix b/config/programs/vim/modules/visual/todo-comments.nix index c6f47975..ef390d0d 100644 --- a/config/programs/vim/modules/visual/todo-comments.nix +++ b/config/programs/vim/modules/visual/todo-comments.nix @@ -1,11 +1,9 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { vim.keybindings.keybindings-shortened = { - "gt" = { command = "TodoTelescope"; }; + "gt" = {command = "TodoTelescope";}; }; plugin.setup.todo-comments = {}; - output.plugins = with pkgs.vimPlugins; [ todo-comments-nvim ]; + output.plugins = with pkgs.vimPlugins; [todo-comments-nvim]; }