From 0d5c2923f071e1821d6d3b54ea40ec1562f11a4d Mon Sep 17 00:00:00 2001 From: pegasust Date: Tue, 22 Nov 2022 08:12:15 +0000 Subject: [PATCH] nvim: a bit better onboarding experience --- neovim/init.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/neovim/init.lua b/neovim/init.lua index 43f1602..d44671c 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -13,17 +13,17 @@ local data_dir = vim.fn.stdpath('data') vim.cmd([[ let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' -if empty(glob(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' +let plug_path = data_dir . '/autoload/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 -autocmd VimEnter * PlugInstall --sync | source $MYVIMRC ]]) --- + -- vim-plug local Plug = vim.fn['plug#'] --- TODO: Change this to relative datadir -vim.call('plug#begin', '~/.config/nvim/plugged') +vim.call('plug#begin') -- libs and dependencies Plug('nvim-lua/plenary.nvim') @@ -87,7 +87,11 @@ Plug('mickael-menu/zk-nvim') -- Zettelkasten --------- 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([[ set number relativenumber @@ -101,7 +105,6 @@ set scrolloff=30 set signcolumn=yes set colorcolumn=80 set background=light - ]]) vim.opt.lazyredraw = true vim.opt.termguicolors = true @@ -889,4 +892,3 @@ vim.cmd([[ let g:conjure#mapping#doc_word = v:false ]]) -