[nvim] use vim-plug instead of dein

This commit is contained in:
Dmytro Meleshko 2019-05-14 18:45:14 +03:00
parent 3e272ffaaf
commit d2dd0cb301

View file

@ -1,116 +1,82 @@
let s:dein_plugins_dir = expand('~/.cache/dein') let s:vim_config_dir = expand('~/.config/nvim')
let s:dein_dir = s:dein_plugins_dir . '/repos/github.com/Shougo/dein.vim' let s:vim_plug_script = s:vim_config_dir . '/autoload/plug.vim'
let s:vim_plug_home = s:vim_config_dir . '/plugged'
if !isdirectory(s:dein_dir) let s:just_installed_vim_plug = 0
echo 'Installing Dein...' if !filereadable(s:vim_plug_script)
call system('git clone https://github.com/Shougo/dein.vim ' . shellescape(s:dein_dir)) exe '!curl -fL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim --create-dirs -o' shellescape(s:vim_plug_script)
autocmd VimEnter * PlugInstall --sync
endif endif
let &runtimepath .= ',' . s:dein_dir call plug#begin(s:vim_config_dir . '/plugged')
if dein#load_state(s:dein_plugins_dir) Plug 'junegunn/vim-plug'
call dein#begin(s:dein_plugins_dir)
command! -nargs=+ -bar Plugin call dein#add(<args>)
" Let dein manage itself
Plugin s:dein_dir
" Files {{{ " Files {{{
Plugin 'tpope/vim-eunuch' Plug 'tpope/vim-eunuch'
Plugin 'francoiscabrol/ranger.vim' Plug 'francoiscabrol/ranger.vim'
" }}} " }}}
" Editing {{{ " Editing {{{
Plugin 'easymotion/vim-easymotion' Plug 'easymotion/vim-easymotion'
Plugin 'junegunn/vim-easy-align' Plug 'junegunn/vim-easy-align'
Plugin 'Raimondi/delimitMate' Plug 'Raimondi/delimitMate'
Plugin 'tpope/vim-repeat' Plug 'tpope/vim-repeat'
Plugin 'tpope/vim-commentary' Plug 'tpope/vim-commentary'
Plugin 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plugin 'Yggdroot/indentLine' Plug 'Yggdroot/indentLine'
Plugin 'henrik/vim-indexed-search' Plug 'henrik/vim-indexed-search'
Plugin 'andymass/vim-matchup' Plug 'andymass/vim-matchup'
Plugin 'tommcdo/vim-exchange' Plug 'tommcdo/vim-exchange'
Plugin 'inkarkat/vim-ingo-library' " required by LineJuggler Plug 'inkarkat/vim-ingo-library' " required by LineJuggler
Plugin 'inkarkat/vim-LineJuggler', { 'rev': 'stable' } Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' }
Plugin 'reedes/vim-pencil' Plug 'reedes/vim-pencil'
" }}} " }}}
" Text objects {{{ " Text objects {{{
Plugin 'kana/vim-textobj-user' Plug 'kana/vim-textobj-user'
Plugin 'kana/vim-textobj-entire' Plug 'kana/vim-textobj-entire'
Plugin 'kana/vim-textobj-line' Plug 'kana/vim-textobj-line'
Plugin 'kana/vim-textobj-indent' Plug 'kana/vim-textobj-indent'
" Plugin 'kana/vim-textobj-fold' " Plug 'kana/vim-textobj-fold'
" }}} " }}}
" UI {{{ " UI {{{
Plugin 'moll/vim-bbye' Plug 'moll/vim-bbye'
Plugin 'gerw/vim-HiLinkTrace' Plug 'gerw/vim-HiLinkTrace'
Plugin 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes' Plug 'vim-airline/vim-airline-themes'
Plugin 'wincent/terminus' Plug 'wincent/terminus'
Plugin 'tpope/vim-obsession' Plug 'tpope/vim-obsession'
Plugin 'romainl/vim-qf' Plug 'romainl/vim-qf'
Plugin 'dyng/ctrlsf.vim' Plug 'dyng/ctrlsf.vim'
" }}} " }}}
" Git {{{ " Git {{{
Plugin 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
Plugin 'tpope/vim-rhubarb' Plug 'tpope/vim-rhubarb'
Plugin 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
" }}} " }}}
" FZF {{{ " FZF {{{
Plugin 'junegunn/fzf', { 'build': './install --bin' } Plug 'junegunn/fzf', { 'do': './install --bin' }
Plugin 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
" }}} " }}}
" Programming {{{ " Programming {{{
Plugin 'sheerun/vim-polyglot' Plug 'sheerun/vim-polyglot'
Plugin 'neoclide/coc.nvim', { 'build': 'yarn install' } Plug 'neoclide/coc.nvim', { 'do': 'yarn install' }
Plugin 'dag/vim2hs' Plug 'dag/vim2hs'
" }}} " }}}
delcommand Plugin call plug#end()
call dein#end() " " Automatically install/clean plugins (because I'm a programmer) {{{
call dein#save_state() augroup vimrc-plugins
endif autocmd!
autocmd VimEnter *
" enable full plugin support \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
filetype plugin indent on \| PlugInstall --sync | q
syntax enable \| endif
augroup END
" Automatically install/clean plugins (because I'm a programmer) {{{ " " }}}
" the following two lines were copied directly from dein's source code
let s:dein_cache_dir = get(g:, 'dein#cache_directory', g:dein#_base_path)
let s:dein_state_file = s:dein_cache_dir . '/state_' . g:dein#_progname . '.vim'
let s:current_file = expand('<sfile>')
" gettftime() returns the last modification time of a given file
let s:plugins_file_changed = getftime(s:current_file) > getftime(s:dein_state_file)
if s:plugins_file_changed
echo "plugins.vim was changed, clearing Dein state..."
call dein#clear_state()
let s:unused_plugins = dein#check_clean()
if !empty(s:unused_plugins)
echo "Cleaning up unused plugins..."
for s:plugin in s:unused_plugins
echo "deleting" s:plugin
call delete(s:plugin, 'rf')
endfor
endif
endif
if dein#check_install() || s:plugins_file_changed
echo "Installing plugins..."
call dein#install()
echo
endif
" }}}