feat(nvim): prevent dot command to change cursor position
This commit is contained in:
parent
c7c9ccf5a8
commit
ac58cb8e33
@ -35,6 +35,25 @@ map('n', '<Leader>hl', create_function_tabdo('lua toggle_number_style()'),
|
||||
map('i', 'jf', '<ESC>`^')
|
||||
map('i', 'оа', '<ESC>`^')
|
||||
|
||||
map('i',
|
||||
'<C-[>',
|
||||
function()
|
||||
local current_line, _ = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
vim.api.nvim_win_set_cursor(0, {current_line, COLUMN_NUMBER_BEFORE_INSERT})
|
||||
vim.cmd('stopinsert')
|
||||
end
|
||||
)
|
||||
|
||||
map('n',
|
||||
'.',
|
||||
function()
|
||||
local current_position = vim.api.nvim_win_get_cursor(0)
|
||||
vim.cmd('norm! .')
|
||||
vim.api.nvim_win_set_cursor(0, current_position)
|
||||
end,
|
||||
{remap = false}
|
||||
)
|
||||
|
||||
map('n', 'Ж', ':')
|
||||
|
||||
map('n', '<Enter>', 'o<ESC>')
|
||||
|
||||
@ -60,6 +60,15 @@ opt.mouse = 'a'
|
||||
opt.scrolloff = 999
|
||||
|
||||
|
||||
COLUMN_NUMBER_BEFORE_INSERT=1
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
callback = function()
|
||||
_, COLUMN_NUMBER_BEFORE_INSERT = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- disable paste comment on new line
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = {"*"},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user