From b2c7b3b95d753926bbf350fb52df8723fce7368b Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 15 Nov 2018 10:43:28 +0100 Subject: tv vim: add fzf --- tv/2configs/vim.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 2ac7f75..544fe94 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -14,6 +14,16 @@ let { }; extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [ + # cannot use pkgs.vimPlugins.fzf-vim as it's missing :Rg + (pkgs.vimUtils.buildVimPlugin { + name = "junegunn"; + src = pkgs.fetchgit { + url = git://github.com/junegunn/fzf.vim; + rev = "ad1833ecbc9153b6e34a4292dc089a58c4bcb8dc"; + sha256 = "1z2q71q6l9hq9fqfqpj1svhyk4yk1bzw1ljhksx4bnpz8gkfbx2m"; + }; + }) + pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree pkgs.vimPlugins.vim-elixir (pkgs.vimUtils.buildVimPlugin { @@ -309,6 +319,11 @@ let { paths = [ (pkgs.writeDashBin "vim" '' set -efu + export FZF_DEFAULT_COMMAND='${pkgs.ripgrep}/bin/rg --files' + export PATH=$PATH:${makeBinPath [ + pkgs.fzf + pkgs.ripgrep + ]} (umask 0077; exec ${pkgs.coreutils}/bin/mkdir -p ${toString need-dirs}) exec ${pkgs.vim}/bin/vim "$@" '') @@ -385,5 +400,9 @@ let { noremap [c | noremap! [c noremap [d | noremap! [d vnoremap u + + " fzf + nnoremap q :Files + nnoremap w :Rg ''; } -- cgit v1.2.3 From 7915dd3e1fd34ee698f25b6acdafa4626d0c30eb Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 15 Nov 2018 10:45:22 +0100 Subject: tv vim: M-a edits alternate buffer --- tv/2configs/vim.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 544fe94..469ae3e 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -404,5 +404,9 @@ let { " fzf nnoremap q :Files nnoremap w :Rg + + " edit alternate buffer + " For some reason neither putting 6 nor ^ works here... + nnoremap a  ''; } -- cgit v1.2.3 From 2b6a4e00d9d42dac7680a91ec796f3aaba1335ce Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 16 Nov 2018 17:06:20 +0100 Subject: tv vim: set timeoutlen=0 --- tv/2configs/vim.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 469ae3e..a63d802 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -348,6 +348,7 @@ let { set shortmess+=I set showcmd set showmatch + set timeoutlen=0 set ttimeoutlen=0 set undodir=${dirs.undodir} set undofile -- cgit v1.2.3 From b719e5ebce5d69f7fe66510b34b51f8ea7aee5e1 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 16 Nov 2018 17:18:07 +0100 Subject: tv vim: neaten fzf plugin --- tv/2configs/vim.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index a63d802..e51f077 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -16,9 +16,9 @@ let { extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [ # cannot use pkgs.vimPlugins.fzf-vim as it's missing :Rg (pkgs.vimUtils.buildVimPlugin { - name = "junegunn"; + name = "fzf-2018-11-14"; src = pkgs.fetchgit { - url = git://github.com/junegunn/fzf.vim; + url = https://github.com/junegunn/fzf.vim; rev = "ad1833ecbc9153b6e34a4292dc089a58c4bcb8dc"; sha256 = "1z2q71q6l9hq9fqfqpj1svhyk4yk1bzw1ljhksx4bnpz8gkfbx2m"; }; -- cgit v1.2.3 From 8978d5b8523eb6d75139ff92dec5bfdbaf3507d6 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 16 Nov 2018 17:19:13 +0100 Subject: tv vim elixir: b916c00 -> 0a847f0 --- tv/2configs/vim.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index e51f077..a5641f0 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -25,7 +25,14 @@ let { }) pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - pkgs.vimPlugins.vim-elixir + (pkgs.vimUtils.buildVimPlugin { + name = "vim-elixir-2018-08-17"; + src = pkgs.fetchgit { + url = https://github.com/elixir-editors/vim-elixir; + rev = "0a847f0faed5ba2d94bb3d51f355c50f37ba025b"; + sha256 = "1jl85wpgywhcvhgw02y8zpvqf0glr4i8522kxpvhsiacb1v1xh04"; + }; + }) (pkgs.vimUtils.buildVimPlugin { name = "vim-syntax-jq"; src = pkgs.fetchgit { -- cgit v1.2.3 From e976ff74e3938979f5f8432d8edfd175aa9b3b1c Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 2 Dec 2018 16:03:36 +0100 Subject: tv: rename vim-tv to vim-syntax-nix-nested --- tv/2configs/vim.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index a5641f0..c6364c2 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -129,7 +129,7 @@ let { command! -n=0 -bar ShowSyntax :call ShowSyntax() ''; }))) - ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" { + ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { "/syntax/haskell.vim".text = /* vim */ '' syn region String start=+\[[[:alnum:]]*|+ end=+|]+ -- cgit v1.2.3 From eb8c62ea3d246430bd1e4ebd348d5fc4eb15c123 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 2 Dec 2018 15:48:01 +0100 Subject: tv vim-syntax-nix-nested: simplify regexes --- tv/2configs/vim.nix | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index c6364c2..0092808 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -239,26 +239,56 @@ let { " This is required because containedin isn't transitive. syn cluster nix_has_dollar_curly \ add=@nix_${lang}_syntax - '') { + '') (let + + capitalize = s: let + xs = stringToCharacters s; + in + toUpper (head xs) + concatStrings (tail xs); + + alts = xs: ''\(${concatStringsSep ''\|'' xs}\)''; + def = k: ''${k}[ \t\r\n]*=''; + writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)''; + + in { c = {}; cabal = {}; diff = {}; haskell = {}; - jq.extraStart = concatStringsSep ''\|'' [ - ''writeJq.*'' + jq.extraStart = alts [ + (writer "Jq") ''write[^ \t\r\n]*[ \t\r\n]*"[^"]*\.jq"'' ]; lua = {}; - sed.extraStart = ''writeSed[^ \t\r\n]*[ \t\r\n]*"[^"]*"''; - sh.extraStart = concatStringsSep ''\|'' [ - ''write\(A\|Ba\|Da\)sh[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)'' - ''[a-z]*Phase[ \t\r\n]*='' + sed.extraStart = writer "Sed"; + sh.extraStart = let + phases = [ + "unpack" + "patch" + "configure" + "build" + "check" + "install" + "fixup" + "installCheck" + "dist" + ]; + shells = [ + "ash" + "bash" + "dash" + ]; + in alts [ + (def "shellHook") + (def "${alts phases}Phase") + (def "${alts ["pre" "post"]}${alts (map capitalize phases)}") + (writer (alts (map capitalize shells))) ]; yaml = {}; vim.extraStart = ''write[^ \t\r\n]*[ \t\r\n]*"\(\([^"]*\.\)\?vimrc\|[^"]*\.vim\)"''; xdefaults = {}; - })} + }))} " Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY. syn clear shVarAssign -- cgit v1.2.3 From c5e758ca583770344b067237b3f43844b2745930 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 2 Dec 2018 16:07:53 +0100 Subject: tv vim-syntax-nix-nested: add js, and py --- tv/2configs/vim.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 0092808..3794628 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -259,7 +259,9 @@ let { (writer "Jq") ''write[^ \t\r\n]*[ \t\r\n]*"[^"]*\.jq"'' ]; + javascript.extraStart = ''/\* js \*/''; lua = {}; + python.extraStart = ''/\* py \*/''; sed.extraStart = writer "Sed"; sh.extraStart = let phases = [ -- cgit v1.2.3