-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
168 lines (129 loc) · 3.98 KB
/
vimrc
File metadata and controls
168 lines (129 loc) · 3.98 KB
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
set nocompatible
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
set runtimepath+=~/.vim/neocomplete.vim/
endif
let g:neobundle#install_process_timeout=1500
" NeoBundle settings and packages
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
NeoBundleFetch 'Shougo/neobundle.vim'
" My bundles here
NeoBundle 'MarcWeber/vim-addon-mw-utils'
NeoBundle 'tomtom/tlib_vim'
NeoBundle 'honza/vim-snippets'
NeoBundle 'garbas/vim-snipmate'
NeoBundle 'derekwyatt/vim-scala'
NeoBundle 'majutsushi/tagbar'
NeoBundle 'Raimondi/delimitMate'
NeoBundle 'davidhalter/jedi-vim'
" Asynchronous tag generation
NeoBundle 'xolox/vim-easytags'
NeoBundle 'xolox/vim-misc'
call neobundle#end()
" Merlin Settings
let g:opamshare = substitute(system('opam config var share'), '\n$', '', '''')
execute "set rtp+=" . g:opamshare . "/merlin/vim"
" basic syntax stuff
filetype on
filetype plugin on
highlight Comment ctermfg=blue
syntax enable
" expand brackets on delimitMate
let delimitMate_expand_cr = 1
" enable indentation features
set smartindent
set autoindent
set smarttab
" tab spacing
set shiftwidth=4
set tabstop=4
" tab completion style
set wildmenu
set wildmode=list:longest,full
" vim command history
set history=1000
" highlight results before Enter is pressed
set incsearch
set smartcase
" show matching parentheses
set showmatch
" lines fold after 79 characters
set tw=79
set formatoptions+=t
" map navigation to not skip folded lines
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
" display status line by default + highlight current line
set cursorline
set laststatus=2
" show much info on statusline
set statusline=
\%F%m%r%h%w\ [format=%{&ff}]\ [type=%{&ft}]\ [%l,%v][%p%%]\
\%{strftime(\"%d/%m/%y\ -\ %H:%M\")}
" shortcut to turn statusline on and off using \s
nmap <leader>s :exec "set laststatus=" . (( &laststatus == 1) ? 2 : 1) <CR>
" use omnicompletion (C-x + C-o)
set omnifunc=syntaxcomplete#Complete
set autoread
" Use skeletons for certain file types
au BufNewFile *.c r .vim/skeletons/skeleton.c
au BufNewFile *.sh r .vim/skeletons/skeleton.sh
au BufNewFile *.pl r .vim/skeletons/skeleton.pl
" java filenames coincide with classes inside
au BufNewFile *.java
\ exe "normal Opublic class " . expand('%:t:r') . "\n{\n}\<Esc>1G"
" same goes with scala!
au BufNewFile *.scala
\ exe "normal Oobject " . expand('%:t:r') .
\ " {\ndef main(args: Array[String]) {\n\n}\n}"
" Remove trailing whitespace automatically
autocmd FileType c,cpp,java,php,python,ruby,haskell,ocaml,scala
\ autocmd BufWritePre <buffer> :%s/\s\+$//e
" re-source file with \rr
map <leader>rr :source ~/.vimrc<CR>
" pressing \d enables relative number display (useful for visual mode)
nmap <leader>d :set relativenumber!<CR>
" generate or delete ctags by filetype -> use correct extensions
let g:ctags_languages = {
\ 'c': 'c',
\ 'python': 'py',
\ 'perl': 'pl',
\ 'java': 'java',
\ 'scala': 'scala',
\ 'ocaml': 'ml',
\ 'matlab' : 'm'
\ }
nmap <leader>ct :exec "!ctags *." . (g:ctags_languages[&filetype]) <CR>
nmap <leader>rt :exec "!rm tags" <CR>
" indentation for pastes
nnoremap p p=']<C-o>
nnoremap P P=']<C-o>
colorscheme molokai
" shortcut to switch between colorschemes (molokai / jellybeans)
nmap <F3> :exec "color " . ((g:colors_name == "molokai") ? "jellybeans" : "molokai") <CR>
" TagBar Settings
" adjust window size for easier browsing
let g:tagbar_width = 60
nmap <F8> :TagbarToggle <CR>
highlight MatchParen ctermbg=4
" neocomplete settings
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell': $HOME.'/.vimshell_hist',
\ }
" Define keyword
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" enable auto selection
let g:neocomplete#enable_auto_select = 1
" Load per-folder settings, if available
if filereadable(".vim.custom")
so .vim.custom
endif