-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
174 lines (142 loc) · 4.45 KB
/
Copy pathvimrc
File metadata and controls
174 lines (142 loc) · 4.45 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
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
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Other Plugins
Plugin 'vim-scripts/DoxygenToolkit.vim'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-abolish'
Plugin 'tpope/vim-fugitive'
Plugin 'majutsushi/tagbar'
Plugin 'ericcurtin/CurtineIncSw.vim'
Plugin 'lyuts/vim-rtags'
"Launch vim and run :PluginInstall
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
syntax on
let g:load_doxygen_syntax=1
set cinoptions+=(0
set background=dark
set cindent
set confirm "confirms leaving a buffer
set diffopt+=iwhite
set expandtab
set hlsearch
set incsearch
set ignorecase smartcase " Case insensitive searches, unless it's mixed-case
set lazyredraw "< No redraw when executing macros
"set mouse=a
set nowrap
set ruler
set pastetoggle=<F9>
set showmatch " display the matching (, {, or [
set smartindent
set sw=2
set tabstop=8
set softtabstop=2
set backspace=indent,eol,start
set vb t_vb= "< Screen flash instead of beeps
"set virtualedit=all "< Free cursor
set wildmode=longest:list,full
set wildmenu
" My shortcuts
let mapleader=","
nmap <silent> <leader>w :w <CR>
" mapping for cycling through tabs
map <F2> :tabp<cr>
map <F3> :tabn<cr>
" Replaced by plugin
" mapping for switching between *.h and *.cpp
"map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
map <F4> :call CurtineIncSw()<CR>
" mapping for turning on spell check
map <F5> <Esc>:setlocal spell! spelllang=en_us<CR>
" mapping for adding beginning and end of function comments
" Note: this will not work for C-style functions(Functions must have namespace)
map <F7> :Dox<return>
map <F8> 0%?::.*(by3w/{%A /* End pA() */:w
function! FindMakefile()
let dir = getcwd()
while ! filereadable(dir . '/Makefile') && dir != ''
let dir = substitute(dir, '/[^/]*$', '', '')
return dir
endfunction
function! MyMake()
let makeLoc = FindMakefile()
:make
endfunction
map <F9> :w \| make -j8<CR>
"map <F9> :call MyMake()<CR>
map <F12> :e ~/.notes<CR>
map <C-F12> :e ~/LabDayTopics<CR>
map <C-K> :cp<CR>
map <C-J> :cn<CR>
"Allow switching between files without saving
set hidden
set undofile
set undodir=$HOME/.vim/undodir
"Press Space to turn off highlighting and clear any message already displayed.
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" Allows writing to files with root priviledges
cmap w!! w !sudo tee % > /dev/null
" Use ack for searching
set grepprg=ack\ --cpp
" Xml formatting
au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null
" rtags
let g:rtagsUseLocationList = 0
let g:rtagsJumpStackMaxSize = 0
" ctags!
let dir = getcwd()
while ! filereadable(dir . '/tags') && dir != ''
let dir = substitute(dir, '/[^/]*$', '', '')
endwhile
nnoremap <silent> <Leader>b :TagbarToggle<CR>
"g:ctags_statusline=1
"g:ctags_regenerate=0
if filereadable(dir . '/tags')
let &tags = dir . '/tags'
endif
" cscope!
let dir = getcwd()
while ! filereadable(dir . '/cscope.out') && dir != ''
let dir = substitute(dir, '/[^/]*$', '', '')
endwhile
"" Omnicompletion
"set nocp
"filetype plugin indent on
set ofu=syntaxcomplete#Complete
"autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Use the current directory
autocmd BufEnter * if expand("%:p:h") !~ '^/tmp' | silent! lcd %:p:h | endif
" Add highlighting for function definition in C++
function! EnhanceCppSyntax()
syn match cppFuncDef "::\~\?\zs\h\w*\ze([^)]*\()\s*\(const\)\?\)\?$"
hi def link cppFuncDef Special
endfunction
autocmd Syntax cpp call EnhanceCppSyntax()
" Highlight misspelled words in silver
hi SpellBad ctermbg=7
" Highlighting after column 80
"if exists('+colorcolumn')
" set colorcolumn=80
"else
" au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
" endif
command! -complete=file -nargs=* Svn call s:ExecuteInShell('svn '.<q-args>, '<bang>')
command! -complete=shellcmd -nargs=* -bang Shell call s:ExecuteInShell(<q-args>, '<bang>')
cabbrev shell Shell
" Spelling?
" syn match AcronymNoSpell '\<\(\u\|\d\)\{3,}s\?\>' contains=@NoSpell
syn match UrlNoSpell '\w\+:\/\/[^[:space:]]\+' contains=@NoSpell
syn match CapitalWordsNoSpell +\<\w*[A-Z]\K*\>+ contains=@NoSpell