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 @@
vim.cmd([[ local plugins = function(use)
call plug#begin('~/.local/share/nvim/plugged') use 'wbthomason/packer.nvim'
Plug 'altercation/vim-colors-solarized'
Plug 'bronson/vim-trailing-whitespace' use 'altercation/vim-colors-solarized'
Plug 'elzr/vim-json' use 'bronson/vim-trailing-whitespace'
" Disable quote concealling. use 'elzr/vim-json'
let g:vim_json_syntax_conceal = 0 -- Disable quote concealling.
" Make numbers and booleans stand out. vim.g.vim_json_syntax_conceal = 0
highlight link jsonBraces Text -- Make numbers and booleans stand out.
highlight link jsonNumber Identifier vim.cmd([[
highlight link jsonBoolean Identifier highlight link jsonBraces Text
highlight link jsonNull Identifier highlight link jsonNumber Identifier
Plug 'godlygeek/tabular' | Plug 'plasticboy/vim-markdown' highlight link jsonBoolean Identifier
let g:vim_markdown_conceal_code_blocks = 0 highlight link jsonNull Identifier
Plug 'junegunn/rainbow_parentheses.vim' ]])
let g:rainbow#pairs = [ ['(',')'], ['[',']'], ['{','}'] ]
Plug 'ctrlpvim/ctrlp.vim' use 'godlygeek/tabular'
let g:ctrlp_match_window = 'bottom,order:ttb' use 'plasticboy/vim-markdown'
let g:ctrlp_switch_buffer = 0 " open files in new buffer vim.g.vim_markdown_conceal_code_blocks = 0
let g:ctrlp_show_hidden = 1 " show hidden files
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } use 'junegunn/rainbow_parentheses.vim'
Plug 'tpope/vim-commentary' vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} }
Plug 'itchyny/lightline.vim'
let g:lightline = { use 'ctrlpvim/ctrlp.vim'
\ 'colorscheme': 'solarized', vim.g.ctrlp_match_window = 'bottom,order:ttb'
\ 'active': { vim.g.ctrlp_switch_buffer = 0 -- open files in new buffer
\ 'left': [ ['mode','paste'],[],['ro','modified','path'] ], vim.g.ctrlp_show_hidden = 1 -- show hidden files
\ 'right': [ ['percent'],['lineinfo'],['ft','fenc','ff'] ],
\ }, use { 'scrooloose/nerdtree', cmd = 'NERDTreeToggle' }
\ 'inactive': { use 'tpope/vim-commentary'
\ 'left': [ ['paste'],['ro','modified','path'] ], use 'itchyny/lightline.vim'
\ 'right': [ ['percent'],['lineinfo'] ], use 'vim-scripts/srec.vim'
\ }, vim.cmd([[
\ '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
highlight NonText cterm=NONE ctermfg=10 " subtle EOL symbols
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)
silent! colorscheme solarized
highlight NonText cterm=NONE ctermfg=10 " subtle EOL symbols
highlight Whitespace cterm=NONE ctermfg=9 " orange listchars
]])