-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
103 lines (90 loc) · 2.16 KB
/
.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
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
set runtimepath^=~/.vim
let &packpath = &runtimepath
let mapleader=" "
set backupdir=.backup/,~/.backup/,/tmp//
set directory=.swp/,~/.swp/,/tmp//
set undodir=.undo/,~/.undo/,/tmp//
syntax on
filetype on
filetype indent on
filetype plugin on
set cursorline
set noerrorbells
set vb t_vb=
set belloff=all
set number
set tabstop=4
set expandtab
set shiftwidth=4
set softtabstop=4
set scrolloff=900
set scroll=4
set nocursorline
"set cursorcolumn
set autoindent
set smarttab
set incsearch
set showmatch
set nohlsearch
set matchtime=5
set nowrap
set ignorecase
set nobackup
set updatetime=50
set undofile
colorscheme torte
highlight Normal ctermbg=256
"encoding
set encoding=UTF-8
set fileencodings=ucs-bom,utf-8,utf-16,gbk,big5,bg18030,latin1
set backspace=indent,eol,start
" key bindings
" copy to system clipboard via <Ctrl-c> in visual mode.
vnoremap <C-c> "+y
" select all
nnoremap <C-a> ggVG
" close window
nnoremap <C-q> :q<CR>
" save file
nnoremap <C-s> :wa<CR>
" fix jump list
nnoremap <expr> k (v:count > 5 ? "m'" . v:count : "") . 'k'
nnoremap <expr> j (v:count > 5 ? "m'" . v:count : "") . 'j'
" line moving dark-art
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
" fix visual mode
vmap $ g_
" window switching
nnoremap <C-j> <C-w>j
nnoremap <C-h> <C-w>h
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" split window vertically
nnoremap <silent> <C-\> :vsplit<CR><C-w>l
nnoremap <silent> <C-w>s :split<CR><C-w>j
" file manager
nmap <C-b> :Sex!<CR><C-w>l<C-q>
" augroup InitNetrw
" autocmd!
" autocmd VimEnter * :silent! Explore
" augroup END
" brackets
function! ConditionalPairMap(open, close)
let line = getline('.')
let col = col('.')
if col < col('$') || stridx(line, a:close, col + 1) != -1
return a:open
else
return a:open . a:close . repeat("\<left>", len(a:close))
endif
endf
inoremap <expr> ( ConditionalPairMap('(', ')')
inoremap <expr> { ConditionalPairMap('{', '}')
inoremap <expr> [ ConditionalPairMap('[', ']')
inoremap <expr> ` ConditionalPairMap('`', '`')
inoremap <expr> ' ConditionalPairMap('''', '''')
inoremap <expr> " ConditionalPairMap('"', '"')
inoremap <expr> $ ConditionalPairMap('$', '$')
map <C-f> <Nop>
nmap <C-f> ggVG=<C-o><C-o>