-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathvimrc
58 lines (48 loc) · 1.78 KB
/
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
" generally refer to: https://github.com/esm7/obsidian-vimrc-support
" To test file, write file and run "reload app without saving"
"
" To use an obsidian command (see back, forward example):
" - Use Ctrl+Shift+I to open the dev console
" - reload and type :obcommand. The names are now in the Console (2nd tab).
" - note, can't rebind exmap-obmap commands with map
" Also execute codemirror commands with cmcommand, js with jscommand.
"
" Note about `surround`: as of 2022-05-20, surround does not work, and is janky
" anyhow, but there's a fix coming, eventually, maybe.
" Yank to system clipboard https://forum.obsidian.md/t/how-to-copy-with-vim-mode/3881
set clipboard=unnamed
" alt escapes if I forget to escape
imap jj <Esc>
imap kk <Esc>
" The following vim keys are very useful, keep them available:
" Don't overwrite <C-u> or <C-d> for file movement.
" C-i - jump forward, also map to Alt-i for convenience
nmap <C-i> <A-i>
" C-o is taken by open file. Use Alt-o instead.
nmap <C-o> <A-o>
" <C-r> is for search-replace. u/U for undo/redo. Also Ctrl-z/Z native app.
nmap U :redo
" This mapping repeats a mapping in the in-app hotkeys menu for demonstration; the in-app menu overwrites mappings here.
exmap back obcommand app:go-back
nmap <A-,> :back
exmap forward obcommand app:go-forward
nmap <A-.> :forward
" enable select all with C-a
unmap <C-a>
" be able to type gL or dL to delete rest of line
nmap H ^
omap H ^
nmap L $
omap L $
" transpose, shift case
nmap t xhhpll
nmap T ~
" Example leader mapping, set '-' as leader
" may migrate to this if the Leader-Hotkeys normal-mode bug isn't fixed
nmap - <leader>
nmap <leader>j 4j
nmap <leader>k 4k
""" Trash
" - useless, not sure how to get rid of Obsidian's persistent search highlight, except hit esc every time
" nmap <F9> :nohl
" set nohlsearch