From 087b8756a6113c78ae20ee00c96c38f5922287a0 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Fri, 13 Jan 2023 16:14:16 +0100 Subject: vim: fmt, remove polyglot, add impatient --- common/vim.nix | 233 ++++++++++++++++++++++++++----------------------------- dotfiles/vim.lua | 4 +- 2 files changed, 114 insertions(+), 123 deletions(-) diff --git a/common/vim.nix b/common/vim.nix index cb83a96..2f36958 100644 --- a/common/vim.nix +++ b/common/vim.nix @@ -1,53 +1,51 @@ -inputs: - -{ config, pkgs, lib, ... }: - -let +inputs: { + config, + pkgs, + lib, + ... +}: let inherit (pkgs.unstable) vimPlugins wrapNeovim tree-sitter; - luaFormat = inputs.self.lib.generators.lua { }; + luaFormat = inputs.self.lib.generators.lua {}; neovim-unwrapped = pkgs.unstable.neovim-unwrapped; cfg = config.vim; - myConfigPackage = - with lib; - let config = - '' - -- Autogenerated variables from the NixOS configuration + myConfigPackage = with lib; let + config = '' + -- Autogenerated variables from the NixOS configuration - ${(concatStringsSep - "\n" - (mapAttrsToList - (variable: value: "vim.g.${variable} = ${luaFormat.generate value}") - cfg.variables))} + ${(concatStringsSep + "\n" + (mapAttrsToList + (variable: value: "vim.g.${variable} = ${luaFormat.generate value}") + cfg.variables))} - -- vim.lua from the NixOS configuration + -- vim.lua from the NixOS configuration - ${builtins.readFile ../dotfiles/vim.lua} + ${builtins.readFile ../dotfiles/vim.lua} - -- luaConfig from the NixOS configuration + -- luaConfig from the NixOS configuration - ${cfg.luaConfig} - ''; - in + ${cfg.luaConfig} + ''; + in pkgs.runCommand - "myConfig" - { - pname = "myConfig"; - inherit config; - passAsFile = [ "config" ]; - runLocal = true; - } - '' - mkdir -p "$out/lua" - mv "$configPath" "$out/lua/myConfig.lua" - ''; + "myConfig" + { + pname = "myConfig"; + inherit config; + passAsFile = ["config"]; + runLocal = true; + } + '' + mkdir -p "$out/lua" + mv "$configPath" "$out/lua/myConfig.lua" + ''; myNeovim = wrapNeovim neovim-unwrapped { configure = { - inherit (config.vim) beforePlugins; customRC = '' @@ -57,95 +55,95 @@ let ''; packages.myVimPackage = with vimPlugins; { - start = [ - myConfigPackage - - # Dependencies - plenary-nvim - popup-nvim - - # UI - undotree - gruvbox-community - lualine-nvim - lualine-lsp-progress - gitsigns-nvim - diffview-nvim - nvim-notify - indent-blankline-nvim - - # Completion - nvim-cmp - cmp-buffer - cmp-calc - cmp-cmdline - cmp-latex-symbols - cmp-nvim-lsp - cmp-path - cmp-spell - cmp-tmux - cmp-treesitter - cmp-vsnip - - # Snippets - vim-vsnip - vim-vsnip-integ - - # Telescope - telescope-nvim - telescope-file-browser-nvim - telescope-ui-select-nvim - - # Treesitter - nvim-treesitter.withAllGrammars - nvim-treesitter-textobjects - nvim-treesitter-context - nvim-treesitter-refactor - - vim-matchup - - # Motions - camelcasemotion - vim-surround - targets-vim - - neoformat - - # Languages - vim-polyglot - editorconfig-nvim - vim-pandoc - # Fixes "duplicated vim plugin" issue - (refactoring-nvim.overrideAttrs (old: { dependencies = []; })) - - # Other - tmux-complete-vim - vim-fugitive - vim-rhubarb - vim-repeat - vim-unimpaired - tabular - vim-abolish - vim-oscyank - comment-nvim - null-ls-nvim - ] ++ config.vim.extraPlugins; + start = + [ + myConfigPackage + + # Dependencies + plenary-nvim + popup-nvim + + # UI + undotree + gruvbox-community + lualine-nvim + lualine-lsp-progress + gitsigns-nvim + diffview-nvim + nvim-notify + indent-blankline-nvim + + # Completion + nvim-cmp + cmp-buffer + cmp-calc + cmp-cmdline + cmp-latex-symbols + cmp-nvim-lsp + cmp-path + cmp-spell + cmp-tmux + cmp-treesitter + cmp-vsnip + + # Snippets + vim-vsnip + vim-vsnip-integ + + # Telescope + telescope-nvim + telescope-file-browser-nvim + telescope-ui-select-nvim + + # Treesitter + nvim-treesitter.withAllGrammars + nvim-treesitter-textobjects + nvim-treesitter-context + nvim-treesitter-refactor + + vim-matchup + + # Motions + camelcasemotion + vim-surround + targets-vim + + neoformat + + # Languages + editorconfig-nvim + vim-pandoc + # Fixes "duplicated vim plugin" issue + (refactoring-nvim.overrideAttrs (old: {dependencies = [];})) + + # Other + comment-nvim + impatient-nvim + null-ls-nvim + tabular + tmux-complete-vim + vim-abolish + vim-fugitive + vim-oscyank + vim-repeat + vim-rhubarb + vim-unimpaired + ] + ++ config.vim.extraPlugins; }; }; }; -in -{ +in { options.vim = with lib; { - variables = mkOption { type = types.attrsOf luaFormat.type; - default = { }; + default = {}; description = "Extra global variables to add at the beginning of the vim configuration."; }; extraPlugins = mkOption { type = with types; listOf package; - default = [ ]; + default = []; description = "Names of extra plugins to add"; }; @@ -200,14 +198,7 @@ in NEOVIDE_MULTIGRID = "1"; }; - home-manager.users.minijackson = { ... }: - { - xdg.dataFile."nvim/backup/.keep".text = ""; - }; - - home-manager.users.root = { ... }: - { - xdg.dataFile."nvim/backup/.keep".text = ""; - }; + home-manager.users.minijackson.xdg.dataFile."nvim/backup/.keep".text = ""; + home-manager.users.root.xdg.dataFile."nvim/backup/.keep".text = ""; }; } diff --git a/dotfiles/vim.lua b/dotfiles/vim.lua index 1f206ca..defee0c 100644 --- a/dotfiles/vim.lua +++ b/dotfiles/vim.lua @@ -142,9 +142,9 @@ end, mapopts) -- Plugins ---------- --- Polyglot +-- Impatient -vim.g.polyglot_disabled = {"sensible"} +require("impatient") -- Gitsigns -- cgit v1.2.3