2020-11-02 04:08:18 +00:00
|
|
|
#!/bin/sh
|
2020-09-17 10:24:35 +00:00
|
|
|
|
2020-11-08 16:26:14 +00:00
|
|
|
DIR=$(dirname "$(readlink -f "$0")")
|
2020-11-02 04:08:18 +00:00
|
|
|
. "$DIR/../env.sh"
|
2020-09-17 10:24:35 +00:00
|
|
|
|
|
|
|
# install fish shell
|
2020-09-17 16:02:24 +00:00
|
|
|
echo Installing fish shell
|
2020-09-17 10:24:35 +00:00
|
|
|
case "$PM" in
|
|
|
|
apt)
|
2020-11-04 06:05:09 +00:00
|
|
|
! command -v pip3 && "$PDIR/python/install.sh"
|
2020-09-17 10:24:35 +00:00
|
|
|
sudo add-apt-repository ppa:fish-shell/release-3 -y
|
|
|
|
sudo apt update
|
2020-10-31 06:27:44 +00:00
|
|
|
sudo apt install fish libnotify-bin xdotool silversearcher-ag dash -y
|
2020-11-02 13:43:09 +00:00
|
|
|
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
|
|
|
~/.fzf/install
|
2020-09-17 10:24:35 +00:00
|
|
|
;;
|
|
|
|
pacman)
|
2020-10-31 06:27:44 +00:00
|
|
|
sudo pacman -S --needed --needed fish xdotool fzf the_silver_searcher dash
|
|
|
|
# prevent bash upgradation relink /bin/sh
|
|
|
|
sudo mkdir -p /etc/pacman.d/hooks
|
2020-10-31 18:06:44 +00:00
|
|
|
cat <<' EOT' | sed 's/^ *//' | sudo tee /etc/pacman.d/sh-is-dash.hook
|
2020-10-31 06:27:44 +00:00
|
|
|
[Trigger]
|
|
|
|
Type = Package
|
|
|
|
Operation = Install
|
|
|
|
Operation = Upgrade
|
|
|
|
Target = bash
|
|
|
|
|
|
|
|
[Action]
|
|
|
|
Description = Re-pointing /bin/sh symlink to dash...
|
|
|
|
When = PostTransaction
|
|
|
|
Exec = /usr/bin/ln -sfT dash /usr/bin/sh
|
|
|
|
Depends = dash
|
|
|
|
EOT
|
2020-09-17 10:24:35 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-10-31 06:27:44 +00:00
|
|
|
# use dash as default shell because it much faster and will be used vim-fugitive,
|
2020-11-02 04:08:18 +00:00
|
|
|
# leads to a much faster responsive speed
|
2020-10-31 06:27:44 +00:00
|
|
|
sudo /usr/bin/ln -sfT dash /usr/bin/sh
|
2020-11-08 16:57:55 +00:00
|
|
|
[ "$(awk -F':' '/^'"$USER"'/{print $7}' /etc/passwd)" != "/bin/sh" ] && chsh -s /bin/sh
|
2020-10-31 06:27:44 +00:00
|
|
|
|
2020-09-17 10:24:35 +00:00
|
|
|
|
|
|
|
# symlink config
|
2020-11-02 04:08:18 +00:00
|
|
|
[ -L "$XDG_CONFIG_HOME/fish" ] && rm -rf "$XDG_CONFIG_HOME/fish"
|
2020-09-17 16:02:24 +00:00
|
|
|
|
2020-11-02 04:08:18 +00:00
|
|
|
lnsf "$DIR/config/config.fish" "$XDG_CONFIG_HOME/fish/config.fish"
|
|
|
|
lnsf "$DIR/config/functions/fish_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_prompt.fish"
|
|
|
|
lnsf "$DIR/config/functions/fish_right_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish"
|
|
|
|
lnsf "$DIR/config/functions/fisher.fish" "$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
2020-09-18 18:01:58 +00:00
|
|
|
|
2020-10-23 03:48:19 +00:00
|
|
|
# install plugins
|
2020-11-04 07:22:15 +00:00
|
|
|
# for better keybinding: C-o open file with $EDITOR / C-r search history / C-g open with xdg-open
|
|
|
|
fish -c "fisher add jethrokuan/fzf"
|
2020-10-23 03:48:19 +00:00
|
|
|
|