context.vim
context.vim copied to clipboard
Is there mapping to jump to start of context block?
noob question but couldn't find related in the doc. Asking if there's a key mapping for jump to start of the block? Thanks!
You can create your own mapping in your vimrc by using w:context variable created by the plugin
function! ContextJumpToNearest()
if exists("w:context") " variable is local to current window, and contains infos about context preview
if len(w:context.lines) > 0
" 0 - manually add current pos to jmp history
normal! m'
" 1 - jump to context line
let nearest_context_line = w:context.lines[-1][0].number
let col = indent(nearest_context_line) + 1
call cursor(nearest_context_line, col)
else
echo "cannot jump: no context window currently displayed"
endif
else
echo "cannot jump: context.vim disabled"
endif
endfunction
nnoremap gc :call ContextJumpToNearest()<CR>