add key-maps for Hop
This commit is contained in:
2
init.lua
2
init.lua
@@ -37,6 +37,8 @@ vim.opt.cmdheight = 2 -- Shows better messages
|
||||
vim.opt.foldmethod = "indent"
|
||||
vim.opt.foldlevel = 99
|
||||
|
||||
vim.g.mapleader = " " -- set leader key to space
|
||||
vim.g.maplocalleader = " " -- set local leader key to space
|
||||
|
||||
|
||||
require("config.lazy")
|
||||
|
@@ -50,7 +50,7 @@ if vim.g.vscode then
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<c-h>', codeReader.quickInfo)
|
||||
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
@@ -62,6 +62,31 @@ if vim.g.vscode then
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
|
||||
local hop = require('hop')
|
||||
local directions = require('hop.hint').HintDirection
|
||||
vim.keymap.set('n', '<leader>f', function()
|
||||
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
|
||||
end, {remap=true})
|
||||
vim.keymap.set('n', '<leader>F', function()
|
||||
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
|
||||
end, {remap=true})
|
||||
vim.keymap.set('n', '<leader>t', function()
|
||||
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
|
||||
end, {remap=true})
|
||||
vim.keymap.set('n', '<leader>T', function()
|
||||
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
|
||||
end, {remap=true})
|
||||
vim.keymap.set('n', '<leader>s', function()
|
||||
hop.hint_char1()
|
||||
end, {remap=true})
|
||||
vim.keymap.set('n', '<leader>S', function()
|
||||
hop.hint_char2()
|
||||
end, {remap=true})
|
||||
vim.keymap.set('n', '<leader>sw', function()
|
||||
hop.hint_words()
|
||||
end, {remap=true})
|
||||
|
||||
else
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
|
Reference in New Issue
Block a user