mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-21 02:55:09 +02:00
84 lines
1.5 KiB
VimL
84 lines
1.5 KiB
VimL
" auto-install vim-plug
|
|
if empty(glob('~/.config/nvim/autoload/plug.vim'))
|
|
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
|
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
"autocmd VimEnter * PlugInstall
|
|
"autocmd VimEnter * PlugInstall | source $MYVIMRC
|
|
endif
|
|
|
|
call plug#begin('~/.config/nvim/autoload/plugged')
|
|
|
|
" Better Syntax Support
|
|
Plug 'sheerun/vim-polyglot'
|
|
" File Explorer
|
|
Plug 'scrooloose/NERDTree'
|
|
" Auto pairs for '(' '[' '{'
|
|
Plug 'jiangmiao/auto-pairs'
|
|
" Themes
|
|
Plug 'joshdick/onedark.vim'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call plug#end()
|
|
|
|
" Automatically install missing plugins on startup
|
|
autocmd VimEnter *
|
|
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|
\| PlugInstall --sync | q
|
|
\| endif
|
|
|
|
" Press gx to open the GitHub URL for a plugin or a commit with the default browser.
|
|
function! s:plug_gx()
|
|
let line = getline('.')
|
|
let sha = matchstr(line, '^ \X*\zs\x\{7,9}\ze ')
|
|
let name = empty(sha) ? matchstr(line, '^[-x+] \zs[^:]\+\ze:')
|
|
\ : getline(search('^- .*:$', 'bn'))[2:-2]
|
|
let uri = get(get(g:plugs, name, {}), 'uri', '')
|
|
if uri !~ 'github.com'
|
|
return
|
|
endif
|
|
let repo = matchstr(uri, '[^:/]*/'.name)
|
|
let url = empty(sha) ? 'https://github.com/'.repo
|
|
\ : printf('https://github.com/%s/commit/%s', repo, sha)
|
|
call netrw#BrowseX(url, 0)
|
|
endfunction
|
|
|
|
augroup PlugGx
|
|
autocmd!
|
|
autocmd FileType vim-plug nnoremap <buffer> <silent> gx :call <sid>plug_gx()<cr>
|
|
augroup END
|