-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmini_vimrc
62 lines (52 loc) · 1.35 KB
/
mini_vimrc
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
" ################## custom conf begin ###############
" 1. set section
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set mouse=a
set incsearch
set number
set background=dark
set scrolloff=6
set noignorecase
" 2. indent & tab
autocmd BufNewFile,BufRead * setlocal formatoptions-=ro " why must BufNewFile ...
set smartindent
set smarttab
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
autocmd Filetype c,cpp set cindent
syntax enable
syntax on
" color, theme
colorscheme desert
set hlsearch
highlight Search ctermbg=Blue ctermfg=White
" view
" go last open line
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" mute warning when file changed
autocmd FileChangedShell * echo ""
" 3. key map section
nnoremap <c-h> <esc><c-w>h
nnoremap <c-j> <esc><c-w>j
nnoremap <c-k> <esc><c-w>k
nnoremap <c-l> <esc><c-w>l
inoremap <c-h> <esc><c-w>h
inoremap <c-j> <esc><c-w>j
inoremap <c-k> <esc><c-w>k
inoremap <c-l> <esc><c-w>l
noremap j gjzz
noremap k gkzz
nnoremap <space> :q<cr>
nnoremap ,v :sp<space>~/.vimrc<cr>
" search
nnoremap <silent> <esc> :nohlsearch<cr><esc>
nnoremap <silent> <esc>^[ <esc>^[
" edit
inoremap {<cr> {<cr>}<esc>O
" reload vimrc once it's edited
autocmd! bufwritepost .vimrc source ~/.vimrc
" ################## custom conf end ###############