-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc_shortcuts
93 lines (55 loc) · 3.5 KB
/
.vimrc_shortcuts
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
""" LSP
nnoremap <leader>gd <Cmd>lua vim.lsp.buf.definition()<CR>|
nnoremap <leader>gD <Cmd>lua vim.lsp.buf.declaration()<CR>|
nnoremap <leader>gi <Cmd>lua vim.lsp.buf.implementation()<CR>|
nnoremap <leader>go <Cmd>lua vim.lsp.buf.type_definition()<CR>|
nnoremap <leader>gr <Cmd>lua vim.lsp.buf.references()<CR>|
nnoremap <leader>gs <Cmd>lua vim.lsp.buf.signature_help()<CR>|
nnoremap K <Cmd>lua vim.lsp.buf.hover()<CR>|
nnoremap <F1> <Cmd>lua vim.diagnostic.open_float()<CR>|
nnoremap <F2> <Cmd>lua vim.lsp.buf.rename()<CR>|
nnoremap <F3> <Cmd>lua vim.lsp.buf.format({async = true})<CR>|
nnoremap <F4> <Cmd>lua vim.lsp.buf.code_action()<CR>|
vnoremap <F4> <Cmd>lua vim.lsp.buf.code_action()<CR>|
""" Formating
" https://vim.fandom.com/wiki/Shifting_blocks_visually
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
""" Navigation
nnoremap <leader>? :help <C-R><C-W>| " Provide help
nnoremap <leader><leader> :b#<CR>| " Buffers: Toggle current buffer with last opened one
nnoremap <leader>qq :q<CR>| " Exit: close current
nnoremap <leader>qa :qa<CR>| " Exit: close all
nnoremap <C-t> :NvimTreeFindFile<CR>| " File tree (Bundled): Current
nnoremap <leader>ff :Files<CR>| " Fuzzy finder: Files
nnoremap <leader>fb :Buffers<CR>| " Fuzzy finder: Buffers
nnoremap <leader>fl :BLines<CR>| " Fuzzy finder: Buffer Lines
nnoremap <leader>fd :DirFiles<CR>| " Fuzzy finder: Files relative to current file directory
nnoremap <leader>fh :History<CR>| " Fuzzy finder: History
nnoremap <leader>fm :Marks<CR>| " Fuzzy finder: Marks
nnoremap <leader>fgg :GFiles?| " Git: Changed files
nnoremap <leader>fgf :GFiles!?| " Git: Changed files (Fullscreen)
""" Search
nnoremap ,sa :Ag <C-R><C-W>| " Search (FZF): word under cursor
nnoremap ,sm :Maps<CR>| " Search (FZF): Maps
nnoremap ,sc :Commands<CR>| " Search (FZF): Commands
""" Replace
nnoremap ,rr :%s///g<left><left><left>| " Replace: will put cursor in position to add search criteria
nnoremap ,rw :%s/<C-R><C-W>//g<left><left>| " Replace: word under cursor (will put cursor in position to add replacement)
nnoremap ,re :%s/\<<C-R><C-W>\>//g<left><left>| " Replace: word under cursor (will put cursor in position to add replacement)
""" Metadata
command! PathFull let @+ = expand("%:p") " Full path
nnoremap ,mm :PathFull<CR>|
command! PathRel let @+ = expand("%") " Relative path
nnoremap ,mr :PathRel<CR>|
command! PathFilename let @+ = expand("%:t") " Just filename
nnoremap ,mn :PathFilename<CR>|
command! PathDir let @+ = expand('%:p:h') " Just dir of file
nnoremap ,md :PathDir<CR>|
""" Date/Time
nnoremap <leader>id "=strftime('%Y-%m-%d (%a)')<C-M>pa| " Date
nnoremap <leader>it "=strftime('%T (%Z)')<C-M>pa| " Time
""" Misc
nnoremap <leader>$ :set list!<CR> " Toggle hidden characters
nnoremap <leader>z :ZoomToggle<CR> " Toggle zoom to current window split
command! MarksReset delm! | delm A-Z0-9 " Delete all marks