Add installvimplugins script

This commit is contained in:
Rob Watson 2021-03-31 11:53:33 +02:00
parent f1317adff8
commit fc24d65225
2 changed files with 40 additions and 25 deletions

21
script/installvimplugins Executable file
View File

@ -0,0 +1,21 @@
#/usr/bin/env bash
set -e
# Special case for fzf.vim plugin file:
# Note: not currently updated automatically
url="https://raw.githubusercontent.com/junegunn/fzf/master/plugin/fzf.vim"
echo "Fetching $url..."
mkdir -p $HOME/.vim/plugin
curl -sL -o $HOME/.vim/plugin/fzf.vim https://raw.githubusercontent.com/junegunn/fzf/master/plugin/fzf.vim
# Relies on vimrc containing lines e.g.:
# packadd! rust.vim " https://github.com/rust-lang/rust.vim.git
pluginhome=$HOME/.vim/pack/git-plugins/opt
mkdir -p $pluginhome
cd $pluginhome
grep packadd! $HOME/.vimrc | grep -oP 'https.*$' | while read -r url ; do
echo "Cloning $url.."
git clone --quiet --depth=1 "$url"
done

44
vimrc
View File

@ -78,6 +78,7 @@ if exists('+termguicolors')
endif endif
" Colour scheme: " Colour scheme:
packadd! nord-vim " https://github.com/arcticicestudio/nord-vim.git
colorscheme nord colorscheme nord
augroup vimrc augroup vimrc
@ -145,7 +146,9 @@ nmap <silent> <leader>q :call ToggleQuickFix()<cr>
nmap <silent> <leader>l :lclose<cr> nmap <silent> <leader>l :lclose<cr>
" deoplete configuration " deoplete configuration
packadd! deoplete.nvim packadd! vim-hug-neovim-rpc " https://github.com/roxma/vim-hug-neovim-rpc.git
packadd! nvim-yarp " https://github.com/roxma/nvim-yarp.git
packadd! deoplete.nvim " https://github.com/Shougo/deoplete.nvim.git
" Disable completion messages: " Disable completion messages:
set shortmess+=c set shortmess+=c
let g:deoplete#enable_at_startup = 1 let g:deoplete#enable_at_startup = 1
@ -175,7 +178,7 @@ nmap <leader>b :Buffers<cr>
nmap <leader>gg :Rg<cr> nmap <leader>gg :Rg<cr>
" Lightline configuration: " Lightline configuration:
packadd! lightline.vim packadd! lightline.vim " https://github.com/itchyny/lightline.vim.git
set laststatus=2 set laststatus=2
function! LightlineLSPErrorText() function! LightlineLSPErrorText()
@ -232,7 +235,7 @@ let g:lightline = {
\ } \ }
" vim-gitgutter configuration " vim-gitgutter configuration
packadd! vim-gitgutter packadd! vim-gitgutter " https://github.com/airblade/vim-gitgutter.git
set signcolumn=yes set signcolumn=yes
nmap ]h <Plug>(GitGutterNextHunk) nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk) nmap [h <Plug>(GitGutterPrevHunk)
@ -241,30 +244,18 @@ omap ah <Plug>(GitGutterTextObjectOuterPending)
xmap ih <Plug>(GitGutterTextObjectInnerVisual) xmap ih <Plug>(GitGutterTextObjectInnerVisual)
xmap ah <Plug>(GitGutterTextObjectOuterVisual) xmap ah <Plug>(GitGutterTextObjectOuterVisual)
" Vim-Rust configuration:
let g:rustfmt_autosave = 1
" echodoc configuration:
set cmdheight=1
set noshowmode
let g:echodoc#type='echo'
let g:echodoc#enable_at_startup = 1
packadd! echodoc.vim
" vim-fugitive " vim-fugitive
" load before LSP to ensure it doesn't clobber signcolumn packadd! vim-fugitive " https://github.com/tpope/vim-fugitive.git
packadd! vim-fugitive
" vim-go " vim-go
" Doesn't work in after/ftplugin/go.vim: " Doesn't work in after/ftplugin/go.vim:
let g:go_def_mapping_enabled = 0 let g:go_def_mapping_enabled = 0
" load before LSP to ensure it doesn't clobber mappings packadd! vim-go " https://github.com/fatih/vim-go.git
packadd! vim-go
" LSP configuration: " LSP configuration:
packadd! vim-lsp packadd! vim-lsp " https://github.com/prabirshrestha/vim-lsp.git
packadd! vim-lsp-settings packadd! vim-lsp-settings " https://github.com/mattn/vim-lsp-settings.git
packadd! deoplete-vim-lsp packadd! deoplete-vim-lsp " https://github.com/lighttiger2505/deoplete-vim-lsp.git
let g:lsp_settings = { let g:lsp_settings = {
\ 'gopls': { \ 'gopls': {
@ -343,11 +334,14 @@ augroup END
runtime macros/matchit.vim runtime macros/matchit.vim
" load other plugins: " load other plugins:
" packadd! tmux-complete.vim packadd! rust.vim " https://github.com/rust-lang/rust.vim.git
packadd! vim-commentary packadd! tmux-complete.vim " https://github.com/wellle/tmux-complete.vim.git
packadd! vim-commentary " https://github.com/tpope/vim-commentary.git
" Requires both fzf.vim plugin to be manually installed: " Requires both fzf.vim plugin to be manually installed:
" https://github.com/junegunn/fzf/blob/master/plugin/fzf.vim " https://github.com/junegunn/fzf/blob/master/plugin/fzf.vim
" and also this separate plugin, which is loaded here: " and also this separate plugin, which is loaded here:
packadd! fzf.vim packadd! fzf.vim " https://github.com/junegunn/fzf.vim.git
packadd! vim-surround packadd! vim-surround " https://github.com/tpope/vim-surround.git
packadd! vim-yaml-folds packadd! vim-rhubarb " https://github.com/tpope/vim-rhubarb.git
packadd! editorconfig-vim " https://github.com/editorconfig/editorconfig-vim.git