-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
235 lines (180 loc) · 6.32 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
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
"
" Vundle stuff
"
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle - required!
Plugin 'VundleVim/Vundle.vim'
" Plugins from https://github.com/vim-scripts
"Plugin 'surround.vim'
"Plugin 'tComment'
" Plugins from github repos
Plugin 'dubek/bufferlist.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-markdown'
Plugin 'wgibbs/vim-irblack'
Plugin 'isRuslan/vim-es6'
"Plugin 'scrooloose/nerdtree' " <-- Commented-out because it's very slow to start up
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Colors!
set background=dark
" colorscheme ir_black
" hi Normal guibg=#1c1c1c
" hi StatusLine guibg=#303030
" hi StatusLineNC guibg=#303030
syntax on
set guifont=Bitstream\ Vera\ Sans\ Mono\ 12
" set guifont=Source\ Code\ Pro:h16.00
" set guifont=Monaco:h12
" set guifont=DejaVu\ Sans\ Mono:h13
" set printfont=Courier:h7
set modeline
set modelines=3
" show line numbers and sign column for git diff
set number
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=100 " keep 100 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set guioptions-=T " remove the toolbar
set laststatus=2 " always show a status line
" Don't use Ex mode, use Q for formatting
map Q gq
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Enable spell-check when authoring git commits
autocmd FileType gitcommit setlocal spell
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
if has("cscope")
set csto=0
" Use Ctrl-] to search for symbol definition
set cst
set nocsverb
if filereadable("cscope.out")
cs add cscope.out
endif
set csverb
endif
" -----------------------------------
" dubek additions
" Disable these ~ files
set nobackup
set nowritebackup
set visualbell
highlight comment ctermfg=lightblue
" SignColumn is used to should git diff signs (gitgutter.vim plugin)
highlight SignColumn ctermbg=NONE guibg=NONE
" Tell gitgutter to slow down
let g:gitgutter_realtime = 0
let g:gitgutter_eager = 0
" Highlight redundant whitespaces and tabs at the end of the line
highlight RedundantSpaces ctermbg=red guibg=red
" match RedundantSpaces /\S\zs\s\+$/
match RedundantSpaces /\s\+$/
let ruby_space_errors = 1
highlight ExtraWhitespace ctermbg=red guibg=red
" Highlight for bad spelling; enable spelling with :set spell
highlight SpellBad cterm=underline ctermbg=NONE ctermfg=red
" Show matching brackets
set showmatch
" interactive pattern matching settings
set ignorecase smartcase
set incsearch
" show completion options above command line when hitting <Tab>
set wildmenu
" Tell Vim to quit whining about unsaved buffers when I want to open a new
" buffer. Vim just hides the unsaved buffer, instead of trying to close it.
set hidden
map <C-j> :bprev<CR>
map <C-k> :bnext<CR>
" Automatically load a file that has changed outside Vim (and hasn't changed
" inside Vim).
set autoread
" Toggle highlighting of found search terms on/off
map <F4> :set hlsearch!<CR>:set nohlsearch?<CR>
" Disable highlighting of found search terms once, with a single keystroke
map - :nohls<cr>
" Toggle view of special chars
map <F5> :set list!<CR>
"map <leader>t :NERDTreeToggle<CR>
" paste toggle
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
" Load matchit.vim, but only if the user hasn't installed a newer version.
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
" emacs-style editing on the command-line
cnoremap <C-A> <Home>
cnoremap <C-B> <Left>
cnoremap <C-D> <Del>
cnoremap <C-E> <End>
cnoremap <C-F> <Right>
"
" bufferlist plugin
"
map <leader>b :call BufferList()<CR>
let g:BufferListWidth = 25
let g:BufferListMaxWidth = 50
hi BufferSelected term=reverse ctermfg=white ctermbg=red cterm=bold
hi BufferNormal term=NONE ctermfg=black ctermbg=darkcyan cterm=NONE
"
" Ag command - internally uses vim's grep
"
if executable("ag")
set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column
set grepformat=%f:%l:%c:%m,%f:%l:%m
command! -nargs=+ Ag execute 'silent grep! <args>' | copen
endif
" Bind the 'K' key to search for the word under the cursor (using Ag -
" the_silver_searcher) and open the results in a quickfix window
nnoremap K :Ag<CR>:cw<CR>
" vim-go settings
let g:go_fmt_command = "goimports"
augroup dubek
autocmd!
autocmd FileType ruby,eruby,javascript,json,lua,perl,tex,vhdl,vim setlocal shiftwidth=2 sts=2 et
autocmd FileType ruby setlocal kp=ri
" autocmd FileType ruby setlocal softtabstop=2 shiftwidth=2 expandtab
autocmd FileType ruby setlocal path+=lib|set path+=test
autocmd BufEnter *.yaml setlocal softtabstop=2 shiftwidth=2 expandtab
autocmd BufEnter *.yml setlocal softtabstop=2 shiftwidth=2 expandtab
autocmd FileType java,c,cc,cpp,d,html,xhtml,xml,xslt,html.handlebars,python,tcl,st,io setlocal shiftwidth=4 sts=4 et
augroup END
" Abbreviations
ab comline #-----------------------------------------------------------------------------#