Skip to content

Commit

Permalink
fix: Folding working with vscode neovim plugin (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima authored Feb 17, 2024
1 parent 70d59c4 commit 79eabc0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions config/nvim/plugin/mappings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,25 @@
" General
map <C-S> :w<CR> " CTRL+S to Save file
map <C-Q> :q<CR> " CTRL+Q to Quit file
" Get folding working with vscode neovim plugin
if(exists('g:vscode'))
nnoremap zM :call VSCodeNotify('editor.foldAll')<CR>
nnoremap zR :call VSCodeNotify('editor.unfoldAll')<CR>
nnoremap zc :call VSCodeNotify('editor.fold')<CR>
nnoremap zC :call VSCodeNotify('editor.foldRecursively')<CR>
nnoremap zo :call VSCodeNotify('editor.unfold')<CR>
nnoremap zO :call VSCodeNotify('editor.unfoldRecursively')<CR>
nnoremap za :call VSCodeNotify('editor.toggleFold')<CR>
function! MoveCursor(direction) abort
if(reg_recording() == '' && reg_executing() == '')
return 'g'.a:direction
else
return a:direction
endif
endfunction

nmap <expr> j MoveCursor('j')
nmap <expr> k MoveCursor('k')
endif

0 comments on commit 79eabc0

Please sign in to comment.