-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
182 lines (154 loc) · 6.05 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
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
" Vim config file.
" Global Settings: {{{
call pathogen#infect() " use pathogen to manage plugins
syntax on " highlight syntax
filetype plugin indent on " auto detect file type
set nocompatible " out of Vi compatible mode
set number " show line number
set numberwidth=3 " minimal culumns for line numbers
set textwidth=0 " do not wrap words (insert)
set nowrap " do not wrap words (view)
set showcmd " show (partial) command in status line
set ruler " line and column number of the cursor position
set wildmenu " enhanced command completion
set wildmode=list:longest,full " command completion mode
set laststatus=2 " always show the status line
set mouse=a " use mouse in all mode
set foldenable " fold lines
set foldmethod=marker " fold as marker
set noerrorbells " do not use error bell
set novisualbell " do not use visual bell
set t_vb= " do not use terminal bell
set wildignore=.svn,.git,*.swp,*.bak,*~,*.o,*.a
set autowrite " auto save before commands like :next and :make
set hidden " enable multiple modified buffers
set history=100 " record recent used command history
set autoread " auto read file that has been changed on disk
set backspace=indent,eol,start " backspace can delete everything
set completeopt=menuone,longest " complete options (insert)
set pumheight=10 " complete popup height
set scrolloff=5 " minimal number of screen lines to keep beyond the cursor
set autoindent " automatically indent new line
set cinoptions=:0,l1,g0,t0,(0,(s " C kind language indent options
set tabstop=4 " number of spaces in a tab
set softtabstop=4 " insert and delete space of <tab>
set shiftwidth=4 " number of spaces for indent
set expandtab " expand tabs into spaces
set incsearch " incremental search
set hlsearch " highlight search match
set ignorecase " do case insensitive matching
set smartcase " do not ignore if search pattern has CAPS
set nobackup " do not create backup file
set noswapfile " do not create swap file
set backupcopy=yes " overwrite the original file
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=gb2312,utf-8,gbk
set fileformat=unix
set background=dark
colorscheme vividchalk
" gui settings
if has("gui_running")
set guioptions-=T " no toolbar
set guioptions-=r " no right-hand scrollbar
set guioptions-=R " no right-hand vertically scrollbar
set guioptions-=l " no left-hand scrollbar
set guioptions-=L " no left-hand vertically scrollbar
autocmd GUIEnter * simalt ~x " window width and height
source $VIMRUNTIME/delmenu.vim " the original menubar has an error on win32, so
source $VIMRUNTIME/menu.vim " use this menubar
language messages zh_CN.utf-8 " use chinese messages if has
endif
" Restore the last quit position when open file.
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
"}}}
" Key Bindings: {{{
let mapleader = ","
let maplocalleader = "\\"
" map : -> <space>
map <Space> :
" move between windows
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
" Don't use Ex mode, use Q for formatting
map Q gq
"make Y consistent with C and D
nnoremap Y y$
" toggle highlight trailing whitespace
nmap <silent> <leader>l :set nolist!<CR>
" Ctrol-E to switch between 2 last buffers
nmap <C-E> :b#<CR>
" ,e to fast finding files. just type beginning of a name and hit TAB
nmap <leader>e :e **/
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
" ,n to get the next location (compilation errors, grep etc)
nmap <leader>n :cn<CR>
nmap <leader>p :cp<CR>
" Ctrl-N to disable search match highlight
nmap <silent> <C-N> :silent noh<CR>
" center display after searching
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#z
"}}}
" Plugin Settings: {{{
if has("win32") " win32 system
let $HOME = $VIM
let $VIMFILES = $HOME . "/vimfiles"
else " unix
let $HOME = $HOME
let $VIMFILES = $HOME . "/.vim"
endif
" mru
let MRU_Window_Height = 10
nmap <Leader>r :MRU<cr>
" taglist
let g:Tlist_WinWidth = 25
let g:Tlist_Use_Right_Window = 0
let g:Tlist_Auto_Update = 1
let g:Tlist_Process_File_Always = 1
let g:Tlist_Exit_OnlyWindow = 1
let g:Tlist_Show_One_File = 1
let g:Tlist_Enable_Fold_Column = 0
let g:Tlist_Auto_Highlight_Tag = 1
let g:Tlist_GainFocus_On_ToggleOpen = 1
nmap <Leader>t :TlistToggle<cr>
" nerdtree
let g:NERDTreeWinPos = "right"
let g:NERDTreeWinSize = 30
let g:NERDTreeShowLineNumbers = 1
let g:NERDTreeQuitOnOpen = 1
nmap <Leader>f :NERDTreeToggle<CR>
nmap <Leader>F :NERDTreeFind<CR>
" snipMate
let g:snip_author = "Jeffy Du"
let g:snip_mail = "jeffy.du@163.com"
let g:snip_company = "SIC Microelectronics CO. Ltd"
" man.vim - view man page in VIM
source $VIMRUNTIME/ftplugin/man.vim
" cscope
nmap <leader>ss :cs find s <C-R>=expand("<cword>")<cr><cr>
nmap <leader>sg :cs find g <C-R>=expand("<cword>")<cr><cr>
nmap <leader>sc :cs find c <C-R>=expand("<cword>")<cr><cr>
nmap <leader>st :cs find t <C-R>=expand("<cword>")<cr><cr>
nmap <leader>se :cs find e <C-R>=expand("<cword>")<cr><cr>
nmap <leader>sf :cs find f <C-R>=expand("<cfile>")<cr><cr>
nmap <leader>si :cs find i <C-R>=expand("<cfile>")<cr><cr>
nmap <leader>sd :cs find d <C-R>=expand("<cword>")<cr><cr>
" vimgdb.vim
if has("gdb")
set asm=0
let g:vimgdb_debug_file=""
run macros/gdb_mappings.vim
endif