-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc.min
199 lines (163 loc) · 3.92 KB
/
.vimrc.min
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
" vim:set nospell:
filetype off
filetype plugin indent off
runtime! ftplugin/man.vim
"============file setting======================
set fileencoding=utf-8
set encoding=utf-8
scriptencoding utf-8
set nocompatible
set nobackup
set noswapfile
set autoread
set hidden
set showcmd
set backspace=indent,eol,start
set modeline
set modelines=5
"=============key mapping=======================
set statusline=%{expand('%:p:t')}\ %<[%{expand('%:p:h')}]%=\ %m%r%y%w[%{&fenc!=''?&fenc:&enc}][%{&ff}][%3l,%3c,%3p]
nnoremap s <Nop>
"move among panes
nnoremap sj <C-w>j
nnoremap sk <C-w>k
nnoremap sl <C-w>l
nnoremap sh <C-w>h
nnoremap sr <C-w>w
" move the pane position
nnoremap sJ <C-w>J
nnoremap sK <C-w>K
nnoremap sL <C-w>L
nnoremap sH <C-w>H
nnoremap sR <C-w>r
"
nnoremap s= <C-w>=
nnoremap s_ <C-w>_
nnoremap s\| <C-w>\|
nnoremap sa <C-w>_<C-w>\|
" split the pane
nnoremap ss :<C-u>sp<CR>
nnoremap sv :<C-u>vs<CR>
nnoremap sq :<C-u>q<CR>
" tab handling
nnoremap st :<C-u>tabnew<CR>
nnoremap sT <C-w>T
nnoremap sn gt
nnoremap sp gT
nnoremap tn :<C-u>tabnew<CR>
nnoremap tl gt
nnoremap th gT
" exchange line movement commands
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
" multi line paste
vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]
" swap ; and :
nnoremap ; :
nnoremap : ;
vnoremap ; :
vnoremap : ;
inoremap jk <ESC>
" discard yank got with x(s)
nnoremap x "_x
nnoremap s "_s
" delete highlight with double <ESC> or Ctrl-l
nnoremap <silent> <ESC><ESC> :nohl<CR>
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
" highlight the word under cursor with double space
nnoremap <silent> HH "zyiw:let @/ = '\<' . @z . '\>'<CR>:set hlsearch<CR>
"emacs keybinds for command
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
cnoremap <C-b> <Left>
cnoremap <C-f> <Right>
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
cnoremap <C-d> <Del>
inoremap <C-k> <Up>
inoremap <C-j> <Down>
inoremap <C-b> <Esc>bi
inoremap <C-f> <Esc>ewi
inoremap <C-a> <Home>
inoremap <C-e> <End>
inoremap <C-d> <Del>
"line join
vnoremap J <Nop>
vnoremap <C-j> :join<CR>
nnoremap <space>h :Gtags -f %<CR>
nnoremap <space>j :GtagsCursor<CR>
nnoremap <space>d :<C-u>exe('Gtags '.expand('<cword>'))<CR>
nnoremap <space>r :<C-u>exe('Gtags -r '.expand('<cword>'))<CR>
nnoremap <space>n :cn<CR>
nnoremap <space>p :cp<CR>
nnoremap <space>o <C-o>
if has('terminal') || has('nvim')
tnoremap <silent> <ESC> <C-\><C-n>
tnoremap jj <C-\><C-n>
tnoremap jk <C-\><C-n>
if has('nvim')
autocmd TermOpen * setlocal nonumber
autocmd TermOpen * setlocal nospell
autocmd TermOpen * startinsert
elseif v:version > 810
autocmd TerminalOpen * set nonumber
autocmd TerminalOpen * set nospell
endif
endif
"=============edit setting=====================
set tabstop=2
set expandtab
set smartindent
set shiftwidth=2
set autoindent
"=============view setting=====================
syntax on
set title
set number
set ruler
"set cursorline
"set cursorcolumn
set virtualedit=block
set showmatch
set matchtime=1
set cmdheight=2
set wildmode=list:longest
set wildchar=<Tab>
set spell
autocmd FileType man set nospell
autocmd FileType c nnoremap FM :<C-u>ClangFormat<CR>:w<CR>
autocmd FileType cpp nnoremap FM :<C-u>ClangFormat<CR>:w<CR>
autocmd FileType go nnoremap FM :<C-u>GoFmt<CR>:w<CR>
set spelllang=en
if (v:version == 704 && has("patch88")) || v:version >= 705
set spelllang+=cjk
endif
set list
set listchars=eol:↲
set listchars=eol:$
set listchars+=tab:>-,trail:~,extends:>,precedes:<,space:.
set scrolloff=4
"====fold setting==============================
"set foldmethod=syntax
"====search setting============================
set hlsearch
set incsearch
set ignorecase
set smartcase
set wrapscan
set clipboard&
set clipboard^=unnamedplus
set mouse=a
"=============utility==========================
"{{{
command! InsertModeLine call s:insertModeLine()
function! s:insertModeLine()
put ='vim: set ft=' . &ft . ' :'
endfunction
"}}}
filetype on
filetype plugin indent on