From e9d435f193a3c44f045660f056fc26b9cdd977c1 Mon Sep 17 00:00:00 2001 From: Alexander Karle Date: Sun, 16 Dec 2018 15:03:29 -0500 Subject: [PATCH] vim: goodbye pathogen, hello native packages I've known about Vim 8's packages for a while as a native solution to package management, but I've never gotten around to reading about it enough to transition off of pathogen. I finally got the motivation, and it was easier than I thought! Most of the effort went to deciding which packages to be start/opt (which I really like, actually), and writing a home-brewed solution to Helptags. --- vim/.gitignore | 6 ++---- vim/autoload/vimrc.vim | 8 ++++++++ vim/vimrc | 10 +++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/vim/.gitignore b/vim/.gitignore index 54ef2ed..c5b21fc 100644 --- a/vim/.gitignore +++ b/vim/.gitignore @@ -7,10 +7,8 @@ undo/ # Ignore plugin artifacts .netrwhist -# Ignore dependencies (TODO: use submodules?) -autoload/pathogen.vim -autoload/plug.vim -bundle/ +# Ignore plugins (TODO: consider submodules) +pack/ # Ignore tags tags diff --git a/vim/autoload/vimrc.vim b/vim/autoload/vimrc.vim index 5e69993..24fbe73 100644 --- a/vim/autoload/vimrc.vim +++ b/vim/autoload/vimrc.vim @@ -64,3 +64,11 @@ function! vimrc#SetPasteAndPasteFromClipboard() abort normal! "*p set nopaste endfunction + +" Generates helptags for all doc a la pathogen (using native Vim 8 packages) +function! vimrc#Helptags() abort + let dirs = split(glob(expand(':p:h') . '/pack/*/*/*/doc'), '\n') + for d in dirs + exe 'helptags ' . d + endfor +endfunction diff --git a/vim/vimrc b/vim/vimrc index b015b5b..545ef4a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -11,11 +11,6 @@ else let s:vimdir = expand($HOME . '/.vim') endif -" Add all the plugins to the path -if filereadable(s:vimdir . "/autoload/pathogen.vim") - execute pathogen#infect() -endif - " Space related set softtabstop=4 " is 4 spaces (when expandtab set) set shiftwidth=4 " >> will indent 4 spaces @@ -89,7 +84,7 @@ set listchars=space:·,tab:>–,trail:~,eol:¬ " COLORSCHEME " if can use truecolor, do if (has("termguicolors") || has('gui_running')) && - \ filereadable(s:vimdir . "/bundle/gruvbox/colors/gruvbox.vim") + \ filereadable(s:vimdir . "/pack/mine/start/gruvbox/colors/gruvbox.vim") set termguicolors colorscheme gruvbox @@ -159,7 +154,7 @@ nnoremap D :set background=dark nnoremap C vimrc#ToggleColorColumn() " Quick open current directory of file being edited -if isdirectory(s:vimdir . '/bundle/vim-dirvish') +if isdirectory(s:vimdir . '/pack/plugins/start/vim-dirvish') nnoremap d :Dirvish %:p:h else nnoremap d :Explore @@ -201,6 +196,7 @@ nnoremap V :edit $MYVIMRC " COMMANDS {{{ command! -nargs=1 GitGrep call vimrc#GitGrep('') | copen command! CD exe 'cd ' . expand('%:h') +command! Helptags call vimrc#Helptags() " }}} " vim:fdm=marker:sts=4:sw=4 -- libgit2 0.28.4