From 65f913310a0704b80541b3ea1721aec703415347 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Sun, 2 Apr 2023 19:27:03 +0200 Subject: [PATCH] Prepare for nvim --- .bin/.e | 10 +++++++++- .bin/autoinstall | 7 ++++--- .config/aliasrc | 2 ++ .config/environment | 1 + 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.bin/.e b/.bin/.e index 89368c1..4cf8ff3 100755 --- a/.bin/.e +++ b/.bin/.e @@ -13,6 +13,8 @@ declare -A mapper=( ["git"]="$HOME/.config/git/config" ["git-ignore"]="$HOME/.config/git/ignore" ["home-manager"]="$HOME/.config/nixpkgs/home.nix" + ["nvim"]="$HOME/.config/nvim/" + ["nvim.packer"]="$HOME/.config/nvim/lua/user/packer.lua" ["polybar"]="$HOME/.config/polybar" ["qutebrowser"]="$HOME/.config/qutebrowser/common.py" ["starship"]="$HOME/.config/starship.toml" @@ -37,7 +39,13 @@ fi target="${mapper["$1"]}" if [ -n "$target" ] then - $EDITOR "$target" + if [ -d "$target" ] + then + cd "$target" + $EDITOR . + else + $EDITOR "$target" + fi else echo "Dotfile not found. Use --list (-l) to show all options." fi diff --git a/.bin/autoinstall b/.bin/autoinstall index 2eeb1b8..0295d28 100755 --- a/.bin/autoinstall +++ b/.bin/autoinstall @@ -5,8 +5,9 @@ _autoinstall_base () { "$HOME/.config/vim/autoload/plug.vim" \ && [ -x "$(command -v vim)" ] && yes | vim +'PlugInstall --sync' +qa --not-a-term - #_autoinstall_git "https://github.com/AstroNvim/AstroNvim" "$HOME/.config/nvim" \ - # && [ -x "$(command -v nvim)" ] && nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' + _autoinstall_git "https://github.com/wbthomason/packer.nvim" \ + "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" \ + && [ -x "$(command -v nvim)" ] && nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' [ ! -x "$(command -v starship)" ] \ && curl -sS "https://starship.rs/install.sh" | BIN_DIR="$HOME/.local/bin" FORCE=1 sh @@ -67,7 +68,7 @@ _autoinstall_git () { then echo "Installing repo $1 to $2" mkdir -p "$2" - git clone "$1" "$2" >/dev/null 2>&1 + git clone --depth=1 "$1" "$2" >/dev/null 2>&1 return 0 fi return 1 diff --git a/.config/aliasrc b/.config/aliasrc index 1158689..812decf 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -77,6 +77,8 @@ alias xdebug='XDEBUG_CONFIG="remote_host=127.0.0.1 remote_port=9003"' [ -x "$(command -v moar)" ] && alias less='moar' +[ -x "$(command -v nvim)" ] && alias vim='nvim' + [ -x "$(command -v rmtrash)" ] && alias rm='rmtrash' [ -x "$(command -v rmdirtrash)" ] && alias rmdir='rmdirtrash' diff --git a/.config/environment b/.config/environment index 58f38bd..0b1ff40 100644 --- a/.config/environment +++ b/.config/environment @@ -28,6 +28,7 @@ export DOCKER_BUILDKIT=1 export DRONE_SERVER='https://ci.serguzim.me' _editor="$(which vim)" +[ -x "$(command -v nvim)" ] && _editor="$(which nvim)" export EDITOR="$_editor" export GOPATH="$XDG_DATA_HOME/go"