-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
145 lines (122 loc) · 3.78 KB
/
vimrc
File metadata and controls
145 lines (122 loc) · 3.78 KB
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
" Autoload package bundles
source ~/.vim/bundle/pathogen/autoload/pathogen.vim
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
set nocompatible
colorscheme vividchalk
let mapleader = ","
set hidden
set guioptions-=T
set tabstop=4
set shiftwidth=4
set expandtab
set nu
filetype on
filetype plugin on
filetype indent on
" autocmd VimEnter * nested TagbarOpen
let g:pyflakes_use_quickfix=0
let g:tagbar_left = 1
" Put VIM swap files in one place
set directory=/tmp/vimswap
" Convince Vim it can use 256 colors inside Gnome Terminal.
" Needs CSApprox plugin
set t_Co=256
let mapleader = ","
nmap <silent><Leader>/ :nohlsearch<CR>
nmap <silent><Leader>ve :e ~/.vimrc<CR>
nmap <silent><Leader>vs :so ~/.vimrc<CR>
set showmatch
syntax on
set hlsearch
set nowrap
set wrapmargin=0
set textwidth=0
set noswapfile
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" cscope
if has("cscope")
set csto=0
set cscopetag " search cscope for tags
set nocsverb
set cscopequickfix=s-,c-,d-,i-,t-,e-
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
endif
" Ctags configuration
set tags=./tags;/
set tags+=/~/source/qa/tlib/tags
set tags+=/~/source/qa/tests/tags
set tags+=/usr/local/lib/python2.6/tags
" Comment out blocks of code
function! CommentBlock(comment)
if getline(".") =~ '^'.a:comment.'\~'
call setline(".", substitute(getline("."), "^".a:comment.'\~ ', "", ""))
else
call setline(".", substitute(getline("."), "^", a:comment."~ ", ""))
endif
endfunction
" omnicomplete with tab
function! SuperCleverTab()
if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
return "\<Tab>"
else
if &omnifunc != ''
return "\<C-X>\<C-O>"
elseif &dictionary != ''
return "\<C-K>"
else
return "\<C-N>"
endif
endif
endfunction
inoremap <Tab> <C-R>=SuperCleverTab()<CR>
autocmd FileType python map <Leader># :call CommentBlock('#')<CR>
autocmd FileType vim map <Leader>" :call CommentBlock('"')<CR>
" Shortcuts
noremap <Leader>gg :silent Ggrep <cword><CR>:copen<CR>
noremap <Leader>ga :copen<CR>:grep! -nR
noremap <Leader>gG :copen<CR>:Ggrep
noremap <Leader>gb :Gblame<CR>
noremap <Leader>gd :Gdiff<CR>
noremap <Leader>vl :e ~/.vim/vimrc<CR>
noremap <Leader>vs :w<CR>:so %<CR>
noremap <Leader>b :CommandTBuffer<CR>
noremap <C-Tab> <C-W><C-W>
noremap <S-C-Tab> <C-W>W
noremap <S-C-F4> :bufdo BD<CR>
noremap <C-F4> :BD<CR>
noremap <Leader>/ :nohl<CR>
noremap <silent> <F4> :copen<CR>:cnext<CR>
noremap <silent> <S-F4> :copen<CR>:cprev<CR>
inoremap <C-Space> <C-N>
" Autocompletion
inoremap <C-Space> <C-N>
" Status bar
set laststatus=2 " Enables the status line at the bottom of Vim
set statusline=\ %F\ %m\ %{fugitive#statusline()}\ %=%l,%c\
" autocmd VimLeavePre * mksession! ~/.vim.sess
set wildchar=<Tab> wildmenu wildmode=longest:full
command! LargeFont set guifont=Monospace\ 16
command! SmallFont set guifont=Monospace\ 10