forked from dilawar/vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
250 lines (203 loc) · 6.87 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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-surround'
Bundle 'bling/vim-airline'
Bundle 'vim-scripts/a.vim'
Bundle 'vim-scripts/DrawIt'
Bundle 'vim-scripts/DoxygenToolkit.vim'
Bundle 'vim-scripts/check-mutt-attachments.vim'
Bundle 'ervandew/supertab'
Plugin 'SirVer/ultisnips'
Plugin 'dilawar/vim-snippets'
" Following three goes together
Bundle 'tomtom/tlib_vim'
Bundle 'MarcWeber/vim-addon-mw-utils'
"Bundle "garbas/vim-snipmate"
Bundle "lukerandall/haskellmode-vim"
Bundle "LaTex-Box-Team/LaTeX-Box"
Bundle 'easymotion/vim-easymotion'
Bundle "danchoi/elinks.vim"
Bundle 'scrooloose/nerdcommenter'
Bundle "tpope/vim-commentary"
Bundle 'tpope/vim-fugitive'
Bundle "junegunn/vim-easy-align"
"Bundle 'scrooloose/syntastic'
"Bundle 'scrooloose/nerdtree'
Bundle 'kien/ctrlp.vim'
Bundle 'mattn/gist-vim'
Bundle "chrisbra/csv.vim"
Bundle "JuliaLang/julia-vim"
"Bundle 'Valloric/YouCompleteMe'
filetype plugin indent on
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set smartcase " Do smart case matching
set incsearch " Incremental search
set mouse=v " Enable mouse usage (all modes)
set number
set ruler
set hlsearch
set autoindent
set smartindent
set nospell
set encoding=utf-8
"set spell spelllang=en
"" This option crashed vim in gentoo
" set dictionary+=/usr/share/dict/words
" no dictionary autocomplete.
set complete-=k
syntax enable
" c-support
set makeprg=make
if filereadable("build_me.sh")
set makeprg=./build_me.sh
endif
set wildmode=longest,list
let g:C_UseTool_cmake = 'yes'
let g:C_UseTool_doxygen = 'yes'
" Mappings
source $HOME/.vim/mymappings.vim
" Supertab
"" Section for literate programming.
au BufNewFile *.nw read ~/Scripts/template.snw
au BufRead,BufNewFile *.nw set filetype=noweb
au BufRead,BufNewFile *.snw set filetype=noweb
au BufRead,BufNewFile *.w set filetype=noweb
au BufRead,BufNewFile *.nw set spell spelllang=en
au BufRead,BufNewFile *.blog set filetype=markdown
au BufRead,BufNewFile *.markdown set filetype=markdown
au BufRead,BufNewFile *.csv set filetype=csv
au BufRead,BufNewFile *.yacml set filetype=dot
au BufRead,BufNewFile *.ino set filetype=cpp
" Make pandoc behave like tex
au BufRead,BufNewFile *.md setlocal filetype=markdown |
\ setlocal makeprg=markdown_to_pdf.sh\ %\ |
au BufRead,BufNewFile *.pandoc setlocal filetype=markdown |
\ setlocal makeprg=markdown_to_pdf.sh\ %\ |
au BufNewFile,BufRead *.context setlocal filetype=tex
" Make pandoc behave like tex
au BufRead,BufNewFile *.anansi setlocal filetype=tex |
\ setlocal makeprg=anansi.sh\ % |
\ setlocal spell spelllang=en
let noweb_backend="tex"
let noweb_language="python"
let noweb_fold_code=1
au BufRead,BufNewFile *.tex set spell spelllang=en
au BufEnter *.tex set nosmartindent
" Blog related setting.
au BufRead,BufNew *.blog setlocal spell spelllang=en
au BufRead,BufNew *.blog setlocal complete+=k
au BufRead,BufNew *.md setlocal complete+=k
au BufRead,BufNew *.md setlocal spell spelllang=en
au BufRead,BufNew *.markdown setlocal complete+=k
au BufRead,BufNew *.markdown setlocal syntax=markdown
au BufRead,BufNew *.markdown setlocal spell spelllang=en
" On tmp files do not wrap lines by inserting newline, wrap it without newline.
au BufRead,BufNew *.tmp setlocal wrap linebreak nolist
au BufRead,BufNew *.txt setlocal wrap linebreak nolist
au BufRead,BufNew *.lhs setlocal filetype=haskell
au BufNewFile *.vhd read ~/.vim/template/template.vhd
" au BufRead,BufNewFile *.bsv set filetype=verilog
au BufRead,BufNewFile *.bsv set syntax=bsv
au BufRead,BufNewFile *.rules set filetype=make
" vim-latexsuite mapping
let g:tex_flavor='latex'
let g:Tex_DefaultTargetFormat='pdf'
let g:Tex_ViewRule = 'yap -1'
set include=^\\s*#\\s*include\ \\(<boost/\\)\\@!
" unicode \u2506
"let g:haddock_browser="/usr/bin/elinks"
let g:haddock_docdir= "/usr/share/doc/ghc/html/"
" colorscheme and all
set bg=dark
colorscheme torte
set cc=+1
hi ColorColumn ctermbg=lightgrey guibg=lightgrey
" c-support
set errorformat+=%f:%l:\ %m
set errorformat^=%-G%f:%l:\ warning:%m
source $HOME/.vim/methods.vim
"" SnipMate
let g:snips_author = 'Dilawar Singh'
let g:snips_email = '[email protected]'
let g:snippets_dir = '$HOME/.vim/snippets'
let g:snipMate = {}
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['noweb'] = 'python,haskell'
let g:snipMate.scope_aliases['markdown'] = 'markdown,tex'
" Python related settings
autocmd BufRead *.py setlocal makeprg=pylint\ -E\ %:p
let g:pymode_lint_write=0
let g:pymode_lint=0
"indent guide
"hi IndentGuidesOdd ctermbg=white
"hi IndentGuidesEven ctermbg=lightgrey
"let g:indent_guides_enable_on_vim_startup = 1
"let g:indent_guides_guide_size=1
" default
set softtabstop=4
set shiftwidth=4
set expandtab
set smarttab
set textwidth=80
set wrap
set iskeyword+=_
set autoread
set showmatch
set errorbells
set backspace=2 "
" Create backup of all files.
set backup
set backupdir=~/vim-backup/,./.backup,/tmp,.
set undofile
let vimDir = '$HOME/.vim/'
let myUndoDir=expand(vimDir . '/undodir')
call system('mkdir -p ' . myUndoDir)
let &undodir = myUndoDir
set undofile
set foldmethod=indent
"set foldnestmax=4
"set foldlevel=1
let g:dbext_default_profile_sqlite_for_rails = 'type=SQLITE:dbname=./sqlite.db'
syntax match nonascii "[^\x00-\x7F]"
highlight nonascii guibg=Red ctermbg=2
" statusline
set statusline=2
"" Read pdf file in vim
command! -complete=file -nargs=1 Rpdf :r !pdftotext -nopgbrk <q-args> -
command! -complete=file -nargs=1 Rpdf :r !pdftotext -nopgbrk <q-args> - |fmt -csw78
" clipboard
set clipboard=unnamedplus
""" When xlipboard support is not available
:command -range Cz :silent :<line1>,<line2>w !xsel -i -b
:command -range Cx :silent :<line1>,<line2>w !xsel -i -p
:command -range Cv :silent :<line1>,<line2>w !xsel -i -s
:cabbrev cv Cv
:cabbrev cz Cz
:cabbrev cx Cx
:command -range Pz :silent :r !xsel -o -b
:command -range Px :silent :r !xsel -o -p
:command -range Pv :silent :r !xsel -o -s
:cabbrev pz Pz
:cabbrev px Px
:cabbrev pv Pv
augroup nonvim
au!
au BufRead *.png,*.jpg,*.pdf,*.gif,*.xls* sil exe "!open " . shellescape(expand("%:p")) | bd | let &ft=&ft
au BufRead *.ppt*,*.doc*,*.rtf let g:output_pdf = shellescape(expand("%:r") . ".pdf")
au BufRead *.ppt*,*.doc*,*.rtf sil exe "!/home/dilawar/Scripts/any2pdf " . shellescape(expand("%:p"))
au BufRead *.ppt*,*.doc*,*.rtf sil exe "!open " . g:output_pdf | bd | let &ft=&ft
augroup end
" Supertab
let g:SuperTabDefaultCompletionType = "context"
let g:haddock_browser = "firefox"
" Trigger configuration. Do not use <tab> if you use
" https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"