-
Notifications
You must be signed in to change notification settings - Fork 0
/
06_mappings.vim
134 lines (107 loc) · 5.15 KB
/
06_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
127
128
129
130
131
132
133
134
" ~ Custom bindings/mappings via u_keymapper.vim plugin
call u_keymapper#init()
" remap ; to :
nmap ; :
" set leader key for custom commands
let mapleader=","
" https://github.com/r00k/dotfiles/blob/master/vimrc
" Disable that goddamn 'Entering Ex mode. Type 'visual' to go to Normal mode.'
" that I trigger 40x a day.
nmap Q <Nop>
" Disable K looking man stuff up
nmap K <Nop>
KeyMapGroup "Bash-like keys for cmd"
KeyMap cnoremap <C-A> <Home> "Bash-like CTRL+A for command line"
KeyMap cnoremap <C-E> <End> "Bash-like CTRL+E for command line"
KeyMap cnoremap <C-K> <C-U> "Bash-like CTRL+K for command line"
KeyMapGroupEnd
KeyMapGroup "Tabs, windows, buffer navigation"
KeyMap nmap <S-Right> :tabnext<CR> "Next tab"
KeyMap nmap <S-Left> :tabprevious<CR> "Previous tab"
KeyMap nmap <S-Up> :bnext<CR> "Next buffer"
KeyMap nmap <S-Down> :bprevious<CR> "Prev buffer"
KeyMap nmap Q :tabclose<CR> "Close tab"
KeyMap nmap Z :bdelete<CR> "Delete buffer"
KeyMapGroupEnd
KeyMapGroup "Visual align text"
KeyMap xmap ga <Plug>(EasyAlign) "Align in visual mode (e.g. `vipga`)"
KeyMap nmap ga <Plug>(EasyAlign) "Align for a motion/text object (e.g. `gaip`)"
KeyMapGroupEnd
KeyMapGroup "Navigation"
" KeyMap nmap <leader>et :Tagbar<CR> "Tagbar"
KeyMap nmap <leader>n :NERDTree<CR> "NERDTree for project"
KeyMap nmap <leader>N :NERDTree %<CR> "NERDTree for current file"
" Neotree
KeyMap nmap <leader>m :Neotree<CR> "Neotree"
KeyMap nmap <leader>M :Neotree %<CR> "Neotree for current file"
KeyMap nmap <leader>, :Neotree buffers<CR> "Neotree buffers"
KeyMap nmap <leader>. :Neotree float git_status<CR> "Neotree git"
" Tabs
KeyMap nmap <leader>t :tabnew<CR> "Create new tab"
" ctrl+mousewheel for tab switching
KeyMap nnoremap <C-ScrollWheelUp> :tabnext<CR> "ctrl+mousewheel for tab switching"
KeyMap nnoremap <C-ScrollWheelDown> :tabprevious<CR> "ctrl+mousewheel for tab switching"
KeyMap noremap <leader>x <cmd>bp\|bd#<CR> "Kill current buffer"
" run AnyJump on ctrl+click
KeyMap nnoremap <C-LeftMouse> :AnyJump<CR> "Run AnyJump on ctrl+click"
KeyMapGroupEnd
KeyMapGroup "Commenting"
KeyMap nmap <leader>c <Plug>CommentaryLine "Comment current line"
KeyMap vmap <leader>c <Plug>Commentary "Comment visualy selected text"
KeyMapGroupEnd
KeyMapGroup "FZF navigation"
KeyMap nmap <leader>b :Buffers<CR> "fzf Buffers"
KeyMap nmap <leader>q :Files<CR> "fzf Project files"
KeyMapGroupEnd
" eval current vimscrupt buffer
KeyMapGroup <leader>e "Vim manipulations"
KeyMap nmap <leader>ec :Color <CR> "fzf colorschemes select"
KeyMap nmap <leader>ee :so %<CR> "(vimrc) Eval current file as vimscript"
KeyMap nmap <leader>eb :e ~/.vimrc <CR> "(vimrc) Open $MYVIMRC in current buffer"
KeyMapGroupEnd
KeyMapGroup <leader>g "Git Mappings"
KeyMap nmap <leader>gg :tab Git<CR> "Open Git in new tab"
KeyMap nmap <leader>gG :Git<CR> "Open Git in split"
KeyMap nmap <leader>gb :Git blame<CR> "Git blame for file"
KeyMapGroupEnd
KeyMapGroup "OSX clipboard"
KeyMap noremap <Leader>y "*y 'Copy to system clipboard'
KeyMap noremap <Leader>p "*p 'Paste from system clipboard'
KeyMap noremap <Leader>Y "+y 'Copy to editor clipboard'
KeyMap noremap <Leader>P "+p 'Paste from editor clipboard'
KeyMapGroupEnd
" KeyMapGroup <leader>r "Tests runners"
" KeyMap nmap <silent> <leader>rf :TestFile<CR> "Test file"
" KeyMap nmap <silent> <leader>rd :TestFile -f d<CR> "Test file -f d"
" KeyMap nmap <silent> <leader>rn :TestNearest<CR> "Test nearest"
" KeyMap nmap <silent> <leader>rs :TestSuite<CR> "Test suite"
" KeyMap nmap <silent> <leader>rl :TestLast<CR> "Test last"
" KeyMapGroupEnd
KeyMapGroup "Terminal mode"
" KeyMap tnoremap <Esc> <C-\><C-n> "Exit to normal mode from terminal with esc"
" make C-w C-w works in term
KeyMap tnoremap <C-w> <C-\><C-o><C-w> "Make C-w C-w works in term"
KeyMapGroupEnd
" source: https://vim.fandom.com/wiki/Search_for_visually_selected_text
KeyMap vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR> "Search visual selected text via //"
KeyMapGroup 'Quickfix'
KeyMap nnoremap <Leader>co :copen<CR> "Show quickfix"
KeyMap nnoremap <Leader>cc :cclose<CR> "Hide quickfix"
KeyMapGroupEnd
KeyMapGroup 'Cycle through text objects with space'
KeyMap map <SPACE> <Plug>(wildfire-fuel) "This selects the next closest text object"
KeyMap vmap <C-SPACE> <Plug>(wildfire-water) "This selects the previous closest text object"
KeyMapGroupEnd
" KeyMapGroup <leader>g "Telescope"
" KeyMap nnoremap <leader>gT <cmd>Telescope<cr> "Telescope"
" KeyMap nnoremap <leader>gf <cmd>Telescope find_files<cr> "Files"
" KeyMap nnoremap <leader>gb <cmd>Telescope buffers<cr> "Buffers"
" KeyMap nnoremap <leader>gl <cmd>Telescope oldfiles<cr> "Old files"
" KeyMap nnoremap <leader>gc <cmd>Telescope themes<cr> "Themes"
" KeyMap nnoremap <leader>gk <cmd>Telescope keymaps<cr> "Keys"
" KeyMap nnoremap <leader>gh <cmd>Telescope git_commits<cr> "Git commits"
" KeyMap nnoremap <leader>gs <cmd>Telescope git_status<cr> "Git status"
" KeyMap nnoremap <leader>gr <cmd>Telescope registers<cr> "Keys"
" KeyMap nnoremap <leader>gd <cmd>Telescope diagnostics<cr> "Keys"
" KeyMapGroupEnd
KeyMap nnoremap <Leader>gS :lua require('search').open()<CR> "Run search window"