From 2a81d89cc5e20263b653125dafa2a9bcb345b41c Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Mon, 9 Sep 2024 14:30:54 +0200 Subject: [PATCH 1/8] fix weird terminal behavior with the space key --- plugins/toggleterm.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/toggleterm.nix b/plugins/toggleterm.nix index 7e4aaaa..e2fffbb 100644 --- a/plugins/toggleterm.nix +++ b/plugins/toggleterm.nix @@ -93,7 +93,7 @@ in options.desc = "Switch to normal mode"; } { - mode = [ "n" "t" ]; + mode = [ "n" ]; key = "tn"; action.__raw = '' function() @@ -107,7 +107,7 @@ in options.desc = "Rename current terminal"; } { - mode = [ "n" "t" ]; + mode = [ "n" ]; key = "tl"; action = "TermSelect"; options.desc = "List terminals"; From d0b55f6037e692f91e3a3881cfb653f9c38b9aff Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Mon, 9 Sep 2024 14:55:39 +0200 Subject: [PATCH 2/8] add flash --- plugins/flash.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/flash.nix diff --git a/plugins/flash.nix b/plugins/flash.nix new file mode 100644 index 0000000..fe6fc3e --- /dev/null +++ b/plugins/flash.nix @@ -0,0 +1,37 @@ +_: +{ + opts.enable = true; + + rootOpts.keymaps = [ + { + mode = ["n" "x" "o" ]; + key = "s"; + options.desc = "Flash jump"; + action.__raw = ''function() require("flash").jump() end''; + } + { + mode = "n"; + key = "S"; + options.desc = "Flash Treesitter"; + action.__raw = ''function() require("flash").treesitter() end''; + } + { + mode = "o"; + key = "R"; + options.desc = "Remote Flash"; + action.__raw = ''function() require("flash").remote() end''; + } + { + mode = "o"; + key = "r"; + options.desc = "Flash Treesitter search"; + action.__raw = ''function() require("flash").treesitter_search() end''; + } + { + mode = "c"; + key = ""; + options.desc = "Toggle flash search"; + action.__raw = ''function() require("flash").toggle() end''; + } + ]; +} From d03c34858d20ead5a2a96399b5ecf9e6a49a2b90 Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Mon, 9 Sep 2024 14:55:54 +0200 Subject: [PATCH 3/8] change the next snippet node keybindings --- plugins/luasnip.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/luasnip.nix b/plugins/luasnip.nix index 5f97d0a..e3ab507 100644 --- a/plugins/luasnip.nix +++ b/plugins/luasnip.nix @@ -10,13 +10,13 @@ _:{ rootOpts.keymaps = [ { mode = "i"; - key = ""; + key = ""; action.__raw = ''function() require("luasnip").jump(1) end''; options.desc = "Jump to next snippet node"; } { mode = "i"; - key = ""; + key = ""; action.__raw = ''function() require("luasnip").jump(-1) end''; options.desc = "Jump to previous snippet node"; } From 2e7086dc2252f2c72483bdbdcb7fae46bf539dea Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Tue, 10 Sep 2024 11:55:56 +0200 Subject: [PATCH 4/8] add some treesitter options --- plugins/treesitter.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/treesitter.nix b/plugins/treesitter.nix index c966506..6436780 100644 --- a/plugins/treesitter.nix +++ b/plugins/treesitter.nix @@ -83,24 +83,32 @@ "]k" = { query = "@block.outer"; desc = "Next block start"; }; "]f" = { query = "@function.outer"; desc = "Next function start"; }; "]a" = { query = "@parameter.inner"; desc = "Next argument start"; }; + "]?" = { query = "@condition.outer"; desc = "Next conditional start"; }; + "]l" = { query = "@loop.outer"; desc = "Next loop start"; }; + "]c" = { query = "@call.inner"; desc = "Previous call start"; }; }; gotoNextEnd = { "]K" = { query = "@block.outer"; desc = "Next block end"; }; "]F" = { query = "@function.outer"; desc = "Next function end"; }; "]A" = { query = "@parameter.inner"; desc = "Next argument end"; }; + "]L" = { query = "@loop.outer"; desc = "Next loop end"; }; }; gotoPreviousStart = { "[k" = { query = "@block.outer"; desc = "Previous block start"; }; "[f" = { query = "@function.outer"; desc = "Previous function start"; }; "[a" = { query = "@parameter.inner"; desc = "Previous argument start"; }; + "[?" = { query = "@condition.outer"; desc = "Previous conditional start"; }; + "[l" = { query = "@loop.outer"; desc = "Previous loop start"; }; + "[c" = { query = "@call.inner"; desc = "Previous call start"; }; }; gotoPreviousEnd = { "[K" = { query = "@block.outer"; desc = "Previous block end"; }; "[F" = { query = "@function.outer"; desc = "Previous function end"; }; "[A" = { query = "@parameter.inner"; desc = "Previous argument end"; }; + "[L" = { query = "@loop.outer"; desc = "Previous loop end"; }; }; }; From 9b81cc6cb497539330eac6acd01d10a3ceb303ef Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Wed, 11 Sep 2024 10:45:51 +0200 Subject: [PATCH 5/8] add the window picker --- plugins/nvim-window-picker/default.nix | 46 ++++++++++++++++++++++++++ plugins/nvim-window-picker/package.nix | 23 +++++++++++++ plugins/zoxide.vim/package.nix | 1 + 3 files changed, 70 insertions(+) create mode 100644 plugins/nvim-window-picker/default.nix create mode 100644 plugins/nvim-window-picker/package.nix diff --git a/plugins/nvim-window-picker/default.nix b/plugins/nvim-window-picker/default.nix new file mode 100644 index 0000000..7694b54 --- /dev/null +++ b/plugins/nvim-window-picker/default.nix @@ -0,0 +1,46 @@ +{lib, pkgs, ...}:{ + extra = { + packages = [ + (import ./package.nix { inherit lib pkgs; }) + ]; + + config = /*Lua*/ '' + require('window-picker').setup({ + hint = 'statusline-winbar', --alternative: 'floating-big-letter', + picker_config = { + statusline_winbar_picker = { + selection_display = function(char, windowid) + return table.concat({'%=', '=== ', char, ' ===', '%='}) + end + }, + }, + highlights = { + statusline = { + focused = { + fg = '#E67e80', + bg = '#2e383c', + bold = true, + }, + unfocused = { + fg = '#a7c080', + bg = '#2e383c', + bold = true, + }, + }, + winbar = { + focused = { + fg = '#E67e80', + bg = '#2e383c', + bold = true, + }, + unfocused = { + fg = '#a7c080', + bg = '#2e383c', + bold = true, + }, + }, + } + }) + ''; + }; +} diff --git a/plugins/nvim-window-picker/package.nix b/plugins/nvim-window-picker/package.nix new file mode 100644 index 0000000..44d3ff0 --- /dev/null +++ b/plugins/nvim-window-picker/package.nix @@ -0,0 +1,23 @@ +{ pkgs, ...}: +let + version = "v2.0.3"; + owner = "s1n7ax"; + repo = "nvim-window-picker"; +in +pkgs.vimUtils.buildVimPlugin { + name = "nvim-window-picker"; + inherit version; + + # NOTE: for my work PC, fetchFromGithub fails, due to an SSL error + src = builtins.fetchTarball { + url = "http://github.com/${owner}/${repo}/archive/${version}.tar.gz"; + sha256 = "sha256:1bcjsx5qgvj1gi6zdi3fwc44x7afh35xbyrjik0dzl3hj6ds960g"; + }; + + # src = pkgs.fetchFromGitHub { + # owner = "s1n7ax"; + # repo = "nvim-window-picker"; + # rev = version; + # hash = "sha256:1bcjsx5qgvj1gi6zdi3fwc44x7afh35xbyrjik0dzl3hj6ds960g"; + # } +} diff --git a/plugins/zoxide.vim/package.nix b/plugins/zoxide.vim/package.nix index 08767da..eb2f05d 100644 --- a/plugins/zoxide.vim/package.nix +++ b/plugins/zoxide.vim/package.nix @@ -8,6 +8,7 @@ pkgs.vimUtils.buildVimPlugin { name = "zoxide.vim"; inherit version; + # NOTE: for my work PC, fetchFromGithub fails, due to an SSL error src = builtins.fetchTarball { url = "http://github.com/${owner}/${repo}/archive/${version}.tar.gz"; sha256 = "sha256:025rqfs0n2ryi7xwzpq5h2r7jhvxbrb2gjp6fqa072hapgqr0igb"; From 8a56a4a350a6521ca44319dbf0038e1c84435d10 Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Wed, 11 Sep 2024 10:46:48 +0200 Subject: [PATCH 6/8] fix overlaps with flash and surround --- plugins/arrow.nix | 2 +- plugins/flash.nix | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/arrow.nix b/plugins/arrow.nix index 6899cba..90723fc 100644 --- a/plugins/arrow.nix +++ b/plugins/arrow.nix @@ -5,7 +5,7 @@ extra = { packages = [ pkgs.vimPlugins.arrow-nvim ]; - config = '' + config = /*lua*/ '' require('arrow').setup({ show_icons = true, leader_key = ';', -- Recommended to be a single key diff --git a/plugins/flash.nix b/plugins/flash.nix index fe6fc3e..bc827f2 100644 --- a/plugins/flash.nix +++ b/plugins/flash.nix @@ -1,35 +1,43 @@ -_: +{pkgs, ... }: { opts.enable = true; + extra = { + packages = [ pkgs.vimPlugins.flash-nvim ]; + + config = /*lua*/ '' + require("flash").toggle(true) -- activate toggle flash mode + ''; + }; + rootOpts.keymaps = [ { mode = ["n" "x" "o" ]; - key = "s"; + key = "gs"; options.desc = "Flash jump"; action.__raw = ''function() require("flash").jump() end''; } { mode = "n"; - key = "S"; + key = "gS"; options.desc = "Flash Treesitter"; action.__raw = ''function() require("flash").treesitter() end''; } { mode = "o"; - key = "R"; + key = "gR"; options.desc = "Remote Flash"; action.__raw = ''function() require("flash").remote() end''; } { mode = "o"; - key = "r"; + key = "gr"; options.desc = "Flash Treesitter search"; action.__raw = ''function() require("flash").treesitter_search() end''; } { - mode = "c"; - key = ""; + mode = "n"; + key = "uf"; options.desc = "Toggle flash search"; action.__raw = ''function() require("flash").toggle() end''; } From 2779a6d136463e0fbb98a435174487a92ca41d9b Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Wed, 11 Sep 2024 10:47:18 +0200 Subject: [PATCH 7/8] fix treesitter stuff --- plugins/treesitter.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/treesitter.nix b/plugins/treesitter.nix index 6436780..59c5962 100644 --- a/plugins/treesitter.nix +++ b/plugins/treesitter.nix @@ -10,9 +10,7 @@ # Enable treesitter based indentation (use '=' to auto-indent) settings = { indent.enable = true; - highlight = { - enable = true; - }; + highlight.enable = true; }; # Workaround to enable incremental selection without setting default keymaps (keymaps are set globally) @@ -22,8 +20,6 @@ enable = true; keymaps = lib.mkForce { }; }; - - settings.highlight.enable = true; }; rootOpts = { @@ -86,6 +82,7 @@ "]?" = { query = "@condition.outer"; desc = "Next conditional start"; }; "]l" = { query = "@loop.outer"; desc = "Next loop start"; }; "]c" = { query = "@call.inner"; desc = "Previous call start"; }; + "]/" = { query = "@comment.outer"; desc = "Next comment start"; }; }; gotoNextEnd = { @@ -102,6 +99,7 @@ "[?" = { query = "@condition.outer"; desc = "Previous conditional start"; }; "[l" = { query = "@loop.outer"; desc = "Previous loop start"; }; "[c" = { query = "@call.inner"; desc = "Previous call start"; }; + "[/" = { query = "@comment.outer"; desc = "Previous comment start"; }; }; gotoPreviousEnd = { From ca860d410f071b09cc53fae98da5b61eac9184d8 Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Wed, 11 Sep 2024 11:18:03 +0200 Subject: [PATCH 8/8] improve window-picker --- plugins/nvim-window-picker/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/nvim-window-picker/default.nix b/plugins/nvim-window-picker/default.nix index 7694b54..dd3573e 100644 --- a/plugins/nvim-window-picker/default.nix +++ b/plugins/nvim-window-picker/default.nix @@ -7,11 +7,14 @@ config = /*Lua*/ '' require('window-picker').setup({ hint = 'statusline-winbar', --alternative: 'floating-big-letter', + selection_chars = 'ENARITUDÄMCHLGVFXQ', -- default: 'FJDKSLA;CMRUEIWOQP' picker_config = { statusline_winbar_picker = { selection_display = function(char, windowid) return table.concat({'%=', '=== ', char, ' ===', '%='}) - end + end, + + use_winbar = 'smart' }, }, highlights = {