mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
fix(keymaps): better escape
This commit is contained in:
parent
6bc56e4e81
commit
8f113a514c
1 changed files with 7 additions and 6 deletions
|
@ -4,12 +4,6 @@
|
||||||
-- use `vim.keymap.set` instead
|
-- use `vim.keymap.set` instead
|
||||||
local map = LazyVim.safe_keymap_set
|
local map = LazyVim.safe_keymap_set
|
||||||
|
|
||||||
-- Clear search and stop snippet on escape
|
|
||||||
Snacks.util.on_key("<esc>", function()
|
|
||||||
vim.cmd("noh")
|
|
||||||
LazyVim.cmp.actions.snippet_stop()
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- better up/down
|
-- better up/down
|
||||||
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true })
|
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true })
|
||||||
map({ "n", "x" }, "<Down>", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true })
|
map({ "n", "x" }, "<Down>", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true })
|
||||||
|
@ -51,6 +45,13 @@ map("n", "<leader>bo", function()
|
||||||
end, { desc = "Delete Other Buffers" })
|
end, { desc = "Delete Other Buffers" })
|
||||||
map("n", "<leader>bD", "<cmd>:bd<cr>", { desc = "Delete Buffer and Window" })
|
map("n", "<leader>bD", "<cmd>:bd<cr>", { desc = "Delete Buffer and Window" })
|
||||||
|
|
||||||
|
-- Clear search and stop snippet on escape
|
||||||
|
map({ "i", "n", "s" }, "<esc>", function()
|
||||||
|
vim.cmd("noh")
|
||||||
|
LazyVim.cmp.actions.snippet_stop()
|
||||||
|
return "<esc>"
|
||||||
|
end, { expr = true, desc = "Escape and Clear hlsearch" })
|
||||||
|
|
||||||
-- Clear search, diff update and redraw
|
-- Clear search, diff update and redraw
|
||||||
-- taken from runtime/lua/_editor.lua
|
-- taken from runtime/lua/_editor.lua
|
||||||
map(
|
map(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue