From abf2831f6259c1e913c545b6a217fe380543d013 Mon Sep 17 00:00:00 2001 From: _N0x Date: Fri, 21 Jan 2022 00:48:29 +0100 Subject: [PATCH] Added configuration for fish shell as a lightweight alternative to zsh and oh-my-zsh --- fish/.config/fish/config.fish | 16 ++++++++++ fish/.config/fish/fish_variables | 32 +++++++++++++++++++ .../.config/fish/functions/fish_greeting.fish | 3 ++ fish/.config/fish/functions/fish_prompt.fish | 20 ++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 fish/.config/fish/config.fish create mode 100644 fish/.config/fish/fish_variables create mode 100644 fish/.config/fish/functions/fish_greeting.fish create mode 100644 fish/.config/fish/functions/fish_prompt.fish diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish new file mode 100644 index 0000000..25bc210 --- /dev/null +++ b/fish/.config/fish/config.fish @@ -0,0 +1,16 @@ +if [ -z "$DISPLAY" ] && [ (fgconsole) -eq 1 ]; + startx +end + +function q + exit +end + +function cl + command clear && ls +end + +function cat + bat --theme=Nord $argv +end + diff --git a/fish/.config/fish/fish_variables b/fish/.config/fish/fish_variables new file mode 100644 index 0000000..87d5f7b --- /dev/null +++ b/fish/.config/fish/fish_variables @@ -0,0 +1,32 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3100 +SETUVAR fish_color_autosuggestion:4c566a +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:81a1c1 +SETUVAR fish_color_comment:434c5e +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:88c0d0 +SETUVAR fish_color_error:ebcb8b +SETUVAR fish_color_escape:00a6b2 +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:00a6b2 +SETUVAR fish_color_param:eceff4 +SETUVAR fish_color_quote:999900 +SETUVAR fish_color_redirection:00afff +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_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:B3A06D\x1eyellow +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_user_paths:/home/n0x/\x2elocal/bin diff --git a/fish/.config/fish/functions/fish_greeting.fish b/fish/.config/fish/functions/fish_greeting.fish new file mode 100644 index 0000000..5e4dcd8 --- /dev/null +++ b/fish/.config/fish/functions/fish_greeting.fish @@ -0,0 +1,3 @@ +function fish_greeting -d "What's up, fish?" + pfetch +end diff --git a/fish/.config/fish/functions/fish_prompt.fish b/fish/.config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..db0599c --- /dev/null +++ b/fish/.config/fish/functions/fish_prompt.fish @@ -0,0 +1,20 @@ +function fish_prompt --description 'Informative prompt' + #Save the return status of the previous command + set -l last_pipestatus $pipestatus + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. + + if functions -q fish_is_root_user; and fish_is_root_user + printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root + and set_color $fish_color_cwd_root + or set_color $fish_color_cwd) \ + (prompt_pwd) (set_color normal) + else + set -l status_color (set_color $fish_color_status) + set -l statusb_color (set_color --bold $fish_color_status) + set -l pipestatus_string (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus) + + printf '[%s] %s%s@%s %s%s %s%s%s \n> ' (date "+%H:%M:%S") (set_color brblue) \ + $USER (prompt_hostname) (set_color $fish_color_cwd) $PWD $pipestatus_string \ + (set_color normal) + end +end