dotfiles/cli/nnn.sh

41 lines
1.3 KiB
Bash
Raw Normal View History

2021-09-30 05:54:42 +00:00
#!/bin/sh
set -e
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
log 'Setting up nnn'
2021-11-10 13:00:57 +00:00
NNN_CONFIG_DIR="$XDG_CONFIG_HOME/nnn"
2021-10-09 15:19:35 +00:00
2022-05-03 15:20:26 +00:00
download_nnn_plugins() {
mkdir -p "$NNN_CONFIG_DIR/plugins"
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/fzcd" https://github.com/jarun/nnn/raw/master/plugins/fzcd
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/preview-tui" https://github.com/jarun/nnn/raw/master/plugins/preview-tui
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/dragdrop" https://github.com/jarun/nnn/raw/master/plugins/dragdrop
chmod +x $NNN_CONFIG_DIR/plugins/*
}
2021-09-30 05:54:42 +00:00
# setup package mirror for CHINA
case "$PM" in
apt)
2021-10-09 15:19:35 +00:00
mkdir -p ~/.local/bin
HTTPS_PROXY=$GITHUB_PROXY curl -Lo /tmp/nnn.tar.gz https://github.com/jarun/nnn/releases/download/v4.3/nnn-static-4.3.x86_64.tar.gz
cd /tmp
tar zxvf nnn.tar.gz
mv nnn-static ~/.local/bin/nnn
rm -rf nnn.tar.gz
cd -
2022-05-03 15:20:26 +00:00
download_nnn_plugins
2021-09-30 05:54:42 +00:00
;;
pacman)
2022-05-19 04:24:03 +00:00
sudo pacman -S --noconfirm --needed nnn ueberzug
mkdir -p "$NNN_CONFIG_DIR/plugins"
cp -r /usr/share/nnn/plugins/* "$NNN_CONFIG_DIR/plugins"
2022-09-24 07:59:11 +00:00
yay -S dragon-drop
2022-05-03 15:20:26 +00:00
;;
2021-09-30 05:54:42 +00:00
esac
# configuration
lnsf "$DIR/nnn/n.fish" "$XDG_CONFIG_HOME/fish/functions/n.fish"