nvim: Add function to easily work with jump list & access change list

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-05-03 10:43:23 +05:30
parent 33148207ec
commit b42d4cc7a7

View file

@ -195,6 +195,10 @@ inoremap <Esc> <Nop>
cnoremap <Esc> <Nop>
" Use Q to execute default register.
nnoremap Q <Nop>
" Jump and change list
nnoremap <Leader>o :call GotoJump()<CR>
nnoremap <Leader>; :changes<CR>:keepjumps norm g;<Left><Left>
nnoremap <Leader>, :changes<CR>:keepjumps norm g,<Left><Left>
" For Fuzzy
nnoremap <Leader>ff :GFiles<CR>
@ -592,3 +596,17 @@ function! PrevHunkAllBuffers()
endif
endwhile
endfunction
function! GotoJump()
jumps
let j = input("Please select your jump: ")
if j != ''
let pattern = '\v\c^\+'
if j =~ pattern
let j = substitute(j, pattern, '', 'g')
execute "normal " . j . "\<C-i>"
else
execute "normal " . j . "\<C-o>"
endif
endif
endfunction