dotfiles/cli/nnn.sh

33 lines
1012 B
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
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 -
2021-11-10 13:00:57 +00:00
mkdir -p "$NNN_CONFIG_DIR/plugins"
2021-10-09 15:19:35 +00:00
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
2021-09-30 05:54:42 +00:00
;;
pacman)
sudo pacman -S --noconfirm --needed nnn
2021-10-09 15:19:35 +00:00
cp -r /usr/share/nnn/plugins/. "$NNN_CONFIG_DIR"
2021-09-30 05:54:42 +00:00
esac
# configuration
lnsf "$DIR/nnn/n.fish" "$XDG_CONFIG_HOME/fish/functions/n.fish"