nvim: make <Home> toggler work in insert and visual mode, too
This commit is contained in:
parent
0c2b77555d
commit
bdd03d2329
|
@ -33,12 +33,13 @@ map('n', '<M-Down>', '<C-e>')
|
|||
map('v', '<Leader>y', '"+y')
|
||||
map('n', '<Leader>p', '"+p')
|
||||
|
||||
map('n', '<Home>', -- toggle between beginning of line and beginning of text
|
||||
-- toggle between beginning of line and beginning of text
|
||||
map({ 'n', 'i', 'v' }, '<Home>',
|
||||
function()
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
if (col == 0) then
|
||||
-- TODO: figure out which function that calls
|
||||
vim.api.nvim_feedkeys('^', 'n', false)
|
||||
local col_new = vim.api.nvim_get_current_line():match('^%s*'):len()
|
||||
vim.api.nvim_win_set_cursor(0, { row, col_new })
|
||||
else
|
||||
vim.api.nvim_win_set_cursor(0, { row, 0 })
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user