vim: replace vim-plug with packer.nvim

This commit is contained in:
Fernando Schauenburg 2021-11-16 17:18:56 +01:00
parent b31dcac34e
commit e1753e4f55
3 changed files with 84 additions and 58 deletions

View file

@ -208,20 +208,21 @@ deploy_misc() {
deploy_nvim() { deploy_nvim() {
heading 'nvim' heading 'nvim'
ensure_directory "$XDG_CONFIG_HOME/nvim/autoload"
ensure_directory "$XDG_DATA_HOME/nvim/plugged"
ensure_directory "$XDG_DATA_HOME/nvim/shada"
remove_file "$XDG_CONFIG_HOME/nvim/init.vim" remove_file "$XDG_CONFIG_HOME/nvim/init.vim"
link "$DOTFILES/nvim/plug.vim" "$XDG_CONFIG_HOME/nvim/autoload/plug.vim" ensure_directory "$XDG_DATA_HOME/nvim/shada"
link "$DOTFILES/nvim/init.lua" "$XDG_CONFIG_HOME/nvim/init.lua" link "$DOTFILES/nvim/init.lua" "$XDG_CONFIG_HOME/nvim/init.lua"
ensure_directory "$XDG_CONFIG_HOME/nvim/lua/fs" ensure_directory "$XDG_CONFIG_HOME/nvim/lua/fs"
for f in nvim/lua/fs/*; do link "$DOTFILES/$f" "$XDG_CONFIG_HOME/$f"; done for f in nvim/lua/fs/*; do link "$DOTFILES/$f" "$XDG_CONFIG_HOME/$f"; done
unset f unset f
ensure_directory "$XDG_CONFIG_HOME/nvim/after/plugin"
for f in nvim/after/plugin/*; do link "$DOTFILES/$f" "$XDG_CONFIG_HOME/$f"; done
unset f
if command -v nvim >/dev/null 2>&1; then if command -v nvim >/dev/null 2>&1; then
warn "installing neovim plugins..." warn "installing neovim plugins..."
dry_run || nvim -nes -u "$XDG_CONFIG_HOME/nvim/init.vim" -c 'PlugInstall | qall!' dry_run || nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
else else
error "neovim is not installed; skipping plugin installation..." error "neovim is not installed; skipping plugin installation..."
fi fi

View file

@ -0,0 +1,23 @@
vim.g.lightline = {
colorscheme = 'solarized',
active = {
left = { {'mode','paste'}, {}, {'ro','modified','path'} },
right = { {'percent'}, {'lineinfo'}, {'ft','fenc','ff'} },
},
inactive = {
left = { {'paste'}, {'ro','modified','path'} },
right = { {'percent'}, {'lineinfo'} },
},
component = {
fenc = '%{&fenc!=#""?&fenc:&enc}',
ff = '%{&ff}',
ft = '%{&ft!=#""?&ft:"?"}',
modified = '%M',
paste = '%{&paste?"PASTE":""}',
path = '%f',
percent = '%3p%%×%L',
ro = '%R',
},
subseparator = { left = '', right = '' },
}

View file

@ -1,49 +1,36 @@
local plugins = function(use)
use 'wbthomason/packer.nvim'
use 'altercation/vim-colors-solarized'
use 'bronson/vim-trailing-whitespace'
use 'elzr/vim-json'
-- Disable quote concealling.
vim.g.vim_json_syntax_conceal = 0
-- Make numbers and booleans stand out.
vim.cmd([[ vim.cmd([[
call plug#begin('~/.local/share/nvim/plugged')
Plug 'altercation/vim-colors-solarized'
Plug 'bronson/vim-trailing-whitespace'
Plug 'elzr/vim-json'
" Disable quote concealling.
let g:vim_json_syntax_conceal = 0
" Make numbers and booleans stand out.
highlight link jsonBraces Text highlight link jsonBraces Text
highlight link jsonNumber Identifier highlight link jsonNumber Identifier
highlight link jsonBoolean Identifier highlight link jsonBoolean Identifier
highlight link jsonNull Identifier highlight link jsonNull Identifier
Plug 'godlygeek/tabular' | Plug 'plasticboy/vim-markdown' ]])
let g:vim_markdown_conceal_code_blocks = 0
Plug 'junegunn/rainbow_parentheses.vim' use 'godlygeek/tabular'
let g:rainbow#pairs = [ ['(',')'], ['[',']'], ['{','}'] ] use 'plasticboy/vim-markdown'
Plug 'ctrlpvim/ctrlp.vim' vim.g.vim_markdown_conceal_code_blocks = 0
let g:ctrlp_match_window = 'bottom,order:ttb'
let g:ctrlp_switch_buffer = 0 " open files in new buffer use 'junegunn/rainbow_parentheses.vim'
let g:ctrlp_show_hidden = 1 " show hidden files vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} }
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-commentary' use 'ctrlpvim/ctrlp.vim'
Plug 'itchyny/lightline.vim' vim.g.ctrlp_match_window = 'bottom,order:ttb'
let g:lightline = { vim.g.ctrlp_switch_buffer = 0 -- open files in new buffer
\ 'colorscheme': 'solarized', vim.g.ctrlp_show_hidden = 1 -- show hidden files
\ 'active': {
\ 'left': [ ['mode','paste'],[],['ro','modified','path'] ], use { 'scrooloose/nerdtree', cmd = 'NERDTreeToggle' }
\ 'right': [ ['percent'],['lineinfo'],['ft','fenc','ff'] ], use 'tpope/vim-commentary'
\ }, use 'itchyny/lightline.vim'
\ 'inactive': { use 'vim-scripts/srec.vim'
\ 'left': [ ['paste'],['ro','modified','path'] ], vim.cmd([[
\ 'right': [ ['percent'],['lineinfo'] ],
\ },
\ 'component': {
\ 'fenc': '%{&fenc!=#""?&fenc:&enc}',
\ 'ff': '%{&ff}',
\ 'ft': '%{&ft!=#""?&ft:"?"}',
\ 'modified': '%M',
\ 'paste': '%{&paste?"PASTE":""}',
\ 'path': '%f',
\ 'percent': '%3p%%×%L',
\ 'ro': '%R',
\ },
\ 'subseparator': { 'left': '', 'right': '' },
\ }
Plug 'vim-scripts/srec.vim'
highlight link srecStart Comment highlight link srecStart Comment
highlight link srecType Comment highlight link srecType Comment
highlight link srecLength WarningMsg highlight link srecLength WarningMsg
@ -51,11 +38,26 @@ vim.cmd([[
highlight link srec24BitAddress Constant highlight link srec24BitAddress Constant
highlight link srec32BitAddress Constant highlight link srec32BitAddress Constant
highlight link srecChecksum Type highlight link srecChecksum Type
Plug 'keith/swift.vim' ]])
Plug 'chr4/nginx.vim'
call plug#end()
use 'keith/swift.vim'
use 'chr4/nginx.vim'
vim.cmd([[
silent! colorscheme solarized silent! colorscheme solarized
highlight NonText cterm=NONE ctermfg=10 " subtle EOL symbols highlight NonText cterm=NONE ctermfg=10 " subtle EOL symbols
highlight Whitespace cterm=NONE ctermfg=9 " orange listchars highlight Whitespace cterm=NONE ctermfg=9 " orange listchars
]]) ]])
end
local packer = function()
local path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if vim.fn.empty(vim.fn.glob(path)) > 0 then
local url = 'https://github.com/wbthomason/packer.nvim'
vim.fn.system({'git', 'clone', '--depth', '1', url, path})
end
return require('packer')
end
return packer().startup(plugins)