-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vscode.vimrc
90 lines (77 loc) · 2.84 KB
/
.vscode.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" As of 2022-11-17, VSCodeVim only supports mappings in this file
" NOTES:
" - By default, VSCodeVim gives <C-s> and <C-z> to VSCode, but that's easily changed in settings JSON.
" To have most of the same defaults as neovim
" Can't remap `Y` as it's used incredibly often and needs to be pressed reliably
"nnoremap Y y$
nnoremap <C-l> :<C-u>nohl<CR><C-l>
inoremap <C-u> <C-g>u<C-u>
inoremap <C-w> <C-g>u<C-w>
" 2022-11-18 \V isn't supported yet.
xnoremap * y/<C-r>"<CR>
xnoremap # y?<C-r>"<CR>
nnoremap & :&&<CR>
" Have j and k navigate visual lines rather than logical ones
map <Down> gj
map <Up> gk
imap <Down> <C-o>gj
imap <Up> <C-o>gk
" 2023-09-11 Actually we let JetBrains handle <C-s> to do swap/transpose
" characters/selections
" Doesn't work but could set it in vscode's Keyboard Shortcuts
nnoremap <C-s> :w<CR><C-l>
" Interestingly, this works better than in vim at the beginning of the line
imap <C-s> <Esc>hxpka
" Folding shortcut
nmap <Space><Space> za
" FIXME 2024-03-29: Liberate digraph key <C-k>
inoremap <C-q><C-k> <C-k>
" Since vim/vscode steals <C-k> for digraphs, we'll make <C-k><C-k> work like it
inoremap <C-k> <C-o>D
" 2023-08-05 FIXME: doesn't work so I'm editing keybindings.json instead
inoremap <C-q><C-i> " Inserts a literal tab
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 2022-11-18 Manual inclusion of init.mappings-surround.vim because `source`
" not yet implemented.
" These might be more convenient than the default vim-surround
" Source: https://www.reddit.com/r/vim/comments/yporwp/my_anal_vimsurround_alternative/
nmap <silent> yS( viWS(
nmap <silent> yS) viWS)
nmap <silent> yS[ viWS[
nmap <silent> yS] viWS]
nmap <silent> yS{ viWS{
nmap <silent> yS} viWS}
nmap <silent> yS< viWS<
nmap <silent> yS> viWS>
nmap <silent> yS" viWS"
nmap <silent> yS' viWS'
" Some markdown ones
nmap <silent> yS` viWS`
nmap <silent> yS_ viWS_
" NOTE: these 3 are tested in vim, IdeaVim, and VSCodeVim. Don't use `gv`
nmap <silent> yS* diWi**<C-r>-**<Esc>
nmap <silent> yS= diWi==<C-r>-==<Esc>
nmap <silent> ySw diWi[[<C-r>-]]<Esc>
nmap <silent> ys( viwS(
nmap <silent> ys) viwS)
nmap <silent> ys[ viwS[
nmap <silent> ys] viwS]
nmap <silent> ys{ viwS{
nmap <silent> ys} viwS}
nmap <silent> ys< viwS<
nmap <silent> ys> viwS>
nmap <silent> ys" viwS"
nmap <silent> ys' viwS'
" Some markdown ones
nmap <silent> ys` viwS`
nmap <silent> ys_ viwS_
" NOTE: these 3 are tested in vim, IdeaVim, and VSCodeVim. Don't use `gv`
nmap <silent> ys* diwi**<C-r>-**<Esc>
nmap <silent> ys= diwi==<C-r>-==<Esc>
nmap <silent> ysw diwi[[<C-r>-]]<Esc>
" NOTE: these 3 are tested in vim, IdeaVim, and VSCodeVim. `gv` used in other
" ways would act inconsistently in all 3.
vmap <silent> s* di**<C-r>-**<Esc>gv4l
vmap <silent> s= di==<C-r>-==<Esc>gv4l
vmap <silent> sw di[[<C-r>-]]<Esc>gv4l