-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.vimrc
219 lines (153 loc) · 5.96 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
" Load vundle
set nocompatible
filetype off
set rtp+=~/scripts/.vim/bundle/vundle/
call vundle#rc()
" Load vundle bundles
Bundle 'gmarik/vundle'
" To add more
" git submodule add [email protected]:airblade/vim-gitgutter.git .vim/bundle/vim-gitgutter
" Then add Bundle call above
" After adding to above, in vim run :BundleInstall!
" This adds a nice +/- signs column on left
Bundle 'airblade/vim-gitgutter'
let g:gitgutter_realtime = 0
let g:gitgutter_eager = 0
" keyboard commands:
" ]c => next hunk
" [c => prev hunk
" Adds the cool branch / commit aware coloured status line on the bottom
Bundle 'bling/vim-airline'
set laststatus=2
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
" Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
" This sets 256 colours support needed for airline
set t_Co=256
" This is for block code commenting / uncommenting, select text then press Ctrl + // to toggle
Bundle 'tomtom/tcomment_vim'
" TODO One minor issue with above is that I want it to retain the selection afterwards, this fixes that:
" Ctrl + p - support like Sublime / atom (not actually great on big projects like moodle)
Bundle 'kien/ctrlp.vim'
" Ctrl + r - search for most recently used files
nmap <C-r> :CtrlPMRUF<CR>
" Ctrl + b - search open buffers
nmap <C-b> :CtrlPBuffer<CR>
" Ctrl + m - search for modified / unstaged files
Bundle 'jasoncodes/ctrlp-modified.vim'
nmap <C-m> :CtrlPModified<CR>
" NerdTree
Bundle 'scrooloose/nerdtree'
" Auto open if no files
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Close vim when only nerdtree is left"
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
"map <C-n> :NERDTreeToggle<CR>
" press tab to indent and shift tab to unindent a block of text
vmap <Tab> >gv
vmap <S-Tab> <gv
" Show trailing whitespace eg at the end of this line is a crap which should be red
Bundle 'bronson/vim-trailing-whitespace'
" This makes text wrap at spaces instead of mid-word, nicer for long wrapped text or markdown
set linebreak
" When really long lines wrapp so much they go off the screen they aren't shown with a @ instead" This fixes that and shows them:
set display+=lastline
" When lines are broken, as well as not showing a new line number also show an ellipsis to make it really clear that this is a wrapped line and not a new line
set showbreak=...\
" This does nicer wrapping when line is indented, but looks to not be compiled in :(
" set breakindent
" All things folding and outlining, currently REALLY slow, need something better
" Also need to find a way to fold JavaDoc style comments into the fold below it, otherwise is pretty useless
" set foldmethod=syntax " slow
" set foldmethod=indent " slow
" set foldlevelstart=1
" set foldcolumn=3
"
" let perl_fold=1 " Perl
" let ruby_fold=1 " Ruby
" let javaScript_fold=1 " JavaScript
" let php_folding=1 " PHP
" let vimsyn_folding='af' " Vim script
" let r_syntax_folding=1 " R
" let xml_syntax_folding=1 " XML
" let sh_fold_enabled=1 " sh
" Less support for places which don't have it by defaults
Bundle 'groenewege/vim-less'
" Make all css files less files
au BufNewFile,BufRead *.css set filetype=less
" make mysql config files use .ini syntax
au bufreadpost *.conf,*.cnf,*.tksrc set filetype=dosini
" git config files
" Don't convert tabs to spaces
au bufreadpost *.gitmodules set filetype=gitconfig
:autocmd FileType gitconfig set noexpandtab
" .conf is used for both apache and mysql
au bufreadpost /etc/apache2/*.conf set filetype=apache
" make psql config files use .sql syntax
au bufreadpost *.psqlrc set filetype=sql
" This is for sublime multi cursor fun
Bundle 'terryma/vim-multiple-cursors'
"let g:multi_cursor_use_default_mapping=0
" Default mapping
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" cheat sheet:
" Press C+n to add more lines
" This is for nice css colors
Bundle 'ap/vim-css-color'
" Moodle ctags:
" ctags -R --languages=php --exclude="CVS" --php-kinds=f --regex-PHP='/abstract class ([^ ]*)/\1/c/' --regex-PHP='/interface ([^ ]*)/\1/c/' --regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'
" Turn on http://vim.wikia.com/wiki/Omni_completion
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" This is for IDE like popup auto complete
" crap need newer ubuntu first :(
" Bundle 'Valloric/YouCompleteMe'
" Auto complete syntax goodies for php, depends on youcompleteme and still doesn't work :(
"Plugin 'shawncplus/phpcomplete.vim'
" End of bundle stuff
filetype on
syntax on
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"1000,:20,%,n~/.viminfo
" Don't convert tabs to space when in a Makefile
:autocmd FileType make set noexpandtab
" This default color scheme should work in most places
" and is closest to what feels normal for me
:colorscheme peachpuff
" This makes the git +/- columnonthe left black background
highlight SignColumn ctermbg=black
" Show line numbers
set number
" Click to move cursor and select text with the mouse
set mouse=a
set showmatch
set history=9999
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
" This means that after you paste, the buffer still contains the same
" thing instead of what you just copied over
vmap p "_dP
" Show searches as you type them. Can make things slower :(
set incsearch
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END