2020-11-02 04:08:18 +00:00
|
|
|
#!/bin/sh
|
2020-09-17 10:24:35 +00:00
|
|
|
|
2020-11-21 18:07:26 +00:00
|
|
|
set -e
|
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
|
|
|
|
2020-11-21 18:07:26 +00:00
|
|
|
log 'Setting up shell'
|
2020-09-17 10:24:35 +00:00
|
|
|
case "$PM" in
|
|
|
|
apt)
|
2021-01-17 07:30:01 +00:00
|
|
|
sudo add-apt-repository ppa:fish-shell/release-3 -y -n
|
2021-01-15 07:42:29 +00:00
|
|
|
pm_update
|
2020-12-17 08:08:47 +00:00
|
|
|
sudo apt install fish silversearcher-ag -y
|
2021-01-17 07:30:01 +00:00
|
|
|
echo DISTRIB_RELEASE_MAJOR: $DISTRIB_RELEASE_MAJOR
|
|
|
|
echo DISTRIB_RELEASE: $DISTRIB_RELEASE
|
2020-12-17 08:08:47 +00:00
|
|
|
if [ "$DISTRIB_RELEASE_MAJOR" -gt 19 ] || [ "$DISTRIB_RELEASE" = "19.10" ]; then
|
|
|
|
sudo apt install dash bat -y
|
|
|
|
fi
|
2021-01-17 07:30:01 +00:00
|
|
|
sudo ln -sf /usr/bin/batcat /usr/bin/bat
|
2020-11-21 18:07:26 +00:00
|
|
|
intorepo https://github.com/junegunn/fzf.git "$HOME/.fzf"
|
|
|
|
./install --all
|
|
|
|
exitrepo
|
2020-09-17 10:24:35 +00:00
|
|
|
;;
|
|
|
|
pacman)
|
2021-01-14 07:10:00 +00:00
|
|
|
sudo pacman -S --noconfirm --needed fish the_silver_searcher dash bat fzf
|
2020-10-31 06:27:44 +00:00
|
|
|
# prevent bash upgradation relink /bin/sh
|
|
|
|
sudo mkdir -p /etc/pacman.d/hooks
|
2020-11-21 18:07:26 +00:00
|
|
|
echo "
|
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
|
2020-11-21 18:07:26 +00:00
|
|
|
" | sed 's/^ *//' | sudo tee /etc/pacman.d/sh-is-dash.hook >/dev/null
|
2020-09-17 10:24:35 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-12-17 08:08:47 +00:00
|
|
|
|
2021-01-15 07:42:29 +00:00
|
|
|
# only for local machine with gui
|
|
|
|
if [ -z "$SSH_CLIENT" ] && [ -n "$DISPLAY" ] && has_cmd dash; then
|
2020-12-17 08:08:47 +00:00
|
|
|
log 'Setting up dash as default shell'
|
|
|
|
sudo /usr/bin/ln -sfT dash /usr/bin/sh
|
2020-11-23 02:00:49 +00:00
|
|
|
|
2020-12-17 08:08:47 +00:00
|
|
|
if [ "$(awk -F':' '/^'"$USER"'/{print $7}' /etc/passwd)" != "/bin/sh" ]; then
|
|
|
|
chsh -s /bin/sh
|
|
|
|
fi
|
2020-11-23 02:00:49 +00:00
|
|
|
fi
|
2020-10-31 06:27:44 +00:00
|
|
|
|
2020-09-17 10:24:35 +00:00
|
|
|
|
2020-11-21 18:07:26 +00:00
|
|
|
log 'Setting up fish'
|
|
|
|
lnsf "$DIR/fish/config.fish" "$XDG_CONFIG_HOME/fish/config.fish"
|
|
|
|
lnsf "$DIR/fish/functions/fish_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_prompt.fish"
|
|
|
|
lnsf "$DIR/fish/functions/fish_right_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish"
|
|
|
|
lnsf "$DIR/fish/functions/fisher.fish" "$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
|
|
|
lnsf "$DIR/fish/functions/r.fish" "$XDG_CONFIG_HOME/fish/functions/r.fish"
|
2021-03-02 02:52:31 +00:00
|
|
|
lnsf "$DIR/fish/functions/f.fish" "$XDG_CONFIG_HOME/fish/functions/f.fish"
|
2020-11-21 18:07:26 +00:00
|
|
|
lnsf "$DIR/fish/functions/append_paths.fish" "$XDG_CONFIG_HOME/fish/functions/append_paths.fish"
|
|
|
|
lnsf "$DIR/fish/functions/source_files.fish" "$XDG_CONFIG_HOME/fish/functions/source_files.fish"
|
2021-06-15 03:58:03 +00:00
|
|
|
lnsf "$DIR/fish/functions/git_clone_all.fish" "$XDG_CONFIG_HOME/fish/functions/git_clone_all.fish"
|
|
|
|
lnsf "$DIR/fish/functions/winip.fish" "$XDG_CONFIG_HOME/fish/functions/winip.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
|
|
|
|
2020-11-09 09:57:06 +00:00
|
|
|
# set color theme: Old School
|
|
|
|
fish -c '
|
|
|
|
set -L
|
|
|
|
set -U fish_color_normal normal
|
|
|
|
set -U fish_color_command 00FF00
|
|
|
|
set -U fish_color_quote 44FF44
|
|
|
|
set -U fish_color_redirection 7BFF7B
|
|
|
|
set -U fish_color_end FF7B7B
|
|
|
|
set -U fish_color_error A40000
|
|
|
|
set -U fish_color_param 30BE30
|
|
|
|
set -U fish_color_comment 30BE30
|
|
|
|
set -U fish_color_match --background=brblue
|
|
|
|
set -U fish_color_selection white --bold --background=brblack
|
|
|
|
set -U fish_color_search_match bryellow --background=brblack
|
|
|
|
set -U fish_color_history_current --bold
|
|
|
|
set -U fish_color_operator 00a6b2
|
|
|
|
set -U fish_color_escape 00a6b2
|
|
|
|
set -U fish_color_cwd green
|
|
|
|
set -U fish_color_cwd_root red
|
|
|
|
set -U fish_color_valid_path --underline
|
|
|
|
set -U fish_color_autosuggestion 777777
|
|
|
|
set -U fish_color_user brgreen
|
|
|
|
set -U fish_color_host normal
|
|
|
|
set -U fish_color_cancel -r
|
|
|
|
set -U fish_pager_color_completion normal
|
|
|
|
set -U fish_pager_color_description B3A06D yellow
|
|
|
|
set -U fish_pager_color_prefix white --bold --underline
|
|
|
|
set -U fish_pager_color_progress brwhite --background=cyan
|
2020-11-21 18:07:26 +00:00
|
|
|
' > /dev/null
|