···42424343" Editor-specific settings
44444545+" vscode-neovim specific settings
4546if exists('g:vscode')
4646- " vscode-neovim specific settings
4747 xnoremap <silent> <Esc> :<C-u>call VSCodeNotify('closeFindWidget')<CR>
4848 nnoremap <silent> <Esc> :<C-u>call VSCodeNotify('closeFindWidget')<CR>
4949···6868 nmap V V$
69697070 " This allows wrapping + code folding to work
7171- xmap j gj
7272- nmap j gj
7373-7474- xmap k gk
7575- nmap k gk
7171+ map j gj
7272+ map k gk
76737774 " Remap for append/insert with multi-cursor to avoid extra keystroke
7875 xmap <expr> a visualmode() ==# 'v' ? 'a' : 'ma'
···8077 xmap <expr> i visualmode() ==# 'v' ? 'i' : 'mi'
8178 xmap <expr> I visualmode() ==# 'v' ? 'I' : 'mI'
82798383- " Make neovim use vscode builtin search
8080+ " Call VSCode commands using a visual selection from nvim
8181+ function! s:vscodeNotifyVisualSelection(cmd) abort
8282+ normal! gv
8383+8484+ let vmode = visualmode()
8585+ if vmode ==# "V"
8686+ let startLine = line("v")
8787+ let endLine = line(".")
8888+ call VSCodeNotifyRange(a:cmd, startLine, endLine, 1)
8989+ else
9090+ let [startLine, startColumn] = getpos("v")[1:2]
9191+ let [endLine, endColumn] = getpos(".")[1:2]
9292+ call VSCodeNotifyRangePos(a:cmd, startLine, endLine, startColumn, endColumn, 1)
9393+ endif
9494+ endfunction
9595+9696+ xnoremap <silent> <Leader>f :<C-u>call <SID>vscodeNotifyVisualSelection("actions.find")<CR>
9797+ xnoremap <silent> <Leader>r :<C-u>call <SID>vscodeNotifyVisualSelection("editor.action.startFindReplaceAction")<CR>
9898+9999+ " TODO: Make neovim use vscode builtin search
84100 " This is commented out because it doesn't really work well with cursor
85101 " movement, and using nvim's builtin search with / is better. It would be
86102 " nice to have though.
8787- " " TODO: probably can write a function that sets a variable forward or reverse search
103103+ " " probably can write a function that sets a variable forward or reverse search
88104 " " For now n and N will always go in the same direction
89105 " noremap <silent> ? :<C-u>call VSCodeNotify('actions.find')<CR>
90106 " noremap <silent> / :<C-u>call VSCodeNotify('actions.find')<CR>