blob: 9570949b3227f0d27dfc59c48fccd29e2dc95061 (
plain)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
"""""""""""""""""""""""""""""
" Keymaps
"""""""""""""""""""""""""""""
let g:mapleader = "\<Space>"
let g:maplocalleader = ','
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
""""""""""""""""""""
" Window movement
""""""""""""""""""""
" Go to the bottom window
noremap <C-j> <C-w>j
" Go to the top window
noremap <C-k> <C-w>k
" Go to the right window
noremap <C-l> <C-w>l
" Go to the left window
noremap <C-h> <C-w>h
""""""""""""""""""""""""
" Remove highlighting
""""""""""""""""""""""""
nnoremap <leader>hl :nohlsearch<CR>
" Save file
nnoremap <C-s> :w!<CR>
""""""""""""""""""""""""""
" Buffer
"""""""""""""""""""""""""
" Close the current buffer
noremap <leader>bd :Bclose<cr>:tabclose<cr>gT
" Close all the buffers
noremap <leader>ba :bufdo bd<cr>
" Go to the next buffer
noremap <leader>bn :bnext<cr>
" Go to the previous buffer
noremap <leader>bp :bprevious<cr>
""""""""""""""""""""""""""""
" Tabs
"""""""""""""""""""""""""""
" Open a new tab
noremap <leader>tn :tabnew<cr>
" Close all others tab
noremap <leader>to :tabonly<cr>
" Close current tab page
noremap <leader>tc :tabclose<cr>
" Move tabs after another
noremap <leader>tm :tabmove
" Go to the next tab
noremap <leader>t<leader> :tabnext<cr>
" Let 'tl' toggle between this and the last accessed tab
let g:lasttab = 1
nnoremap <leader>tl :exe "tabn ".g:lasttab<CR>
au TabLeave * let g:lasttab = tabpagenr()
" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
noremap <leader>te :tabedit <C-r>=escape(expand("%:p:h"), " ")<cr>/
" Switch CWD to the directory of the open buffer
noremap <leader>cd :cd %:p:h<cr>:pwd<cr>
" Specify the behavior when switching between buffers
try
set switchbuf=useopen,usetab,newtab
set stal=2
catch
endtry
" Return to last edit position when opening files (You want this!)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
""""""""""""""""""""""""
" Netrw
"""""""""""""""""""""""
" Toggle tree view
nnoremap <C-f> :Lexplore<CR>
""""""""""""""""""""
" GitGutter
""""""""""""""""""""
let g:gitgutter_enabled=1 " Enable by default gitgutter
" Go to the previous hunk
nnoremap <leader>hp <Plug>(GitGutterPrevHunk)
" Go to the next hunk
nnoremap <leader>hn <Plug>(GitGutterNextHunk)
" Enable / Disable GitGutter
nnoremap <leader>ht <Plug>(GitGutterToggle)
" Stage Hunk in Git
nnoremap <leader>hs <Plug>(GitGutterStageHunk)
" Undo Hunk
nnoremap <leader>hu <Plug>(GitGutterUndoHunk)
" Preview Hunk
nnoremap <leader>hP :GitGutterPreviewHunk<CR>
" Always show the status line
set laststatus=2
"""""""""""""""""""""
" Spell
"""""""""""""""""""""
" Toggle and untoggle spell checking
noremap <leader>ss :setlocal spell!<cr>
" Next word to spellcheck
noremap <leader>sn ]s
" Previous word to spellcheck
noremap <leader>sp [s
" Add word into the spellcheck dictionnary
noremap <leader>sa zg
" show the list of alternatives for the word
noremap <leader>s? z=
"""""""""""""""""""
" LSP
"""""""""""""""""""
inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Go to definition
nnoremap <leader>ld :LspDefinition<cr>
" Go next diagnostic
nnoremap <leader>lnd :LspNextDiagnostic<cr>
" Go previous diagnostic
nnoremap <leader>lpd :LspPreviousDiagnostic<cr>
" Go to reference
nnoremap <leader>lf :LspReferences<cr>
" Rename object
nnoremap <leader>lr :LspRename<cr>
" LSP stop server
nnoremap <leader>ls :LspStopServer<cr>
" peek definition of object
nnoremap <leader>lp :LspPeekDefinition<cr>
" Code Action
nnoremap <leader>la :LspCodeAction<cr>
" Hover information
nnoremap <leader>lh :LspHover<cr>
|
ArKa projects. All rights to me, and your next child right arm.