diff --git a/install.sh b/install.sh index 4679444..f9e38ef 100755 --- a/install.sh +++ b/install.sh @@ -208,20 +208,21 @@ deploy_misc() { deploy_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" - 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" ensure_directory "$XDG_CONFIG_HOME/nvim/lua/fs" for f in nvim/lua/fs/*; do link "$DOTFILES/$f" "$XDG_CONFIG_HOME/$f"; done 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 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 error "neovim is not installed; skipping plugin installation..." fi diff --git a/nvim/after/plugin/lightline.lua b/nvim/after/plugin/lightline.lua new file mode 100644 index 0000000..70f053b --- /dev/null +++ b/nvim/after/plugin/lightline.lua @@ -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 = '' }, +} + diff --git a/nvim/lua/fs/plugins.lua b/nvim/lua/fs/plugins.lua index ee268a5..a52b16c 100644 --- a/nvim/lua/fs/plugins.lua +++ b/nvim/lua/fs/plugins.lua @@ -1,49 +1,36 @@ -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 jsonNumber Identifier - highlight link jsonBoolean 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' - let g:rainbow#pairs = [ ['(',')'], ['[',']'], ['{','}'] ] - Plug 'ctrlpvim/ctrlp.vim' - let g:ctrlp_match_window = 'bottom,order:ttb' - let g:ctrlp_switch_buffer = 0 " open files in new buffer - let g:ctrlp_show_hidden = 1 " show hidden files - Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } - Plug 'tpope/vim-commentary' - Plug 'itchyny/lightline.vim' - let 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': '' }, - \ } - Plug 'vim-scripts/srec.vim' +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([[ + highlight link jsonBraces Text + highlight link jsonNumber Identifier + highlight link jsonBoolean Identifier + highlight link jsonNull Identifier + ]]) + + use 'godlygeek/tabular' + use 'plasticboy/vim-markdown' + vim.g.vim_markdown_conceal_code_blocks = 0 + + use 'junegunn/rainbow_parentheses.vim' + vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} } + + use 'ctrlpvim/ctrlp.vim' + vim.g.ctrlp_match_window = 'bottom,order:ttb' + vim.g.ctrlp_switch_buffer = 0 -- open files in new buffer + vim.g.ctrlp_show_hidden = 1 -- show hidden files + + use { 'scrooloose/nerdtree', cmd = 'NERDTreeToggle' } + use 'tpope/vim-commentary' + use 'itchyny/lightline.vim' + use 'vim-scripts/srec.vim' + vim.cmd([[ highlight link srecStart Comment highlight link srecType Comment highlight link srecLength WarningMsg @@ -51,11 +38,26 @@ vim.cmd([[ highlight link srec24BitAddress Constant highlight link srec32BitAddress Constant 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 -]])