From 27e1771b99bf74a9509528b77eae5f3882bc96f0 Mon Sep 17 00:00:00 2001 From: Rack Lin Date: Sun, 29 May 2022 18:34:28 +0800 Subject: [PATCH] feat(fish): add fish-shell --- README.md | 4 ++++ fish/config-linux.fish | 7 +++++++ fish/config-osx.fish | 21 ++++++++++++++++++++ fish/config-windows.fish | 0 fish/config.fish | 43 ++++++++++++++++++++++++++++++++++++++++ fish/fish_plugins | 4 ++++ 6 files changed, 79 insertions(+) create mode 100644 fish/config-linux.fish create mode 100644 fish/config-osx.fish create mode 100644 fish/config-windows.fish create mode 100644 fish/config.fish create mode 100644 fish/fish_plugins diff --git a/README.md b/README.md index ac53563..8fc8e35 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ That’s it! we have successfully created a symlink for `.gitconfig` ,and a syml ### zsh `stow --dotfiles -vSt ~ zsh` +### fish shell +`mkdir ~/.config/fish` +`stow --dotfiles -vSt ~/.config/fish fish` + ### tmux `stow --dotfiles -vSt ~ tmux` diff --git a/fish/config-linux.fish b/fish/config-linux.fish new file mode 100644 index 0000000..9f7ca20 --- /dev/null +++ b/fish/config-linux.fish @@ -0,0 +1,7 @@ +if type -q exa + alias ls "exa -g --icons --classify" + alias lsa "ls -a" + alias ll "exa -l -g --icons --classify" + alias lla "ll -a" +end + diff --git a/fish/config-osx.fish b/fish/config-osx.fish new file mode 100644 index 0000000..1b071a8 --- /dev/null +++ b/fish/config-osx.fish @@ -0,0 +1,21 @@ +if type -q exa + alias ls "exa -g --icons --classify" + alias lsa "ls -a" + alias ll "exa -l -g --icons --classify" + alias lla "ll -a" +end + +if type -q ghq + alias ghqcd="cd \$(ghq list --full-path | fzf)" +end + +if type -q docker + + # PHP in container + alias dcomposer="docker run --rm --interactive --tty --volume \$PWD:/app --volume \$HOME/.composer:/tmp composer:latest composer" + alias dphp="docker run --rm --interactive --tty --volume \$PWD:/app --volume /Users:/Users composer:latest php" + alias dphp8="docker run --rm --interactive --tty --volume \$PWD:/app composer:latest php" + alias dphp7="docker run --rm --interactive --tty --volume \$PWD:/app --workdir /app php:7.4-cli php" + alias dlaravel="docker run --rm --interactive --tty --volume \$PWD:/app --volume \$HOME/.composer:/tmp composer:latest /tmp/vendor/bin/laravel" + +end diff --git a/fish/config-windows.fish b/fish/config-windows.fish new file mode 100644 index 0000000..e69de29 diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..274c1a4 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,43 @@ +if status is-interactive + # Commands to run in interactive sessions can go here + set fish_greeting "" + set -gx TERM xterm-256color + + # theme + set -g theme_color_scheme dracula + set -g fish_prompt_pwd_dir_length 1 + set -g theme_display_user yes + set -g theme_hide_hostname no + set -g theme_hostname always + + # set default editor to nvim + set -gx EDITOR nvim + + fzf_configure_bindings + + # starship prompt + switch (uname) + case Darwin + if test -x /opt/homebrew/bin/starship; + /opt/homebrew/bin/starship init fish | source + end + case Linux + case '*' + end + +end + +# set PATH and load os-specify config +switch (uname) + case Darwin + if test -x /opt/homebrew/bin/brew; + eval "$(/opt/homebrew/bin/brew shellenv)" + set -gx PATH ~/bin $PATH + source (dirname (status --current-filename))/config-osx.fish + end + case Linux + source (dirname (status --current-filename))/config-linux.fish + case '*' + source (dirname (status --current-filename))/config-windows.fish +end + diff --git a/fish/fish_plugins b/fish/fish_plugins new file mode 100644 index 0000000..6b74bc0 --- /dev/null +++ b/fish/fish_plugins @@ -0,0 +1,4 @@ +PatrickF1/fzf.fish +jethrokuan/z +jorgebucaran/autopair.fish +dracula/fish