-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathvimrc.vim
More file actions
56 lines (46 loc) · 1.59 KB
/
vimrc.vim
File metadata and controls
56 lines (46 loc) · 1.59 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
"
" Vimrc helper functions
"
function! vimrc#init() abort " {{{1
" Use space as leader key
nnoremap <space> <nop>
let g:mapleader = "\<space>"
" Set vim-plug settings
" - Set this here because they might be needed before the vimrc file
" is fully parsed
let g:plug_window = 'new|wincmd o'
nnoremap <silent> <leader>pd :PlugDiff<cr>
nnoremap <silent> <leader>pi :PlugInstall<cr>
nnoremap <silent> <leader>pu :PlugUpdate<cr>
nnoremap <silent> <leader>ps :PlugStatus<cr>
nnoremap <silent> <leader>pc :PlugClean<cr>
" Add personal files to runtimepath
let &runtimepath = vimrc#path('personal') . ',' . &runtimepath
let &runtimepath .= ',' . vimrc#path('personal/after')
" Get some system information and define some paths/urls
let g:vimrc#bootstrap = !filereadable(vimrc#path('autoload/plug.vim'))
let g:vimrc#is_devhost = index([
\ 'lotti',
\ 'allegri',
\ 'vsl142',
\ 'unity.sintef.no',
\], hostname()) >= 0
let g:vimrc#path_bundles = '~/.vim/bundle'
let g:vimrc#path_lervag = g:vimrc#is_devhost
\ ? 'git@github.com:lervag/'
\ : 'lervag/'
" If plug.vim is not available, then we source the init script and install
" plugins
if g:vimrc#bootstrap
execute 'silent !source' vimrc#path('init.sh')
" vint: -ProhibitAutocmdWithNoGroup
autocmd VimEnter * nested PlugInstall --sync | source $MYVIMRC
" vint: +ProhibitAutocmdWithNoGroup
endif
endfunction
" }}}1
function! vimrc#path(name) abort " {{{1
return s:path . '/' . a:name
endfunction
" }}}1
let s:path = fnamemodify(expand('<sfile>'), ':p:h:h')