-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
135 lines (104 loc) · 2.59 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
" Use Vim settings not Vi (this must be first)
set nocompatible
" Pathogen
execute pathogen#infect()
" Line numbers + tabs
set number
set tabstop=2
set shiftwidth=2
set autoindent
set expandtab
" Add visual column indicator
set colorcolumn=100
" Allow backspacing over everything
set backspace=indent,eol,start
" Auto and highlight searches
set incsearch
set hlsearch
" Better tab completion (ala Bash)
set wildmode=list:longest
set wildmenu
" Send more characters for redraws
set ttyfast
" Mouse Stuff
set mouse=a
set ttymouse=xterm2
" Autosave on focus lost
au FocusLost * silent! wa
" Colour scheme
set t_Co=256
syntax enable
colorscheme argonaut
" Syntax File Associations
au BufNewFile,BufRead *.dql set filetype=sql
au BufNewFile,BufRead *.dql_inc set filetype=sql
" Disable arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
inoremap <C-k> <Up>
inoremap <C-j> <Down>
inoremap <C-h> <Left>
inoremap <C-l> <Right>
" NERDTree
map <silent> <C-n> :NERDTreeFocus<CR>
let NERDTreeQuitOnOpen=1
let NERDTreeIgnore = ['\.o$', '\.lo$']
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
function! s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif
endif
endif
endfunction
" Highlight excess whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
" Syntastic
" C++:
let g:syntastic_cpp_compiler = 'g++'
let g:syntastic_cpp_compiler_options = ' -std=c++0x'
let g:syntastic_cpp_check_header = 1
let g:syntastic_cpp_auto_refresh_includes = 1
" swp directory
set directory=$HOME/.vim/swp//
" Ctrl+S to save, Ctrl+q to quit
map <C-s> :w<cr>
imap <C-s> <ESC>:w<cr>a
map <C-q> :qa<cr>
imap <C-q> <ESC>:qa<cr>
" CtrlP settings
let g:ctrl_map = '<c-p>'
let g:ctrl_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = ''
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.svn|build|ext$',
\ 'file': '\v^[^\.]+(\.(o|lo|tmp)|)$'
\ }
" Better find
nnoremap n nzz
" Make u Ctrl+u (too many accidental hits...)
noremap u <NOP>
noremap <C-u> u
" Tagbar
nmap <F8> :TagbarToggle<CR>
let g:tagbar_autoclose = 1
" Persistant undo history
set undofile
set undodir=$HOME/.vim/undo//
" Gundo
nnoremap <F5> :GundoToggle<CR>
let g:gundo_preview_bottom = 1
let g:gundo_close_on_revert = 1