diff --git a/default.nix b/default.nix index 2f87f6a..caee21d 100644 --- a/default.nix +++ b/default.nix @@ -22,6 +22,7 @@ let }) ./plugins/lsp ./plugins/formatter + ./plugins/ux ]; basicConfigs = builtins.map builtins.readFile [ ./config/basic.lua ]; diff --git a/plugins/explorer/nvim-tree.lua b/plugins/explorer/nvim-tree.lua index 4f6182f..fe0d0b0 100644 --- a/plugins/explorer/nvim-tree.lua +++ b/plugins/explorer/nvim-tree.lua @@ -7,5 +7,5 @@ vim.g.loaded_netrwPlugin = 1 -- empty setup using defaults require("nvim-tree").setup() -vim.keymap.set("n", "nt", ":NvimTreeToggle") -vim.keymap.set("n", "nf", ":NvimTreeFindFile") +vim.keymap.set("n", "nt", "NvimTreeToggle") +vim.keymap.set("n", "nf", "NvimTreeFindFile") diff --git a/plugins/ux/default.nix b/plugins/ux/default.nix new file mode 100644 index 0000000..1c45390 --- /dev/null +++ b/plugins/ux/default.nix @@ -0,0 +1,7 @@ +{ hop-nvim, ... }: + +{ + luaConfig = builtins.readFile ./hop-nvim.lua; + + plugins = [ hop-nvim ]; +} diff --git a/plugins/ux/hop-nvim.lua b/plugins/ux/hop-nvim.lua new file mode 100644 index 0000000..d3e7d47 --- /dev/null +++ b/plugins/ux/hop-nvim.lua @@ -0,0 +1,40 @@ +-- See: https://github.com/phaazon/hop.nvim/wiki/Configuration +local hop = require("hop") +require("hop").setup({}) + +------------------------------------------------------------------------------- +-- Keybindings + +local hint = require("hop.hint") + +vim.keymap.set("", "f", function() + hop.hint_char1({ + direction = hint.HintDirection.AFTER_CURSOR, + current_line_only = true, + }) +end) +vim.keymap.set("", "F", function() + hop.hint_char1({ + direction = hint.HintDirection.BEFORE_CURSOR, + current_line_only = true, + }) +end) +vim.keymap.set("", "t", function() + hop.hint_char1({ + direction = hint.HintDirection.AFTER_CURSOR, + current_line_only = true, + hint_offset = -1, + }) +end) +vim.keymap.set("", "T", function() + hop.hint_char1({ + direction = hint.HintDirection.BEFORE_CURSOR, + current_line_only = true, + hint_offset = 1, + }) +end) + +vim.keymap.set("n", "hw", "HopWord") +vim.keymap.set("n", "hp", "HopPattern") +vim.keymap.set("n", "hl", "HopLine") +vim.keymap.set("n", "hv", "HopVertical")