Use jdhao/better-escape.vim to handle jk as escape mappings

only for insert mode ( so also works on terminal too )

remove visual mode key binding, till we find a proper solution, because it is super annoying right now

Original pr here: https://github.com/siduck76/NvChad/pull/160
This commit is contained in:
G-Rowell 2021-07-26 15:06:32 +05:30 committed by Akianonymus
parent 268c37e52f
commit 3b05354337
3 changed files with 14 additions and 6 deletions

View File

@ -18,11 +18,6 @@ map("v", "x", [=[ "_x ]=], opt)
this line too ]] this line too ]]
-- --
-- escape with 'jk' mapping
vim.api.nvim_set_keymap("i", "jk", "<esc>", {})
vim.api.nvim_set_keymap("v", "jk", "<esc>", {})
vim.api.nvim_set_keymap("t", "jk", "<esc>", {})
-- Don't copy the replaced text after pasting in visual mode -- Don't copy the replaced text after pasting in visual mode
map("v", "p", '"_dP', opt) map("v", "p", '"_dP', opt)

View File

@ -16,6 +16,14 @@ return packer.startup(
event = "VimEnter" event = "VimEnter"
} }
use {
"jdhao/better-escape.vim",
event = "InsertEnter",
config = function()
require "plugins.others".escape()
end
}
use { use {
"akinsho/nvim-bufferline.lua", "akinsho/nvim-bufferline.lua",
after = "nvim-base16.lua", after = "nvim-base16.lua",
@ -247,7 +255,7 @@ return packer.startup(
use { use {
"tpope/vim-fugitive", "tpope/vim-fugitive",
cmd = { cmd = {
"Git" "Git"
} }
} }
end end

View File

@ -15,6 +15,11 @@ M.comment = function()
end end
end end
M.escape = function()
vim.g.better_escape_interval = 300
vim.g.better_escape_shortcut = {"jk"}
end
M.lspkind = function() M.lspkind = function()
local present, lspkind = pcall(require, "lspkind") local present, lspkind = pcall(require, "lspkind")
if present then if present then