From 42d4706613612703e3715b1ce0a0547be0406c89 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Mon, 14 Feb 2022 15:22:40 +0100 Subject: [PATCH] nvim: Lightspeed --- config/nvim/lua/nifoc/config/lightspeed.lua | 1 + config/nvim/lua/nifoc/plugins.lua | 2 +- programs/nvim/default.nix | 3 +- programs/nvim/plugins.json | 169 -------------------- programs/nvim/plugins.nix | 154 ++++++++++-------- programs/nvim/plugins.yaml | 86 ++++++++++ programs/nvim/update-plugins.sh | 11 +- programs/nvim/update-shell.nix | 1 + 8 files changed, 180 insertions(+), 247 deletions(-) create mode 100644 config/nvim/lua/nifoc/config/lightspeed.lua delete mode 100644 programs/nvim/plugins.json create mode 100644 programs/nvim/plugins.yaml diff --git a/config/nvim/lua/nifoc/config/lightspeed.lua b/config/nvim/lua/nifoc/config/lightspeed.lua new file mode 100644 index 0000000..dfd3c08 --- /dev/null +++ b/config/nvim/lua/nifoc/config/lightspeed.lua @@ -0,0 +1 @@ +require('lightspeed').setup({}) diff --git a/config/nvim/lua/nifoc/plugins.lua b/config/nvim/lua/nifoc/plugins.lua index a7fd864..fbbb6da 100644 --- a/config/nvim/lua/nifoc/plugins.lua +++ b/config/nvim/lua/nifoc/plugins.lua @@ -28,6 +28,7 @@ require('nifoc.config.cursorline') -- Keybindings require('nifoc.config.whichkey') require('nifoc.config.yoink') +require('nifoc.config.lightspeed') -- Syntax require('nifoc.config.treesitter') @@ -56,7 +57,6 @@ require('nifoc.config.matchup') require('nifoc.config.comments') -- Textobjects -require('surround').setup({}) -- UI require('nifoc.config.lualine') diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix index a1e9b46..24a1f3f 100644 --- a/programs/nvim/default.nix +++ b/programs/nvim/default.nix @@ -75,6 +75,7 @@ in { plugin = vim-yoink; optional = true; } { plugin = vim-cutlass; optional = true; } { plugin = vim-subversive; optional = true; } + lightspeed-nvim # Themes dracula-nvim @@ -121,7 +122,7 @@ in # Textobjects nvim-treesitter-textobjects - surround-nvim + vim-surround # UI undotree diff --git a/programs/nvim/plugins.json b/programs/nvim/plugins.json deleted file mode 100644 index 934b999..0000000 --- a/programs/nvim/plugins.json +++ /dev/null @@ -1,169 +0,0 @@ -[ - { - "src": "lewis6991/impatient.nvim" - }, - { - "src": "antoinemadec/FixCursorHold.nvim" - }, - { - "src": "delphinus/vim-auto-cursorline" - }, - { - "src": "folke/which-key.nvim" - }, - { - "src": "svermeulen/vim-yoink" - }, - { - "src": "svermeulen/vim-cutlass" - }, - { - "src": "svermeulen/vim-subversive" - }, - { - "src": "Mofiqul/dracula.nvim" - }, - { - "src": "nvim-treesitter/nvim-treesitter" - }, - { - "src": "nvim-treesitter/playground" - }, - { - "src": "martinda/Jenkinsfile-vim-syntax" - }, - { - "src": "nvim-lua/popup.nvim" - }, - { - "src": "nvim-lua/plenary.nvim" - }, - { - "src": "nvim-telescope/telescope.nvim" - }, - { - "src": "natecraddock/telescope-zf-native.nvim", - "nativeBuildInputs": [ - "just", - "zigpkgs.\"0.9.0\"" - ], - "buildPhase": "just clean\nXDG_CACHE_HOME=./xdg_cache just build\nmv lib/libzf.so lib/libzf-osx-arm64.so\nrm -rf ./xdg_cache" - }, - { - "src": "ahmedkhalf/project.nvim" - }, - { - "src": "neovim/nvim-lspconfig" - }, - { - "src": "jose-elias-alvarez/null-ls.nvim" - }, - { - "src": "kyazdani42/nvim-web-devicons" - }, - { - "src": "folke/trouble.nvim" - }, - { - "src": "onsails/lspkind-nvim" - }, - { - "src": "nvim-lua/lsp-status.nvim" - }, - { - "src": "hrsh7th/nvim-cmp" - }, - { - "src": "hrsh7th/cmp-nvim-lsp" - }, - { - "src": "hrsh7th/cmp-nvim-lsp-signature-help" - }, - { - "src": "L3MON4D3/LuaSnip" - }, - { - "src": "saadparwaiz1/cmp_luasnip" - }, - { - "src": "hrsh7th/cmp-nvim-lua" - }, - { - "src": "hrsh7th/cmp-path" - }, - { - "src": "hrsh7th/cmp-buffer" - }, - { - "src": "ray-x/cmp-treesitter" - }, - { - "src": "hrsh7th/cmp-cmdline" - }, - { - "src": "hrsh7th/cmp-nvim-lsp-document-symbol" - }, - { - "src": "windwp/nvim-autopairs" - }, - { - "src": "windwp/nvim-ts-autotag" - }, - { - "src": "numToStr/Comment.nvim" - }, - { - "src": "nvim-treesitter/nvim-treesitter-textobjects" - }, - { - "src": "blackCauldron7/surround.nvim" - }, - { - "src": "andymass/vim-matchup" - }, - { - "src": "mbbill/undotree" - }, - { - "src": "nvim-lualine/lualine.nvim" - }, - { - "src": "akinsho/bufferline.nvim" - }, - { - "src": "kyazdani42/nvim-tree.lua" - }, - { - "src": "lukas-reineke/indent-blankline.nvim" - }, - { - "src": "lukas-reineke/virt-column.nvim" - }, - { - "src": "norcalli/nvim-colorizer.lua" - }, - { - "src": "lewis6991/gitsigns.nvim" - }, - { - "src": "lewis6991/spellsitter.nvim" - }, - { - "src": "rcarriga/nvim-notify" - }, - { - "src": "LumaKernel/nvim-visual-eof.lua" - }, - { - "src": "RRethy/vim-illuminate" - }, - { - "src": "numToStr/FTerm.nvim" - }, - { - "src": "folke/todo-comments.nvim" - }, - { - "src": "editorconfig/editorconfig-vim" - } -] diff --git a/programs/nvim/plugins.nix b/programs/nvim/plugins.nix index c7a4647..e434666 100644 --- a/programs/nvim/plugins.nix +++ b/programs/nvim/plugins.nix @@ -37,6 +37,42 @@ }; meta.homepage = "https://github.com/delphinus/vim-auto-cursorline"; }; + popup-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "popup.nvim"; + version = "1637254091"; + src = pkgs.fetchFromGitHub { + owner = "nvim-lua"; + repo = "popup.nvim"; + rev = "b7404d35d5d3548a82149238289fa71f7f6de4ac"; + sha256 = "dNWz/xovUg55fDZUpVs/2kLphk3lqQyvPtc9ATwbeSQ="; + fetchSubmodules = true; + }; + meta.homepage = "https://github.com/nvim-lua/popup.nvim"; + }; + plenary-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "plenary.nvim"; + version = "1644502349"; + src = pkgs.fetchFromGitHub { + owner = "nvim-lua"; + repo = "plenary.nvim"; + rev = "66472128c3191b786966798fc956a689705ab1be"; + sha256 = "Iyp2tka563YJjygBiE5g6RDiZWC0Y58w990QAvZVo3A="; + fetchSubmodules = true; + }; + meta.homepage = "https://github.com/nvim-lua/plenary.nvim"; + }; + nvim-web-devicons = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "nvim-web-devicons"; + version = "1644145343"; + src = pkgs.fetchFromGitHub { + owner = "kyazdani42"; + repo = "nvim-web-devicons"; + rev = "e3294f687626b40754bb40ac2d636d166098b2fb"; + sha256 = "pBZ2HrgtNeQ5dF/dZ/DKRRiboplRr5fvSo74ebubUtE="; + fetchSubmodules = true; + }; + meta.homepage = "https://github.com/kyazdani42/nvim-web-devicons"; + }; which-key-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "which-key.nvim"; version = "1642619077"; @@ -85,6 +121,18 @@ }; meta.homepage = "https://github.com/svermeulen/vim-subversive"; }; + lightspeed-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "lightspeed.nvim"; + version = "1644672701"; + src = pkgs.fetchFromGitHub { + owner = "ggandor"; + repo = "lightspeed.nvim"; + rev = "95fba868ea027332c3e12d1481c375a496449587"; + sha256 = "ZbpaYvcsppvNTPvCM7xM6Op61rfhadi7Rx+ihcfyInA="; + fetchSubmodules = true; + }; + meta.homepage = "https://github.com/ggandor/lightspeed.nvim"; + }; dracula-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "dracula.nvim"; version = "1643281801"; @@ -99,12 +147,12 @@ }; nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-treesitter"; - version = "1644822547"; + version = "1644837769"; src = pkgs.fetchFromGitHub { owner = "nvim-treesitter"; repo = "nvim-treesitter"; - rev = "3e99302082489b36480e3b1eeceed763331e790f"; - sha256 = "/dzx5L7H5pEdp14AmLz/yoPOgEh2yEVw5fosezsEEHk="; + rev = "7c6014df2e46d05685fe9a6bbc1d2e399e2b2414"; + sha256 = "eZyUTnpUK+qGA5bmOIksT7GtvEWjiJsn7w4q56zqUAU="; fetchSubmodules = true; }; meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter"; @@ -133,30 +181,6 @@ }; meta.homepage = "https://github.com/martinda/Jenkinsfile-vim-syntax"; }; - popup-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "popup.nvim"; - version = "1637254091"; - src = pkgs.fetchFromGitHub { - owner = "nvim-lua"; - repo = "popup.nvim"; - rev = "b7404d35d5d3548a82149238289fa71f7f6de4ac"; - sha256 = "dNWz/xovUg55fDZUpVs/2kLphk3lqQyvPtc9ATwbeSQ="; - fetchSubmodules = true; - }; - meta.homepage = "https://github.com/nvim-lua/popup.nvim"; - }; - plenary-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "plenary.nvim"; - version = "1644502349"; - src = pkgs.fetchFromGitHub { - owner = "nvim-lua"; - repo = "plenary.nvim"; - rev = "66472128c3191b786966798fc956a689705ab1be"; - sha256 = "Iyp2tka563YJjygBiE5g6RDiZWC0Y58w990QAvZVo3A="; - fetchSubmodules = true; - }; - meta.homepage = "https://github.com/nvim-lua/plenary.nvim"; - }; telescope-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "telescope.nvim"; version = "1644710452"; @@ -200,6 +224,18 @@ }; meta.homepage = "https://github.com/ahmedkhalf/project.nvim"; }; + todo-comments-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "todo-comments.nvim"; + version = "1642601933"; + src = pkgs.fetchFromGitHub { + owner = "folke"; + repo = "todo-comments.nvim"; + rev = "98b1ebf198836bdc226c0562b9f906584e6c400e"; + sha256 = "8uj5TxO9XZlSCB4lVRbKRc1IlUEKcBf/4bDviwuxEgs="; + fetchSubmodules = true; + }; + meta.homepage = "https://github.com/folke/todo-comments.nvim"; + }; nvim-lspconfig = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-lspconfig"; version = "1644780846"; @@ -224,18 +260,6 @@ }; meta.homepage = "https://github.com/jose-elias-alvarez/null-ls.nvim"; }; - nvim-web-devicons = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "nvim-web-devicons"; - version = "1644145343"; - src = pkgs.fetchFromGitHub { - owner = "kyazdani42"; - repo = "nvim-web-devicons"; - rev = "e3294f687626b40754bb40ac2d636d166098b2fb"; - sha256 = "pBZ2HrgtNeQ5dF/dZ/DKRRiboplRr5fvSo74ebubUtE="; - fetchSubmodules = true; - }; - meta.homepage = "https://github.com/kyazdani42/nvim-web-devicons"; - }; trouble-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "trouble.nvim"; version = "1640940059"; @@ -272,6 +296,18 @@ }; meta.homepage = "https://github.com/nvim-lua/lsp-status.nvim"; }; + vim-illuminate = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "vim-illuminate"; + version = "1642116587"; + src = pkgs.fetchFromGitHub { + owner = "RRethy"; + repo = "vim-illuminate"; + rev = "db98338285574265a6ce54370b54d9f939e091bb"; + sha256 = "QnrzzbWonGsnXCXhHmMLqf3LeDw67D6UtGcn9Ytu0MY="; + fetchSubmodules = true; + }; + meta.homepage = "https://github.com/RRethy/vim-illuminate"; + }; nvim-cmp = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-cmp"; version = "1644812796"; @@ -452,17 +488,17 @@ }; meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"; }; - surround-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "surround.nvim"; - version = "1643684895"; + vim-surround = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "vim-surround"; + version = "1643508337"; src = pkgs.fetchFromGitHub { - owner = "blackCauldron7"; - repo = "surround.nvim"; - rev = "549045828bbd9de0746b411a762fa8c382fb10ff"; - sha256 = "XXR/48pbeGwKifYrhtEyMsOCUxejuIla60q0fSYFgTc="; + owner = "tpope"; + repo = "vim-surround"; + rev = "baf89ad26488f6a7665d51b986f5c7ad2d22b30b"; + sha256 = "KLZztzV/3zh52MZ9YG0F/wQnke4EorXOB1YJ/sUL908="; fetchSubmodules = true; }; - meta.homepage = "https://github.com/blackCauldron7/surround.nvim"; + meta.homepage = "https://github.com/tpope/vim-surround"; }; vim-matchup = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "vim-matchup"; @@ -608,18 +644,6 @@ }; meta.homepage = "https://github.com/LumaKernel/nvim-visual-eof.lua"; }; - vim-illuminate = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "vim-illuminate"; - version = "1642116587"; - src = pkgs.fetchFromGitHub { - owner = "RRethy"; - repo = "vim-illuminate"; - rev = "db98338285574265a6ce54370b54d9f939e091bb"; - sha256 = "QnrzzbWonGsnXCXhHmMLqf3LeDw67D6UtGcn9Ytu0MY="; - fetchSubmodules = true; - }; - meta.homepage = "https://github.com/RRethy/vim-illuminate"; - }; FTerm-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "FTerm.nvim"; version = "1641276048"; @@ -632,18 +656,6 @@ }; meta.homepage = "https://github.com/numToStr/FTerm.nvim"; }; - todo-comments-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "todo-comments.nvim"; - version = "1642601933"; - src = pkgs.fetchFromGitHub { - owner = "folke"; - repo = "todo-comments.nvim"; - rev = "98b1ebf198836bdc226c0562b9f906584e6c400e"; - sha256 = "8uj5TxO9XZlSCB4lVRbKRc1IlUEKcBf/4bDviwuxEgs="; - fetchSubmodules = true; - }; - meta.homepage = "https://github.com/folke/todo-comments.nvim"; - }; editorconfig-vim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "editorconfig-vim"; version = "1642820146"; diff --git a/programs/nvim/plugins.yaml b/programs/nvim/plugins.yaml new file mode 100644 index 0000000..1fd4d31 --- /dev/null +++ b/programs/nvim/plugins.yaml @@ -0,0 +1,86 @@ +# Fixes +- src: lewis6991/impatient.nvim +- src: antoinemadec/FixCursorHold.nvim +- src: delphinus/vim-auto-cursorline + +# Utils +- src: nvim-lua/popup.nvim +- src: nvim-lua/plenary.nvim +- src: kyazdani42/nvim-web-devicons + +# Keybindings +- src: folke/which-key.nvim +- src: svermeulen/vim-yoink +- src: svermeulen/vim-cutlass +- src: svermeulen/vim-subversive +- src: ggandor/lightspeed.nvim + +# Themes +- src: Mofiqul/dracula.nvim + +# Syntax +- src: nvim-treesitter/nvim-treesitter +- src: nvim-treesitter/playground +- src: martinda/Jenkinsfile-vim-syntax + +# Telescope +- src: nvim-telescope/telescope.nvim +- src: natecraddock/telescope-zf-native.nvim + nativeBuildInputs: + - just + - zigpkgs."0.9.0" + buildPhase: |- + just clean + XDG_CACHE_HOME=./xdg_cache just build + mv lib/libzf.so lib/libzf-osx-arm64.so + rm -rf ./xdg_cache +- src: ahmedkhalf/project.nvim +- src: folke/todo-comments.nvim + +# # LSP +- src: neovim/nvim-lspconfig +- src: jose-elias-alvarez/null-ls.nvim +- src: folke/trouble.nvim +- src: onsails/lspkind-nvim +- src: nvim-lua/lsp-status.nvim +- src: RRethy/vim-illuminate + +# cmp +- src: hrsh7th/nvim-cmp +- src: hrsh7th/cmp-nvim-lsp +- src: hrsh7th/cmp-nvim-lsp-signature-help +- src: L3MON4D3/LuaSnip +- src: saadparwaiz1/cmp_luasnip +- src: hrsh7th/cmp-nvim-lua +- src: hrsh7th/cmp-path +- src: hrsh7th/cmp-buffer +- src: ray-x/cmp-treesitter +- src: hrsh7th/cmp-cmdline +- src: hrsh7th/cmp-nvim-lsp-document-symbol + +# Pairs +- src: windwp/nvim-autopairs +- src: windwp/nvim-ts-autotag + +# Comments +- src: numToStr/Comment.nvim + +# Textobjects +- src: nvim-treesitter/nvim-treesitter-textobjects +- src: tpope/vim-surround + +# UI +- src: andymass/vim-matchup +- src: mbbill/undotree +- src: nvim-lualine/lualine.nvim +- src: akinsho/bufferline.nvim +- src: kyazdani42/nvim-tree.lua +- src: lukas-reineke/indent-blankline.nvim +- src: lukas-reineke/virt-column.nvim +- src: norcalli/nvim-colorizer.lua +- src: lewis6991/gitsigns.nvim +- src: lewis6991/spellsitter.nvim +- src: rcarriga/nvim-notify +- src: LumaKernel/nvim-visual-eof.lua +- src: numToStr/FTerm.nvim +- src: editorconfig/editorconfig-vim diff --git a/programs/nvim/update-plugins.sh b/programs/nvim/update-plugins.sh index 3d353e4..7f27bb8 100755 --- a/programs/nvim/update-plugins.sh +++ b/programs/nvim/update-plugins.sh @@ -8,7 +8,7 @@ trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG trap 'code=$?; if [ "$code" -ne "0" ]; then echo "\"${last_command}\" command ended with exit code $code."; fi' EXIT script_dir="$(dirname "$(realpath "$0")")" -plugins_json="${script_dir}/plugins.json" +plugins="${script_dir}/plugins.yaml" nix_new_file="${script_dir}/plugins_new.nix" nix_file="${script_dir}/plugins.nix" @@ -19,7 +19,8 @@ if [ -z "$github_auth" ]; then exit 1 fi -readarray -t plugin_array <<<"$(jq -c '.[]' "$plugins_json")" +plugins_json="$(dasel -r yaml -w json . <"$plugins")" +readarray -t plugin_array <<<"$(echo "$plugins_json" | jq -c '.[]')" rm -f "$nix_new_file" echo '# This file has been auto-generated' >"$nix_new_file" @@ -27,7 +28,7 @@ echo '{ pkgs, ... }:' >>"$nix_new_file" echo "{" >>"$nix_new_file" for plugin in "${plugin_array[@]}"; do - raw_src="$(echo "$plugin" | jq -r '.src')" + raw_src="$(echo "$plugin" | dasel -r json --plain '.src')" owner="$(echo "$raw_src" | cut -d'/' -f1)" repo="$(echo "$raw_src" | cut -d'/' -f2)" @@ -44,10 +45,10 @@ for plugin in "${plugin_array[@]}"; do rev="$(echo "$src" | grep rev | cut -d '"' -f 2)" commit_info="$(curl -u "$github_auth" --silent "https://api.github.com/repos/${owner}/${repo}/commits/${rev}")" - commit_date="$(echo "$commit_info" | jq -r '.commit.committer.date')" + commit_date="$(echo "$commit_info" | dasel -r json --plain '.commit.committer.date')" if [[ "$commit_date" == "null" ]]; then - commit_date="$(echo "$commit_info" | jq -r '.commit.author.date')" + commit_date="$(echo "$commit_info" | dasel -r json --plain '.commit.author.date')" fi version="$(date -d "$commit_date" "+%s")" diff --git a/programs/nvim/update-shell.nix b/programs/nvim/update-shell.nix index 46a86a6..eb72678 100644 --- a/programs/nvim/update-shell.nix +++ b/programs/nvim/update-shell.nix @@ -5,6 +5,7 @@ mkShell { packages = [ bat curl + dasel jq nix-prefetch-github nixpkgs-fmt