|
|
|
@ -24,45 +24,6 @@ map("v", "x", [=[ "_x ]=], opt)
|
|
|
|
|
this line too ]]
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
-- toggle unix readline's keymap
|
|
|
|
|
map("n", user_map.unix_keymap.toggle_unix_keymap,"<cmd>lua require 'mappings'.unix_keymap()<CR>",{nowait = true})
|
|
|
|
|
|
|
|
|
|
local _cmap_containp = function (key)
|
|
|
|
|
local cmap_tab = vim.api.nvim_get_keymap("c")
|
|
|
|
|
|
|
|
|
|
for _, value in ipairs(cmap_tab) do
|
|
|
|
|
if value['lhs'] == key then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
M.unix_keymap = function()
|
|
|
|
|
local m = user_map.unix_keymap
|
|
|
|
|
|
|
|
|
|
if _cmap_containp("<C-A>") then
|
|
|
|
|
vim.api.nvim_del_keymap("i", m.forward)
|
|
|
|
|
vim.api.nvim_del_keymap("i", m.backward)
|
|
|
|
|
vim.api.nvim_del_keymap("i", m.top_of_line)
|
|
|
|
|
vim.api.nvim_del_keymap("i", m.end_of_line)
|
|
|
|
|
vim.api.nvim_del_keymap("c", m.forward)
|
|
|
|
|
vim.api.nvim_del_keymap("c", m.backward)
|
|
|
|
|
vim.api.nvim_del_keymap("c", m.top_of_line)
|
|
|
|
|
vim.api.nvim_del_keymap("c", m.end_of_line)
|
|
|
|
|
else
|
|
|
|
|
map("i", m.forward, '<Right>', opt)
|
|
|
|
|
map("i", m.backward, '<Left>', opt)
|
|
|
|
|
map("i", m.top_of_line, '<ESC>^i', opt)
|
|
|
|
|
map("i", m.end_of_line, '<End>', opt)
|
|
|
|
|
vim.api.nvim_set_keymap("c", m.forward, '<Right>', {noremap = true})
|
|
|
|
|
vim.api.nvim_set_keymap("c", m.backward, '<Left>', {noremap = true})
|
|
|
|
|
vim.api.nvim_set_keymap("c", m.top_of_line, '<Home>', {noremap = true})
|
|
|
|
|
vim.api.nvim_set_keymap("c", m.end_of_line, '<End>', {noremap = true})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Don't copy the replaced text after pasting in visual mode
|
|
|
|
|
map("v", "p", '"_dP', opt)
|
|
|
|
|
|
|
|
|
@ -185,4 +146,18 @@ M.fugitive = function()
|
|
|
|
|
map("n", m.git_blame, ":Git blame<CR>", opt)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- navigation within insert mode
|
|
|
|
|
local check_insertNav = require("chadrc").options.enable_insertNav
|
|
|
|
|
|
|
|
|
|
if check_insertNav == true then
|
|
|
|
|
local m = user_map.insert_nav
|
|
|
|
|
|
|
|
|
|
map("i", m.forward, "<Right>", opt)
|
|
|
|
|
map("i", m.backward, "<Left>", opt)
|
|
|
|
|
map("i", m.top_of_line, "<ESC>^i", opt)
|
|
|
|
|
map("i", m.end_of_line, "<End>", opt)
|
|
|
|
|
map("i", m.next_line, "<Up>", opt)
|
|
|
|
|
map("i", m.prev_line, "<Down>", opt)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|
|
|
|
|