This repository has been archived by the owner on Oct 5, 2018. It is now read-only.
forked from ricardochimal/vim-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
132 lines (104 loc) · 3.58 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
set encoding=utf-8
" vim settings, not vi
set nocompatible
" load pathogen
call pathogen#infect()
" some standard stuff
set autoindent
set smartindent
syntax on
filetype on
filetype plugin on
filetype indent on
set ruler
set backspace=indent,eol,start
set history=50
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
" unfold all code
set foldlevelstart=2
" always show the statusline
set laststatus=2
" Powerline Init
"
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
" set the font for gui mode
set gfn=Andale\ Mono\ 11
" will save your last position in a file so next time you open it, you'll
" come back to the same place
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
" sets default color theme
set background=dark
" xterm16 specific options
let g:xterm16_colormap = 'soft'
let g:xterm16_brightness = 'high'
color xterm16
" shows line numbers
" toggle it with 2 ctrl+n's
nmap <C-N><C-N> :set invnumber<CR>
" set tab to 4 spaces, softtabs
set smarttab
set tabstop=4
set shiftwidth=4
set expandtab
set smartindent
" FileType specific settings
au FileType ruby set tabstop=2 shiftwidth=2
au BufNewFile,BufRead *.go setlocal noet ts=4 sw=4 sts=4
" syntax highlight ruby operators &&, ||, etc
let ruby_operators=1
" set backup options, i don't like backup files cluttering my directories.. so
" i set some global backup directory for this purpose
set backup
set backupdir=~/.vim/backup
" completes { } for you when you type { then enter
inoremap {<cr> {<cr>}<esc>O
" F9 toggles paste mode which is nice for pasting stuff
" that is already indented
map <F9> <nop>
set pastetoggle=<F9>
" indent blocks of code between { } without indenting the { }
" shift+F1, shift+F2
map <S-F1> <nop>
map <S-F2> <nop>
map <S-F1> >i{
map! <S-F1> <ESC><S-F1>
map <S-F2> <i{
map! <S-F2> <ESC><S-F2>
" indenting blocks of code between { } as one
" F1, F2
map <F1> >a{
map! <F1> <ESC><F1>
map <F2> <a{
map! <F2> <ESC><F2>
" comment an entire visual block at once
" highlight the area however you want (V, CTRL+V) then
" ,c will comment the block
" ,u will uncomment the block
let b:comment_leader = '# '
au FileType haskell,vhdl,ada let b:comment_leader = '-- '
au FileType vim let b:comment_leader = '" '
au FileType c,cpp,java,php,javascript,go let b:comment_leader = '// '
au FileType sh,make,perl,eruby,ruby,python let b:comment_leader = '# '
au FileType tex let b:comment_leader = '% '
noremap <silent> ,c :<C-B>sil <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:noh<CR>
noremap <silent> ,u :<C-B>sil <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:noh<CR>
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2
" makes vim change to whatever directory the most recent file is located in
autocmd BufEnter * lcd %:p:h
" vim-go configuration
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
au FileType go nmap ,d <Plug>(go-def-split)
au FileType go nmap ,b <Plug>(go-build)
au FileType go nmap ,t <Plug>(go-test)