-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmappings.vim
169 lines (133 loc) · 3.58 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
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
" Basic Key Mappings
" Leader Key
let mapleader = " "
" Navigation
autocmd VimEnter * nnoremap <silent> J 5j
autocmd VimEnter * nnoremap <silent> K 5k
autocmd VimEnter * nnoremap <silent> L w
autocmd VimEnter * nnoremap <silent> H b
nnoremap <C-e> $
nnoremap <C-a> 0
vnoremap <C-e> $
vnoremap <C-a> 0
inoremap <C-e> <C-o>$
inoremap <C-a> <C-o>0
noremap = n
noremap - N
noremap <LEADER><CR> :nohlsearch<CR>
noremap <C-c> <Esc>
" Save, Quit, and Reload
map s <nop>
nnoremap S :w<CR>
nnoremap Q :q<CR>
map R :source $MYVIMRC<CR>
" Move lines around
nnoremap <S-Up> :m-2<CR>
nnoremap <S-Down> :m+<CR>
inoremap <S-Up> <Esc>:m-2<CR>
inoremap <S-Down> <Esc>:m+<CR>
" Increment && Decrement
noremap + <C-a>
noremap _ <C-x>
" Spell Check
map sc :set spell!<CR>
" Figlet
map fg :r !figlet
" Folding
" noremap <C-o> za
" Use <space> =- to change tab
map tt :tabe<CR>
map <LEADER>- :-tabnext<CR>
map <LEADER>= :tabnext<CR>
" TAB in general mode will move to text buffer
nnoremap <TAB> :bnext<CR>
" SHIFT-TAB will go back
nnoremap <S-TAB> :bprevious<CR>
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" Use > or < to indent or unindent in visual line mode
vnoremap <S-TAB> <gv
vnoremap <TAB> >gv
" Use <TAB> to indent or unindent in normal mode
" nnoremap <TAB> >>
" nnoremap <S-TAB> <<
" Use TAB to indent and Shift-TAB to undent in insert mode
inoremap <TAB> <C-t>
inoremap <S-TAB> <C-d>
" Insert mode binding
inoremap jj <esc>:w<CR>
inoremap <C-o> <esc>o
inoremap vv <esc>:bv
" split window
map sr :set splitright<CR>:vsplit<CR>
map sl :set nosplitright<CR>:vsplit<CR>
map su :set nosplitbelow<CR>:split<CR>
map sb :set splitbelow<CR>:split<CR>
" change split direction
map sh <C-w>t<C-w>H
map sv <C-w>t<C-w>K
" Use <space> + hjkl to move focus on split window
map <LEADER>h <C-w>h
map <LEADER>j <C-w>j
map <LEADER>k <C-w>k
map <LEADER>l <C-w>l
" Use <space> + arrow key to resize windows
map <LEADER><up> :res+5<CR>
map <LEADER><down> :res-5<CR>
map <LEADER><left> :vertical resize-5<CR>
map <LEADER><right> :vertical resize+5<CR>
"Commenter
autocmd VimEnter * noremap <LEADER>/ :call NERDComment(0,"toggle")<CR>
" ===
" === Useful Tools
" ===
" Opening a terminal window
" noremap <LEADER>, :set splitbelow<CR>:split<CR>:res +5<CR>:term<CR>
noremap <LEADER>, :tabe<CR>:term<CR>
tnoremap <Esc> <C-\><C-n>
" Spelling Check with <space>sc
noremap <LEADER>sc :set spell!<CR>
" Find and Replace
vnoremap \s :s//g<left><left>
nnoremap \s :%s//g<left><left>
" Wrap
noremap <LEADER>sw :set wrap<CR>
" Clipboard
nnoremap <C-p> "+gp
nnoremap <C-c> "+yy
vnoremap <C-c> "+y
" ===========================
" === Plugins Key Binding ===
" ===========================
" === Ranger
" nmap ff :RnvimrToggle<CR>
nmap <LEADER>r :RnvimrToggle<CR>
" === NERD Tree
autocmd VimEnter * nnoremap <silent> <C-N> :NERDTreeToggle<CR>
" === Tabular
vmap tb :Tabularize /
" === UndoTree
noremap <LEADER>u :UndotreeToggle<CR>
" === Floaterm
" Terminal mode binding
tnoremap <silent> Q <C-\><C-N>:q<CR>
" Floaterm binding
nnoremap <silent> <LEADER>T :FloatermToggle<CR>
tnoremap <silent> X <C-\><C-n>:FloatermToggle<CR>
nnoremap <silent> <C-x> :FloatermToggle<CR>
tnoremap <silent> <C-x> <C-\><C-n>:FloatermToggle<CR>
" === Minimap
nnoremap <silent> <LEADER>m :MinimapToggle<CR>
" === LeaderF
noremap ff :Leaderf file<CR>
noremap fs :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR>
noremap fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR>
" === Lazygit
noremap <C-g> :tabe<CR>:term lazygit<CR>
" === FZF
" nnoremap ff :Files<CR>
" nnoremap fs :Lines<CR>
" === Asyncrun
" Python
" noremap <C-p> :AsyncRun -raw python %<CR>
" Golang