-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmappings.vim
126 lines (100 loc) · 2.73 KB
/
mappings.vim
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
nnoremap <leader>w :w!<cr>
nnoremap <leader>q :q<cr>
" nnoremap <leader><leader>s :source ~/.vimrc<cr>
" nnoremap <Leader>y "+y
" nnoremap <Leader>p "+p
"nnoremap <CR> G
"奇怪的语法 把 C-Space 映射为 Esc
"inoremap <NUL> <Esc>
"vnoremap <NUL> <Esc>
"cnoremap <NUL> <Esc>
"nnoremap <NUL> a
nnoremap H 0
nnoremap L $
"map <C-space> <C-c>
" mark
" nmap <leader>mm `
"nmap <leader>; :
" vim 映射模式
" nore 非递归
" n 普通模式
" v 可视模式
" i 插入模式
" c 命令行模式
"
" quickfix
" nnoremap <c-l> :cn<cr>
" nnoremap <c-h> :cp<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 折叠
" :nnoremap <C-l> za
"let g:onedark_termcolors=256
" 参考 https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/ 的一些配置
" set selection=exclusive
map $ g_
" 禁用 C-b 默认行为
map <C-b> <Nop>
" Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk
map <C-w>L :vertical resize +50<cr>
map <C-w>H :vertical resize -50<cr>
map <C-w>K :resize +20<cr>
map <C-w>J :resize -20<cr>
" buffer navigation
map <C-b>l :bnext<cr>
map <C-b>h :bprevious<cr>
map <C-b>L :blast<cr>
map <C-b>H :bfirst<cr>
map <C-b>d :bd<cr>
map <C-b>; :ls<cr>
nnoremap <leader>g <C-^>
nnoremap ' ,
nnoremap T %
" nnoremap ; `
" tab navigation
map <C-t>l :tabn<cr>
map <C-t>h :tabp<cr>
map <C-t>n :tabedit %<cr>
map <C-t>; :tabs<cr>
map <C-t>g :tabm
map <C-t>L :tablast<cr>
map <C-t>H :tabfirst<cr>
" insert mode
inoremap <C-w> <C-[>diwi
inoremap <C-a> <Home>
inoremap <C-e> <End>
inoremap <C-b> <Left>
inoremap <C-f> <Right>
" inoremap <C-n> <Down>
" inoremap <C-p> <Up>
" 实现 (、[、{、"、' 输入后自动补全右边部分,光标也会位于中间位置
" inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
" inoremap < <><ESC>i
" inoremap " ""<ESC>i
" inoremap ' ''<ESC>i
" 选中缩进
" vmap < <gv
" vmap > >gv
" => Editing mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remap VIM 0 to first non-blank character
" map 0 ^
"设置 %% 获取当前文件所在路径
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
cnoremap <expr> %p getcmdtype() == ':' ? expand('%:p').'/' : '%p'
" 设置 %f 获取当前文件
cnoremap <expr> %h getcmdtype() == ':' ? expand('%') : '%h'
" 设置 %b 查看当前行 git blame
cnoremap <expr> %b "! git blame -L" . line('.') . ' ' . expand('%')
cnoremap <expr> %s 'source ~/.vimrc'
" nnoremap <leader><leader>s :source ~/.vimrc<cr>
" set conceallevel=0
" 设置json conceallevel
nnoremap <leader>j :call ConceallevelToggle()<cr>
nnoremap <leader>p :echo join(split(&runtimepath, ','), "\n")<CR>
command! -bang MAP map<bang>