Created
February 5, 2020 16:33
-
-
Save saikocat/eb073ff4c7f7e3bab7488d3d04271795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file contains fish universal variable definitions. | |
# VERSION: 3.0 | |
SETUVAR ZO_CMD:zo | |
SETUVAR Z_CMD:z | |
SETUVAR Z_DATA:/home/hoa/\x2elocal/share/z/data | |
SETUVAR Z_DATA_DIR:/home/hoa/\x2elocal/share/z | |
SETUVAR Z_EXCLUDE:/home/hoa | |
SETUVAR __fish_classic_git_prompt_initialized:\x1d | |
SETUVAR __fish_init_2_39_8:\x1d | |
SETUVAR __fish_init_2_3_0:\x1d | |
SETUVAR __fish_init_3_x:\x1d | |
SETUVAR fish_color_autosuggestion:BD93F9 | |
SETUVAR fish_color_cancel:\x2dr | |
SETUVAR fish_color_command:F8F8F2 | |
SETUVAR fish_color_comment:6272A4 | |
SETUVAR fish_color_cwd:green | |
SETUVAR fish_color_cwd_root:red | |
SETUVAR fish_color_end:50FA7B | |
SETUVAR fish_color_error:FFB86C | |
SETUVAR fish_color_escape:00a6b2 | |
SETUVAR fish_color_history_current:\x2d\x2dbold | |
SETUVAR fish_color_host:normal | |
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue | |
SETUVAR fish_color_normal:normal | |
SETUVAR fish_color_operator:00a6b2 | |
SETUVAR fish_color_param:FF79C6 | |
SETUVAR fish_color_quote:F1FA8C | |
SETUVAR fish_color_redirection:8BE9FD | |
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack | |
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack | |
SETUVAR fish_color_status:red | |
SETUVAR fish_color_user:brgreen | |
SETUVAR fish_color_valid_path:\x2d\x2dunderline | |
SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell | |
SETUVAR fish_key_bindings:fish_default_key_bindings | |
SETUVAR fish_pager_color_completion:normal | |
SETUVAR fish_pager_color_description:B3A06D\x1eyellow | |
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline | |
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan | |
SETUVAR fish_user_paths:/home/hoa/\x2elocal/bin\x1e/home/hoa/opt/go/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g pad " " | |
## Function to show a segment | |
function prompt_segment -d "Function to show a segment" | |
# Get colors | |
set -l bg $argv[1] | |
set -l fg $argv[2] | |
# Set 'em | |
set_color -b $bg | |
set_color $fg | |
# Print text | |
if [ -n "$argv[3]" ] | |
echo -n -s $argv[3] | |
end | |
end | |
## Function to show current status | |
function show_status -d "Function to show the current status" | |
if [ $RETVAL -ne 0 ] | |
prompt_segment red white " ▲ " | |
set pad "" | |
end | |
if [ -n "$SSH_CLIENT" ] | |
prompt_segment blue white " SSH: " | |
set pad "" | |
end | |
end | |
function show_virtualenv -d "Show active python virtual environments" | |
if set -q VIRTUAL_ENV | |
set -l venvname (basename "$VIRTUAL_ENV") | |
prompt_segment normal white " ($venvname)" | |
end | |
end | |
## Show user if not default | |
function show_user -d "Show user" | |
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ] | |
set -l host (hostname -s) | |
set -l who (whoami) | |
prompt_segment normal 5FD7FF " $who" | |
# Skip @ bit if hostname == username | |
if [ "$USER" != "$HOST" ] | |
prompt_segment normal 8A8A8A "@" | |
prompt_segment normal FF5FD7 "$host " | |
set pad "" | |
end | |
end | |
end | |
# Show directory | |
function show_pwd -d "Show the current directory" | |
set -l pwd (prompt_pwd) | |
prompt_segment normal 8A8A8A "$pad$pwd " | |
end | |
# Show prompt w/ privilege cue | |
function show_prompt -d "Shows prompt with cue for current priv" | |
set -l uid (id -u $USER) | |
if [ $uid -eq 0 ] | |
prompt_segment red white " ! " | |
set_color normal | |
echo -n -s " " | |
else | |
prompt_segment normal 5FD7FF " \$ " | |
end | |
set_color normal | |
end | |
## SHOW PROMPT | |
function fish_prompt | |
set -g RETVAL $status | |
show_status | |
# show_virtualenv | |
show_user | |
show_pwd | |
show_prompt | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment