-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
231 lines (178 loc) · 6.61 KB
/
Copy pathvimrc
File metadata and controls
231 lines (178 loc) · 6.61 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
"autocmd VimEnter * NERDTree
"autocmd BufEnter * NERDTreeMirror
"autocmd VimEnter * wincmd w
set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=
"Tab settings {{{
set tabstop=4
set smartindent
set shiftwidth=4
set expandtab
"}}}
set nocompatible
"Syntax{{{
syntax on
"}}}
"Line numbers {{{
set number
"}}}
" Colour schemes {{{
" set background=dark
" colorscheme solarized
" colorscheme mayansmoke
" colorscheme badwolf
colorscheme mayansmoke
" }}}
let g:solarized_termcolors=256
" Setup Bundle Support {{{
" The next two lines ensure that the ~/.vim/bundle/ system works
" filetype off
runtime! autoload/pathogen.vim
silent! call pathogen#helptags()
silent! call pathogen#runtime_append_all_bundles()
" }}}
if has('statusline') " {{{
set laststatus=2
" Broken down into easily includeable segments
"set statusline=\ [%{getcwd()}] " current dir
set statusline=%<%f\ " Filename
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=\ %w%h%m%r\ " Options
"set statusline+=\ [A=\%03.3b/H=\%02.2B] " ASCII / Hexadecimal value of char
"set statusline+=%=%-14.(%{WordCount()}\ %l,%c%V%)\ %p%% " Right aligned file nav info
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif " }}}
au BufNewFile,BufRead *.less set filetype=less " less syntax
au BufNewFile,BufRead *.tpl set filetype=smarty.html " smarty syntax
au BufNewFile,BufRead *.coffee set filetype=coffee " coffee syntax
au BufNewFile,BufRead *.styl set filetype=stylus " stylus syntax
au BufNewFile,BufRead gitconfig set filetype=gitconfig " gitconfig syntax
let g:tex_flavor='latex' " use latex styles
" VIM UI {{{
set ruler " always display cursor position
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids
set backspace=indent,eol,start " backspace for dummys
set incsearch " search as type
set hlsearch " highlight search terms
set ignorecase smartcase " ignore case except explicit UC
"}}}
" Spelling {{{
" set spell " enable spell check
" au BufRead *.use,*.conf,*.cfg,*/conf.d/*,*.log,.vimrc set nospell
" au Filetype c,css,html,javascript,php,tex,text,mkd,wiki,vimwiki setlocal spell
" au BufNewFile,BufRead COMMIT_EDITMSG setlocal spell " git commit messages
" au Filetype help setlocal nospell
" au StdinReadPost * setlocal nospell " but not in man
" set spelllang=en_gb " spell check language to GB
" set dictionary+=/usr/share/dict/words " add standard words
" }}}
"Plugin configuration {{{
" Maps auto-completion to <Tab>, else inputs Tab. {{{
function! SuperCleverTab()
if strpart(getline("."), 0, col(".")-1) =~ '^\s*$\|^.*\s$\|^.*[,;)}\]]$'
return "\<Tab>"
else
if &omnifunc != ''
return "\<C-X>\<C-O>"
else
return "\<C-N>"
endir
endif
endfunction
" inoremap <Tab> <C-R>=SuperCleverTab()<cr>
" }}}
" NerdTree {{{
map <C-e> :NERDTreeToggle<CR>:NERDTreeMirror<CR>
map <leader>e :NERDTreeFind<CR>
nmap <leader>nt :NERDTreeFind<CR>
let NERDTreeShowBookmarks=1
"let NERDTreeIgnore=['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr']
let NERDTreeIgnore=['\.swp$', '\.pyc','__init__.*']
let NERDTreeChDirMode=1
"let NERDTreeQuitOnOpen=1
let NERDTreeShowHidden=1
let NERDTreeKeepTreeInNewTab=1
let NERDTreeWinSize=30
" autocmd VimEnter * NERDTree
" autocmd BufEnter * NERDTreeMirror
let g:NERDTreeDirArrows=0
map <leader>r :NERDTreeFind<cr>
" set autochdir
" autocmd BufEnter * silent :cd! %:p:h
filetype plugin on
" autocmd BufEnter * if bufname("") !~"^\[A-Za-z0-9\]*://" | lcd%:p:h | endif
" }}}
" Gundo {{{
nnoremap <F5> :GundoToggle<CR>
let g:gundo_right = 1
" }}}
" MiniBufExplorer {{{
"map <leader>b :MiniBufExplorer<CR>
map <leader>b :MBEOpen<CR>
"map <leader>c :CMiniBufExplorer<CR>
"map <leader>u :UMiniBufExplorer<CR>
map <leader>, :MBEbp<CR>
map <leader>. :MBEbn<CR>
map <C-x> :MBEbd <CR>
"map <leader>t :TMiniBufExplorer<CR>
map <leader>t :MBEToggle<CR>
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplUseSingleClick = 1
" }}}
" Fugitive {{{
nnoremap <leader>gs :Gstatus<CR>
nnoremap <leader>gc :Gcommit<CR>
" }}}
" Ctrlp {{{
" nnoremap <leader>t :CtrlP<CR>
" nnoremap <leader><space> :CtrlPBuffer<CR>
" let g:ctrlp_working_path_mode = 2
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.un~,*/node_modules/* " Linux/MacOSX
" }}}
"No highlighting {{{
nnoremap <silent> <C-l> :nohl<CR><C-l>
"}}}
" C++ Highlighting{{{
" " Hotkey to generate tags for you current project
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
"}}}
"Copy pasting mapping{{{
nmap <C-V> "+gP
imap <C-V> <ESC><C-V>i
vmap <C-C> "+y
"}}}
" autocmd BufEnter * :cd! %:p:h
"{{{
set guifont=Monospace\ 9
"}}}
"
au BufRead,BufNewFile *.svh set filetype=verilog_systemverilog
" OpenCL
au BufRead,BufNewFile *.cl set filetype=opencl
let g:loaded_golden_ratio = 0
let g:top_level = getcwd()
function! UpdateTopDir()
let g:top_level = getcwd()
endfunction
set tags+=.tags
comm! -nargs=? -bang UP call UpdateTopDir()
let g:alternateSearchPath = 'sfr:source,sfr:src,sfr:include'
function! GotoDefinition()
let n = search("\\<".expand("<cword>")."\\>[^(]*([^)]*)\\s*\\n*\\s*{")
endfunction
map <F4> :call GotoDefinition()<CR>
imap <F4> <c-o>:call GotoDefinition()<CR>
function! UpdateTags()
!ctags --links=no -f .tags -R *
endfunction
function! UpdateScope()
!cscope -f ./cscope.out -R
endfunction
comm! -nargs=? -bang UPT call UpdateTags()
comm! -nargs=? -bang UPC call UpdateScope()
au! BufRead,BufNewFile *.json set filetype=json
set mouse=a
nmap <C-k> <leader>rj
" }}}