From b6a2bf5a81c659aa4f42c87ee97c4198890a6711 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 10 Aug 2024 14:29:20 -0400 Subject: Update vim config --- install.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index 658c55a..df09f8f 100755 --- a/install.sh +++ b/install.sh @@ -50,7 +50,7 @@ ensure_symlink_exists() { prompt_for_confirmation "Delete and relink?" answer=$? if [ $answer -eq 0 ]; then - rm "$link_path" || exit 1 + rm -r "$link_path" || exit 1 ln -s "$source_path" "$link_path" || exit 1 echo "Successfully created link to '$link_path'" else @@ -62,7 +62,7 @@ ensure_symlink_exists() { prompt_for_confirmation "Delete and relink?" answer=$? if [ $answer -eq 0 ]; then - rm "$link_path" || exit 1 + rm -r "$link_path" || exit 1 ln -s "$source_path" "$link_path" || exit 1 echo "Successfully created link to '$link_path'" else @@ -74,6 +74,16 @@ ensure_symlink_exists() { fi } +install_packer() { + echo "Installing packer.nvim.." + if [ ! -d "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then + git clone --depth 1 https://github.com/wbthomason/packer.nvim \ + "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" + else + echo "packer.nvim is already installed." + fi +} + main() { has_homebrew=$(command -v brew) if test -z "$has_homebrew"; then @@ -106,17 +116,11 @@ main() { echo "Linking vim config.." mkdir -p $HOME/.config/nvim - ensure_symlink_exists "$PWD/.config/nvim/init.vim" "$HOME/.config/nvim/init.vim" + ensure_symlink_exists "$PWD/.config/nvim/init.lua" "$HOME/.config/nvim/init.lua" - echo "Checking vim-plug installation.." - if [ -e "$HOME/.config/nvim/plugged" ]; then - echo "vim-plug already installed" - else - echo "Installing vim-plug.." - sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - nvim +PlugInstall +qall --headless - fi + install_packer + echo "Running PackerSync to install plugins.." + nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' } main -- cgit v1.2.3