-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeys.vim
168 lines (130 loc) · 4.14 KB
/
keys.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
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
"" =======================
"" Key bindings for Neovim
"" =======================
" Recent files
" superseded by FZF shortcut
" nnoremap <leader>o :browse oldfiles<CR>
" Save shortcut Ctrl
nmap <C-s> :w<CR>
noremap <C-i> <C-i>
" Nerd commenter use tpope commentary keys
nmap gcc <leader>c<Space>
nmap gcu <leader>cu
vmap gcc <leader>c<Space>
vmap gcu <leader>cu
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
nnoremap n nzzzv
nnoremap N Nzzzv
"" Mundo undo plugin
nnoremap <leader>ut :UndotreeToggle<CR>
" To toggle background
" map <F6> :let &background = ( &background == "dark"? "light" : "dark" )<Enter>
" Tagbar
" nmap <silent> <F4> :TagbarToggle<CR>
" Remap Function keys for use in byobu (as it uses F1 to F9)
" nnoremap <silent> <leader>nf :NERDTreeFind<CR>
" noremap <leader>nt :NERDTreeToggle<CR>
nmap <silent> <leader>tb :TagbarToggle<CR>
"" Nerd Tree Bindings
"" ==================
" nnoremap <silent> <F2> :NERDTreeFind<CR>
" noremap <F3> :NERDTreeToggle<CR>
"" Shortcuts to insert new line in normal mode
nmap oo o<Esc>k
nmap OO O<Esc>j
"" Ale bindings to navigate errors
"" ===============================
nmap <silent> <s-k> <Plug>(ale_previous_wrap)
nmap <silent> <s-j> <Plug>(ale_next_wrap)
nmap <silent> <leader>ll <Plug>(ale_lint)
nmap <silent> <leader>lf <Plug>(ale_fix)
" terminal emulation
nnoremap <silent> <leader>sh :terminal<CR>
"
" Map bindings for terminal buffer
tnoremap <C-x> <C-\><C-n>
"" Split
noremap <Leader>h :<C-u>split<CR>
noremap <Leader>v :<C-u>vsplit<CR>
"" Git
"" Open current line on GitHub
" nnoremap <Leader>o :.Gbrowse<CR>
" noremap <Leader>ga :Gwrite<CR>
" noremap <Leader>gc :Gcommit<CR>
" noremap <Leader>gsh :Gpush<CR>
" noremap <Leader>gll :Gpull<CR>
" noremap <Leader>gs :Gstatus<CR>
" noremap <Leader>gb :Gblame<CR>
" noremap <Leader>gd :Gvdiff<CR>
" noremap <Leader>gr :Gremove<CR>
"" session management
"" ==================
nnoremap <leader>so :OpenSession<Space>
nnoremap <leader>ss :SaveSession<Space>
nnoremap <leader>sd :DeleteSession<CR>
nnoremap <leader>sc :CloseSession<CR>
"" Tabs
" nnoremap <Tab> gt
" nnoremap <S-Tab> gT
nnoremap <silent> <S-t> :tabnew<CR>
"" Buffer nav
noremap <leader>q :bp<CR>
noremap <leader>w :bn<CR>
"" Close buffer
noremap <leader>c :bd<CR>
"" For quickfix and loc list
noremap <leader>lo :cw<CR>
noremap <leader>lc :cclose<CR>
noremap <leader>cl :lclose<CR>
"" Clean search (highlight)
nnoremap <silent> <leader><space> :noh<cr>
"" Switching windows
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
noremap <C-h> <C-w>h
"" Set working directory
nnoremap <leader>. :lcd %:p:h<CR>
"" Opens an edit command with the path of the currently edited file filled in
noremap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
"" Opens a tab edit command with the path of the currently edited file filled
noremap <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
"" Easy clipboard cut, copy, paste
noremap YY "+y<CR>
noremap <leader>p "+gP<CR>
noremap XX "+x<CR>
" Paste toggle for indent or non-indent auto while pasting
" set pastetoggle=<F5>
"" Vmap for maintain Visual Mode after shifting > and <
vmap < <gv
vmap > >gv
"" Move visual block
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
"" FZF shortcuts
cnoremap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>e :FZF -m<CR>
nnoremap <silent> <C-p> :FZF -m<CR>
nnoremap <leader>o :History<CR>
noremap <leader>zz :FZF<Space>
noremap <leader>zw :Windows<Enter>
noremap <leader>zh :History
noremap <leader>zo :Colors<Enter>
noremap <leader>zs :Snippets<Enter>
noremap <leader>zc :Commands<Enter>
" noremap <leader>zl :Locate<Space>
" noremap <leader>zt :Tags<Space>
noremap <leader>zb :Buffers<Enter>
noremap <leader>za :AirlineTheme<Space>
"" Prettify Haskell using tabularize
vmap a= :Tabularize /=<CR>
vmap a; :Tabularize /::<CR>
vmap a- :Tabularize /-><CR>
" vmap a" :Tabularize /^."\{-}<CR>
" deoplete tab-complete which works
inoremap <silent><expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <silent><expr> <S-tab> pumvisible() ? "\<c-p>" : "\<S-tab>"
" Pandoc keybindings
noremap <leader>toc :TOC<CR>