plugin/ux: add hop (easy motion) plugin
This commit is contained in:
parent
252f3cf2a6
commit
3d704b32d0
4 changed files with 50 additions and 2 deletions
|
@ -22,6 +22,7 @@ let
|
||||||
})
|
})
|
||||||
./plugins/lsp
|
./plugins/lsp
|
||||||
./plugins/formatter
|
./plugins/formatter
|
||||||
|
./plugins/ux
|
||||||
];
|
];
|
||||||
|
|
||||||
basicConfigs = builtins.map builtins.readFile [ ./config/basic.lua ];
|
basicConfigs = builtins.map builtins.readFile [ ./config/basic.lua ];
|
||||||
|
|
|
@ -7,5 +7,5 @@ vim.g.loaded_netrwPlugin = 1
|
||||||
-- empty setup using defaults
|
-- empty setup using defaults
|
||||||
require("nvim-tree").setup()
|
require("nvim-tree").setup()
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>nt", ":NvimTreeToggle<CR>")
|
vim.keymap.set("n", "<leader>nt", "<Cmd>NvimTreeToggle<CR>")
|
||||||
vim.keymap.set("n", "<leader>nf", ":NvimTreeFindFile<CR>")
|
vim.keymap.set("n", "<leader>nf", "<Cmd>NvimTreeFindFile<CR>")
|
||||||
|
|
7
plugins/ux/default.nix
Normal file
7
plugins/ux/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{ hop-nvim, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
luaConfig = builtins.readFile ./hop-nvim.lua;
|
||||||
|
|
||||||
|
plugins = [ hop-nvim ];
|
||||||
|
}
|
40
plugins/ux/hop-nvim.lua
Normal file
40
plugins/ux/hop-nvim.lua
Normal file
|
@ -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", "<leader>hw", "<Cmd>HopWord<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>hp", "<Cmd>HopPattern<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>hl", "<Cmd>HopLine<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>hv", "<Cmd>HopVertical<CR>")
|
Reference in a new issue