Skip to content

Instantly share code, notes, and snippets.

@hacolab
Last active February 14, 2020 14:28
Show Gist options
  • Save hacolab/f5be4b10a06382ee804d6bfd278880eb to your computer and use it in GitHub Desktop.
Save hacolab/f5be4b10a06382ee804d6bfd278880eb to your computer and use it in GitHub Desktop.
" Path configs
" ----------------------------
let s:config_dir=empty($XDG_CONFIG_HOME) ? expand("$HOME/.config") : expand($XDG_CONFIG_HOME)
let s:cache_dir=empty($XDG_CACHE_HOME) ? expand("$HOME/.cache") : expand($XDG_CACHE_HOME)
let s:dein_dir = s:cache_dir . '/nvim/dein'
let s:plugin_list = s:config_dir . '/nvim/dein.toml'
" Install dein
" ----------------------------
if &runtimepath !~# '/dein.vim'
let s:dein_repo = 'github.com/Shougo/dein.vim'
let s:dein_repo_dir = s:dein_dir . '/repos/' . s:dein_repo
if !isdirectory(s:dein_repo_dir)
execute printf('!git clone %s %s', 'https://' . s:dein_repo, s:dein_repo_dir)
endif
execute 'set runtimepath^=' . s:dein_repo_dir
endif
" Install plugins
" ----------------------------
augroup PluginInstall
autocmd!
autocmd VimEnter * if dein#check_install() | call dein#install() | endif
augroup END
" Load plugins
" ----------------------------
if dein#load_state(s:dein_dir)
call dein#begin(s:dein_dir)
call dein#load_toml(s:plugin_list)
call dein#end()
call dein#save_state()
endif
" Remove plugins
" ----------------------------
let s:removed_plugins = dein#check_clean()
if len(s:removed_plugins) > 0
call map(s:removed_plugins, "delete(v:val, 'rf')")
call dein#recache_runtimepath()
endif
" Update plugins (bind keymap)
" ----------------------------
nnoremap <Leader>du :call dein#update()<CR>
" Enable indent
" ----------------------------
filetype plugin indent on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment