nvim: a bit better onboarding experience

nix-components
pegasust 2022-11-22 08:12:15 +00:00
parent 9cd17eea5f
commit 0d5c2923f0
1 changed files with 11 additions and 9 deletions

View File

@ -13,17 +13,17 @@
local data_dir = vim.fn.stdpath('data') local data_dir = vim.fn.stdpath('data')
vim.cmd([[ vim.cmd([[
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim')) let plug_path = data_dir . '/autoload/plug.vim'
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' if empty(glob(plug_path))
execute '!curl -fLo '.plug_path.' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
execute 'so '.plug_path
endif endif
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
]]) ]])
--
-- vim-plug -- vim-plug
local Plug = vim.fn['plug#'] local Plug = vim.fn['plug#']
-- TODO: Change this to relative datadir vim.call('plug#begin')
vim.call('plug#begin', '~/.config/nvim/plugged')
-- libs and dependencies -- libs and dependencies
Plug('nvim-lua/plenary.nvim') Plug('nvim-lua/plenary.nvim')
@ -87,7 +87,11 @@ Plug('mickael-menu/zk-nvim') -- Zettelkasten
--------- ---------
vim.call('plug#end') vim.call('plug#end')
vim.cmd([[
if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | autocmd VimEnter * so $MYVIMRC
\| endif
]])
vim.cmd([[ vim.cmd([[
set number relativenumber set number relativenumber
@ -101,7 +105,6 @@ set scrolloff=30
set signcolumn=yes set signcolumn=yes
set colorcolumn=80 set colorcolumn=80
set background=light set background=light
]]) ]])
vim.opt.lazyredraw = true vim.opt.lazyredraw = true
vim.opt.termguicolors = true vim.opt.termguicolors = true
@ -889,4 +892,3 @@ vim.cmd([[
let g:conjure#mapping#doc_word = v:false let g:conjure#mapping#doc_word = v:false
]]) ]])