Skip to content

Instantly share code, notes, and snippets.

@pipopotamasu
Last active March 19, 2019 15:31
Show Gist options
  • Save pipopotamasu/3f8c8bf82f41736d71d8aaba9c7d86ba to your computer and use it in GitHub Desktop.
Save pipopotamasu/3f8c8bf82f41736d71d8aaba9c7d86ba to your computer and use it in GitHub Desktop.
alias ll="ls -la"
if not functions -q fisher
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
curl https://git.io/fisher --create-dirs -sLo $XDG_CONFIG_HOME/fish/functions/fisher.fish
fish -c fisher
end
status --is-interactive; and source (rbenv init -|psub)
function g --wraps git
git $argv
end
function dc --wraps docker-compose
docker-compose $argv
end
function d --wraps docker
docker $argv
end
function fish_user_key_bindings
bind \cr 'peco_select_history (commandline -b)'
end
function fish_prompt --description 'Write out the prompt'
# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q __fish_prompt_hostname
#set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
set -g __fish_prompt_hostname
end
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end
if not set -q __git_cb
set __git_cb ":"(set_color brown)(git branch ^/dev/null | grep \* | sed 's/* //')(set_color normal)""
end
switch $USER
case root
if not set -q __fish_prompt_cwd
if set -q fish_color_cwd_root
set -g __fish_prompt_cwd (set_color $fish_color_cwd_root)
else
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
end
end
printf '%s@%s:%s%s%s%s# ' $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $__git_cb
case '*'
if not set -q __fish_prompt_cwd
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
end
printf '%s@%s:%s%s%s%s$ ' $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $__git_cb
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment