From bf757f36c5ff6d0fff06616564dd1af92bb80c20 Mon Sep 17 00:00:00 2001 From: Adam Dodman Date: Sun, 14 May 2017 01:57:38 +0100 Subject: [PATCH] Add vim files --- .gitmodules | 12 ++ makelinks.sh | 2 + vim/autoload/pathogen.vim | 353 ++++++++++++++++++++++++++++++++++ vim/bundle/vim-airline | 1 + vim/bundle/vim-airline-themes | 1 + vim/bundle/vim-gitgutter | 1 + vim/vimrc | 7 + 7 files changed, 377 insertions(+) create mode 100644 .gitmodules create mode 100644 vim/autoload/pathogen.vim create mode 160000 vim/bundle/vim-airline create mode 160000 vim/bundle/vim-airline-themes create mode 160000 vim/bundle/vim-gitgutter create mode 100644 vim/vimrc diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..142d95b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "vim/bundle/vim-airline"] + path = vim/bundle/vim-airline + url = https://github.com/vim-airline/vim-airline +[submodule "vim/bundle/vim-airline-themes"] + path = vim/bundle/vim-airline-themes + url = https://github.com/vim-airline/vim-airline-themes +[submodule "vim/bundle/GitGutter"] + path = vim/bundle/GitGutter + url = https://github.com/jisaacks/GitGutter +[submodule "vim/bundle/vim-gitgutter"] + path = vim/bundle/vim-gitgutter + url = https://github.com/airblade/vim-gitgutter diff --git a/makelinks.sh b/makelinks.sh index c8e7baf..fad581e 100644 --- a/makelinks.sh +++ b/makelinks.sh @@ -2,3 +2,5 @@ ln -s ~/.dotfiles/zsh/zshrc .zshrc ln -s ~/.dotfiles/i3 ~/.config/i3 ln -s ~/.dotfiles/Xresources ~/.Xresources +ln -s ~/.dotfiles/vim/vimrc ~/.vimrc +ln -s ~/.dotfiles/vim ~/.vim diff --git a/vim/autoload/pathogen.vim b/vim/autoload/pathogen.vim new file mode 100644 index 0000000..59a75c1 --- /dev/null +++ b/vim/autoload/pathogen.vim @@ -0,0 +1,353 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" Version: 2.4 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. +" +" The API is documented inline below. + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke +" pathogen#surround(). Curly braces are expanded with pathogen#expand(): +" "bundle/{}" finds all subdirectories inside "bundle" inside all directories +" in the runtime path. +function! pathogen#infect(...) abort + for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] + if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' + call pathogen#surround(path) + elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#surround(path . '/{}') + elseif path =~# '[{}*]' + call pathogen#interpose(path) + else + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#interpose(path . '/{}') + endif + endfor + call pathogen#cycle_filetype() + if pathogen#is_disabled($MYVIMRC) + return 'finish' + endif + return '' +endfunction + +" Split a path into a list. +function! pathogen#split(path) abort + if type(a:path) == type([]) | return a:path | endif + if empty(a:path) | return [] | endif + let split = split(a:path,'\\\@]','\\&','') + endif +endfunction + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) abort + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction + +" Section: Deprecated + +function! s:warn(msg) abort + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction + +" Prepend all subdirectories of path to the rtp, and append all 'after' +" directories in those subdirectories. Deprecated. +function! pathogen#runtime_prepend_subdirectories(path) abort + call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')') + return pathogen#surround(a:path . pathogen#slash() . '{}') +endfunction + +function! pathogen#incubate(...) abort + let name = a:0 ? a:1 : 'bundle/{}' + call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')') + return pathogen#interpose(name) +endfunction + +" Deprecated alias for pathogen#interpose(). +function! pathogen#runtime_append_all_bundles(...) abort + if a:0 + call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')') + else + call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()') + endif + return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') +endfunction + +if exists(':Vedit') + finish +endif + +let s:vopen_warning = 0 + +function! s:find(count,cmd,file,lcd) + let rtp = pathogen#join(1,pathogen#split(&runtimepath)) + let file = pathogen#runtime_findfile(a:file,a:count) + if file ==# '' + return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" + endif + if !s:vopen_warning + let s:vopen_warning = 1 + let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' + else + let warning = '' + endif + if a:lcd + let path = file[0:-strlen(a:file)-2] + execute 'lcd `=path`' + return a:cmd.' '.pathogen#fnameescape(a:file) . warning + else + return a:cmd.' '.pathogen#fnameescape(file) . warning + endif +endfunction + +function! s:Findcomplete(A,L,P) + let sep = pathogen#slash() + let cheats = { + \'a': 'autoload', + \'d': 'doc', + \'f': 'ftplugin', + \'i': 'indent', + \'p': 'plugin', + \'s': 'syntax'} + if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) + let request = cheats[a:A[0]].a:A[1:-1] + else + let request = a:A + endif + let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' + let found = {} + for path in pathogen#split(&runtimepath) + let path = expand(path, ':p') + let matches = split(glob(path.sep.pattern),"\n") + call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') + call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') + for match in matches + let found[match] = 1 + endfor + endfor + return sort(keys(found)) +endfunction + +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) + +" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/vim/bundle/vim-airline b/vim/bundle/vim-airline new file mode 160000 index 0000000..466198a --- /dev/null +++ b/vim/bundle/vim-airline @@ -0,0 +1 @@ +Subproject commit 466198adc015a9d81e975374d8e206dcf3efd173 diff --git a/vim/bundle/vim-airline-themes b/vim/bundle/vim-airline-themes new file mode 160000 index 0000000..66c2839 --- /dev/null +++ b/vim/bundle/vim-airline-themes @@ -0,0 +1 @@ +Subproject commit 66c2839bb1126c71a0a2d1da9804161ccd3b78b6 diff --git a/vim/bundle/vim-gitgutter b/vim/bundle/vim-gitgutter new file mode 160000 index 0000000..b803a28 --- /dev/null +++ b/vim/bundle/vim-gitgutter @@ -0,0 +1 @@ +Subproject commit b803a28f47b26d16f5fe9e747850992c9985c667 diff --git a/vim/vimrc b/vim/vimrc new file mode 100644 index 0000000..30ae9bb --- /dev/null +++ b/vim/vimrc @@ -0,0 +1,7 @@ +execute pathogen#infect() +syntax on +filetype plugin indent on +set t_Co=256 +set laststatus=2 +let g:airline_powerline_fonts = 1 +let g:airline_theme='murmur'