From: Andre Ramnitz Date: Sun, 10 Dec 2023 16:21:33 +0000 (+0100) Subject: fish: fix paths for GNU Stow X-Git-Tag: v0.2~373 X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=76e3cb10edf9607f19b1802b1131432c1c005153;p=dotfiles.git fish: fix paths for GNU Stow --- diff --git a/fish/.config/fish/completions/key-bindings.fish b/fish/.config/fish/completions/key-bindings.fish new file mode 100644 index 00000000..743c7c18 --- /dev/null +++ b/fish/.config/fish/completions/key-bindings.fish @@ -0,0 +1,172 @@ +# ____ ____ +# / __/___ / __/ +# / /_/_ / / /_ +# / __/ / /_/ __/ +# /_/ /___/_/ key-bindings.fish +# +# - $FZF_TMUX_OPTS +# - $FZF_CTRL_T_COMMAND +# - $FZF_CTRL_T_OPTS +# - $FZF_CTRL_R_OPTS +# - $FZF_ALT_C_COMMAND +# - $FZF_ALT_C_OPTS + +# Key bindings +# ------------ +function fzf_key_bindings + + # Store current token in $dir as root for the 'find' command + function fzf-file-widget -d "List files and folders" + set -l commandline (__fzf_parse_commandline) + set -l dir $commandline[1] + set -l fzf_query $commandline[2] + set -l prefix $commandline[3] + + # "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not + # $dir itself, even if hidden. + test -n "$FZF_CTRL_T_COMMAND"; or set -l FZF_CTRL_T_COMMAND " + command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ + -o -type f -print \ + -o -type d -print \ + -o -type l -print 2> /dev/null | sed 's@^\./@@'" + + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" + eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end + end + if [ -z "$result" ] + commandline -f repaint + return + else + # Remove last token from commandline. + commandline -t "" + end + for i in $result + commandline -it -- $prefix + commandline -it -- (string escape $i) + commandline -it -- ' ' + end + commandline -f repaint + end + + function fzf-history-widget -d "Show command history" + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS +m" + + set -l FISH_MAJOR (echo $version | cut -f1 -d.) + set -l FISH_MINOR (echo $version | cut -f2 -d.) + + # history's -z flag is needed for multi-line support. + # history's -z flag was added in fish 2.4.0, so don't use it for versions + # before 2.4.0. + if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ]; + history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result + and commandline -- $result + else + history | eval (__fzfcmd) -q '(commandline)' | read -l result + and commandline -- $result + end + end + commandline -f repaint + end + + function fzf-cd-widget -d "Change directory" + set -l commandline (__fzf_parse_commandline) + set -l dir $commandline[1] + set -l fzf_query $commandline[2] + set -l prefix $commandline[3] + + test -n "$FZF_ALT_C_COMMAND"; or set -l FZF_ALT_C_COMMAND " + command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ + -o -type d -print 2> /dev/null | sed 's@^\./@@'" + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" + eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result + + if [ -n "$result" ] + cd -- $result + + # Remove last token from commandline. + commandline -t "" + commandline -it -- $prefix + end + end + + commandline -f repaint + end + + function __fzfcmd + test -n "$FZF_TMUX"; or set FZF_TMUX 0 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + if [ -n "$FZF_TMUX_OPTS" ] + echo "fzf-tmux $FZF_TMUX_OPTS -- " + else if [ $FZF_TMUX -eq 1 ] + echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- " + else + echo "fzf" + end + end + + bind \ct fzf-file-widget + bind \cr fzf-history-widget + bind \ec fzf-cd-widget + + if bind -M insert > /dev/null 2>&1 + bind -M insert \ct fzf-file-widget + bind -M insert \cr fzf-history-widget + bind -M insert \ec fzf-cd-widget + end + + function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix' + set -l commandline (commandline -t) + + # strip -option= from token if present + set -l prefix (string match -r -- '^-[^\s=]+=' $commandline) + set commandline (string replace -- "$prefix" '' $commandline) + + # eval is used to do shell expansion on paths + eval set commandline $commandline + + if [ -z $commandline ] + # Default to current directory with no --query + set dir '.' + set fzf_query '' + else + set dir (__fzf_get_dir $commandline) + + if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ] + # if $dir is "." but commandline is not a relative path, this means no file path found + set fzf_query $commandline + else + # Also remove trailing slash after dir, to "split" input properly + set fzf_query (string replace -r "^$dir/?" -- '' "$commandline") + end + end + + echo $dir + echo $fzf_query + echo $prefix + end + + function __fzf_get_dir -d 'Find the longest existing filepath from input string' + set dir $argv + + # Strip all trailing slashes. Ignore if $dir is root dir (/) + if [ (string length -- $dir) -gt 1 ] + set dir (string replace -r '/*$' -- '' $dir) + end + + # Iteratively check if dir exists and strip tail end of path + while [ ! -d "$dir" ] + # If path is absolute, this can keep going until ends up at / + # If path is relative, this can keep going until entire input is consumed, dirname returns "." + set dir (dirname -- "$dir") + end + + echo $dir + end + +end diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish new file mode 100644 index 00000000..55965082 --- /dev/null +++ b/fish/.config/fish/config.fish @@ -0,0 +1,5 @@ +if status is-interactive + # Commands to run in interactive sessions can go here + # + cat ~/.config/banner.asc +end diff --git a/fish/.config/fish/fish_variables b/fish/.config/fish/fish_variables new file mode 100644 index 00000000..0b2dc834 --- /dev/null +++ b/fish/.config/fish/fish_variables @@ -0,0 +1,37 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR --export EDITOR:/usr/bin/kak +SETUVAR --export VDPAU_DRIVER:radeonsi +SETUVAR __fish_initialized:3400 +SETUVAR fish_color_autosuggestion:8e908c +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:8959a8 +SETUVAR fish_color_comment:eab700 +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:8959a8 +SETUVAR fish_color_error:c82829 +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_keyword:8959a8 +SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:00a6b2 +SETUVAR fish_color_option:4271ae +SETUVAR fish_color_param:4271ae +SETUVAR fish_color_quote:718c00 +SETUVAR fish_color_redirection:3e999f +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_pager_color_selected_background:\x2d\x2dbackground\x3dbrblack +SETUVAR fish_user_paths:/home/andy/Applications\x1e/opt/android\x2dsdk/platform\x2dtools\x1e/home/andy/\x2ecargo/bin\x1e/home/andy/\x2elocal/bin diff --git a/fish/.config/fish/functions/df.fish b/fish/.config/fish/functions/df.fish new file mode 100644 index 00000000..8a46d4ac --- /dev/null +++ b/fish/.config/fish/functions/df.fish @@ -0,0 +1,3 @@ +function df --wraps='/bin/df -h | tail -n +2 | sort -n' --wraps='/bin/df -ah | tail -n +2 | sort -n' --wraps='/bin/df -ahk | tail -n +2 | sort -n' --description 'alias df /bin/df -h | tail -n +2 | sort -n' + /bin/df -h | tail -n +2 | sort -n $argv; +end diff --git a/fish/.config/fish/functions/emergelog.fish b/fish/.config/fish/functions/emergelog.fish new file mode 100644 index 00000000..8412d626 --- /dev/null +++ b/fish/.config/fish/functions/emergelog.fish @@ -0,0 +1,3 @@ +function emergelog --wraps='sudo cat /var/log/emerge.log | grep completed' --wraps=sudo\ cat\ /var/log/emerge.log\ \|\ grep\ -i\ \"completed\\\|started\" --wraps=sudo\ cat\ /var/log/emerge.log\ \|\ grep\ -i\ \"started\\\|completed\\\|exiting\" --description alias\ emergelog=sudo\ cat\ /var/log/emerge.log\ \|\ grep\ -i\ \"started\\\|completed\\\|exiting\" + sudo cat /var/log/emerge.log | grep -i "started\|completed\|exiting" $argv; +end diff --git a/fish/.config/fish/functions/fish_prompt.fish b/fish/.config/fish/functions/fish_prompt.fish new file mode 100644 index 00000000..b7d38e68 --- /dev/null +++ b/fish/.config/fish/functions/fish_prompt.fish @@ -0,0 +1,139 @@ +function fish_prompt + # This prompt shows: + # - green lines if the last return command is OK, red otherwise + # - your user name, in red if root or yellow otherwise + # - your hostname, in cyan if ssh or blue otherwise + # - the current path (with prompt_pwd) + # - date +%X + # - the current virtual environment, if any + # - the current git status, if any, with fish_git_prompt + # - the current battery state, if any, and if your power cable is unplugged, and if you have "acpi" + # - current background jobs, if any + + # It goes from: + # ┬─[nim@Hattori:~]─[11:39:00] + # ╰─>$ echo here + + # To: + # ┬─[nim@Hattori:~/w/dashboard]─[11:37:14]─[V:django20]─[G:master↑1|●1✚1…1]─[B:85%, 05:41:42 remaining] + # │ 2 15054 0% arrêtée sleep 100000 + # │ 1 15048 0% arrêtée sleep 100000 + # ╰─>$ echo there + + set -l retc red + test $status = 0; and set retc green + + set -q __fish_git_prompt_showupstream + or set -g __fish_git_prompt_showupstream auto + + function _nim_prompt_wrapper + set retc $argv[1] + set -l field_name $argv[2] + set -l field_value $argv[3] + + set_color normal + set_color $retc + echo -n '─' + set_color -o green + echo -n '[' + set_color normal + test -n $field_name + and echo -n $field_name: + set_color $retc + echo -n $field_value + set_color -o green + echo -n ']' + end + + set_color $retc + echo -n '┬─' + set_color -o green + echo -n [ + + if functions -q fish_is_root_user; and fish_is_root_user + set_color -o red + else + set_color -o yellow + end + + echo -n $USER + set_color -o white + echo -n @ + + if test -z "$SSH_CLIENT" + set_color -o blue + else + set_color -o cyan + end + + echo -n (prompt_hostname) + set_color -o white + echo -n :(prompt_pwd) + set_color -o green + echo -n ']' + + # Date + _nim_prompt_wrapper $retc '' (date +%X) + + # Vi-mode + # The default mode prompt would be prefixed, which ruins our alignment. + function fish_mode_prompt + end + + if test "$fish_key_bindings" = fish_vi_key_bindings + or test "$fish_key_bindings" = fish_hybrid_key_bindings + set -l mode + switch $fish_bind_mode + case default + set mode (set_color --bold red)N + case insert + set mode (set_color --bold green)I + case replace_one + set mode (set_color --bold green)R + echo '[R]' + case replace + set mode (set_color --bold cyan)R + case visual + set mode (set_color --bold magenta)V + end + set mode $mode(set_color normal) + _nim_prompt_wrapper $retc '' $mode + end + + + # Virtual Environment + set -q VIRTUAL_ENV_DISABLE_PROMPT + or set -g VIRTUAL_ENV_DISABLE_PROMPT true + set -q VIRTUAL_ENV + and _nim_prompt_wrapper $retc V (basename "$VIRTUAL_ENV") + + # git + set -l prompt_git (fish_git_prompt '%s') + test -n "$prompt_git" + and _nim_prompt_wrapper $retc G $prompt_git + + # Battery status + type -q acpi + and test (acpi -a 2> /dev/null | string match -r off) + and _nim_prompt_wrapper $retc B (acpi -b | cut -d' ' -f 4-) + + # New line + echo + + # Background jobs + set_color normal + + for job in (jobs) + set_color $retc + echo -n '│ ' + set_color brown + echo $job + end + + set_color normal + set_color $retc + echo -n '╰─>' + set_color -o red + echo -n '$ ' + set_color normal +end diff --git a/fish/.config/fish/functions/free.fish b/fish/.config/fish/functions/free.fish new file mode 100644 index 00000000..1588642c --- /dev/null +++ b/fish/.config/fish/functions/free.fish @@ -0,0 +1,3 @@ +function free --wraps='/usr/bin/free --giga -h -w' --wraps='/usr/bin/free -h' --description 'alias free=free -wth --si' + command free -wth --si $argv; +end diff --git a/fish/.config/fish/functions/grep.fish b/fish/.config/fish/functions/grep.fish new file mode 100644 index 00000000..65baf8e9 --- /dev/null +++ b/fish/.config/fish/functions/grep.fish @@ -0,0 +1,3 @@ +function grep --description 'alias grep=grep -i --color=auto' + command grep -i --color=auto $argv; +end diff --git a/fish/.config/fish/functions/lsblk.fish b/fish/.config/fish/functions/lsblk.fish new file mode 100644 index 00000000..0b1dbdbb --- /dev/null +++ b/fish/.config/fish/functions/lsblk.fish @@ -0,0 +1,3 @@ +function lsblk --description 'alias lsblk=lsblk -o +MODEL,LABEL' + command lsblk -o +MODEL,LABEL $argv; +end diff --git a/fish/.config/fish/functions/lt.fish b/fish/.config/fish/functions/lt.fish new file mode 100644 index 00000000..f1255505 --- /dev/null +++ b/fish/.config/fish/functions/lt.fish @@ -0,0 +1,3 @@ +function lt --wraps='ls -ltr' --description 'alias lt=ls -ltr' + ls -ltr $argv; +end diff --git a/fish/.config/fish/functions/zdiff.fish b/fish/.config/fish/functions/zdiff.fish new file mode 100644 index 00000000..028c8508 --- /dev/null +++ b/fish/.config/fish/functions/zdiff.fish @@ -0,0 +1,3 @@ +function zdiff --description 'alias zdiff=zdiff --color=auto' + command zdiff --color=auto $argv; +end diff --git a/fish/completions/key-bindings.fish b/fish/completions/key-bindings.fish deleted file mode 100644 index 743c7c18..00000000 --- a/fish/completions/key-bindings.fish +++ /dev/null @@ -1,172 +0,0 @@ -# ____ ____ -# / __/___ / __/ -# / /_/_ / / /_ -# / __/ / /_/ __/ -# /_/ /___/_/ key-bindings.fish -# -# - $FZF_TMUX_OPTS -# - $FZF_CTRL_T_COMMAND -# - $FZF_CTRL_T_OPTS -# - $FZF_CTRL_R_OPTS -# - $FZF_ALT_C_COMMAND -# - $FZF_ALT_C_OPTS - -# Key bindings -# ------------ -function fzf_key_bindings - - # Store current token in $dir as root for the 'find' command - function fzf-file-widget -d "List files and folders" - set -l commandline (__fzf_parse_commandline) - set -l dir $commandline[1] - set -l fzf_query $commandline[2] - set -l prefix $commandline[3] - - # "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not - # $dir itself, even if hidden. - test -n "$FZF_CTRL_T_COMMAND"; or set -l FZF_CTRL_T_COMMAND " - command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ - -o -type f -print \ - -o -type d -print \ - -o -type l -print 2> /dev/null | sed 's@^\./@@'" - - test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% - begin - set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" - eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end - end - if [ -z "$result" ] - commandline -f repaint - return - else - # Remove last token from commandline. - commandline -t "" - end - for i in $result - commandline -it -- $prefix - commandline -it -- (string escape $i) - commandline -it -- ' ' - end - commandline -f repaint - end - - function fzf-history-widget -d "Show command history" - test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% - begin - set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS +m" - - set -l FISH_MAJOR (echo $version | cut -f1 -d.) - set -l FISH_MINOR (echo $version | cut -f2 -d.) - - # history's -z flag is needed for multi-line support. - # history's -z flag was added in fish 2.4.0, so don't use it for versions - # before 2.4.0. - if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ]; - history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result - and commandline -- $result - else - history | eval (__fzfcmd) -q '(commandline)' | read -l result - and commandline -- $result - end - end - commandline -f repaint - end - - function fzf-cd-widget -d "Change directory" - set -l commandline (__fzf_parse_commandline) - set -l dir $commandline[1] - set -l fzf_query $commandline[2] - set -l prefix $commandline[3] - - test -n "$FZF_ALT_C_COMMAND"; or set -l FZF_ALT_C_COMMAND " - command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ - -o -type d -print 2> /dev/null | sed 's@^\./@@'" - test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% - begin - set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" - eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result - - if [ -n "$result" ] - cd -- $result - - # Remove last token from commandline. - commandline -t "" - commandline -it -- $prefix - end - end - - commandline -f repaint - end - - function __fzfcmd - test -n "$FZF_TMUX"; or set FZF_TMUX 0 - test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% - if [ -n "$FZF_TMUX_OPTS" ] - echo "fzf-tmux $FZF_TMUX_OPTS -- " - else if [ $FZF_TMUX -eq 1 ] - echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- " - else - echo "fzf" - end - end - - bind \ct fzf-file-widget - bind \cr fzf-history-widget - bind \ec fzf-cd-widget - - if bind -M insert > /dev/null 2>&1 - bind -M insert \ct fzf-file-widget - bind -M insert \cr fzf-history-widget - bind -M insert \ec fzf-cd-widget - end - - function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix' - set -l commandline (commandline -t) - - # strip -option= from token if present - set -l prefix (string match -r -- '^-[^\s=]+=' $commandline) - set commandline (string replace -- "$prefix" '' $commandline) - - # eval is used to do shell expansion on paths - eval set commandline $commandline - - if [ -z $commandline ] - # Default to current directory with no --query - set dir '.' - set fzf_query '' - else - set dir (__fzf_get_dir $commandline) - - if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ] - # if $dir is "." but commandline is not a relative path, this means no file path found - set fzf_query $commandline - else - # Also remove trailing slash after dir, to "split" input properly - set fzf_query (string replace -r "^$dir/?" -- '' "$commandline") - end - end - - echo $dir - echo $fzf_query - echo $prefix - end - - function __fzf_get_dir -d 'Find the longest existing filepath from input string' - set dir $argv - - # Strip all trailing slashes. Ignore if $dir is root dir (/) - if [ (string length -- $dir) -gt 1 ] - set dir (string replace -r '/*$' -- '' $dir) - end - - # Iteratively check if dir exists and strip tail end of path - while [ ! -d "$dir" ] - # If path is absolute, this can keep going until ends up at / - # If path is relative, this can keep going until entire input is consumed, dirname returns "." - set dir (dirname -- "$dir") - end - - echo $dir - end - -end diff --git a/fish/config.fish b/fish/config.fish deleted file mode 100644 index 55965082..00000000 --- a/fish/config.fish +++ /dev/null @@ -1,5 +0,0 @@ -if status is-interactive - # Commands to run in interactive sessions can go here - # - cat ~/.config/banner.asc -end diff --git a/fish/fish_variables b/fish/fish_variables deleted file mode 100644 index 0b2dc834..00000000 --- a/fish/fish_variables +++ /dev/null @@ -1,37 +0,0 @@ -# This file contains fish universal variable definitions. -# VERSION: 3.0 -SETUVAR --export EDITOR:/usr/bin/kak -SETUVAR --export VDPAU_DRIVER:radeonsi -SETUVAR __fish_initialized:3400 -SETUVAR fish_color_autosuggestion:8e908c -SETUVAR fish_color_cancel:\x2dr -SETUVAR fish_color_command:8959a8 -SETUVAR fish_color_comment:eab700 -SETUVAR fish_color_cwd:green -SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:8959a8 -SETUVAR fish_color_error:c82829 -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_keyword:8959a8 -SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:00a6b2 -SETUVAR fish_color_option:4271ae -SETUVAR fish_color_param:4271ae -SETUVAR fish_color_quote:718c00 -SETUVAR fish_color_redirection:3e999f -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_pager_color_selected_background:\x2d\x2dbackground\x3dbrblack -SETUVAR fish_user_paths:/home/andy/Applications\x1e/opt/android\x2dsdk/platform\x2dtools\x1e/home/andy/\x2ecargo/bin\x1e/home/andy/\x2elocal/bin diff --git a/fish/functions/df.fish b/fish/functions/df.fish deleted file mode 100644 index 8a46d4ac..00000000 --- a/fish/functions/df.fish +++ /dev/null @@ -1,3 +0,0 @@ -function df --wraps='/bin/df -h | tail -n +2 | sort -n' --wraps='/bin/df -ah | tail -n +2 | sort -n' --wraps='/bin/df -ahk | tail -n +2 | sort -n' --description 'alias df /bin/df -h | tail -n +2 | sort -n' - /bin/df -h | tail -n +2 | sort -n $argv; -end diff --git a/fish/functions/emergelog.fish b/fish/functions/emergelog.fish deleted file mode 100644 index 8412d626..00000000 --- a/fish/functions/emergelog.fish +++ /dev/null @@ -1,3 +0,0 @@ -function emergelog --wraps='sudo cat /var/log/emerge.log | grep completed' --wraps=sudo\ cat\ /var/log/emerge.log\ \|\ grep\ -i\ \"completed\\\|started\" --wraps=sudo\ cat\ /var/log/emerge.log\ \|\ grep\ -i\ \"started\\\|completed\\\|exiting\" --description alias\ emergelog=sudo\ cat\ /var/log/emerge.log\ \|\ grep\ -i\ \"started\\\|completed\\\|exiting\" - sudo cat /var/log/emerge.log | grep -i "started\|completed\|exiting" $argv; -end diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish deleted file mode 100644 index b7d38e68..00000000 --- a/fish/functions/fish_prompt.fish +++ /dev/null @@ -1,139 +0,0 @@ -function fish_prompt - # This prompt shows: - # - green lines if the last return command is OK, red otherwise - # - your user name, in red if root or yellow otherwise - # - your hostname, in cyan if ssh or blue otherwise - # - the current path (with prompt_pwd) - # - date +%X - # - the current virtual environment, if any - # - the current git status, if any, with fish_git_prompt - # - the current battery state, if any, and if your power cable is unplugged, and if you have "acpi" - # - current background jobs, if any - - # It goes from: - # ┬─[nim@Hattori:~]─[11:39:00] - # ╰─>$ echo here - - # To: - # ┬─[nim@Hattori:~/w/dashboard]─[11:37:14]─[V:django20]─[G:master↑1|●1✚1…1]─[B:85%, 05:41:42 remaining] - # │ 2 15054 0% arrêtée sleep 100000 - # │ 1 15048 0% arrêtée sleep 100000 - # ╰─>$ echo there - - set -l retc red - test $status = 0; and set retc green - - set -q __fish_git_prompt_showupstream - or set -g __fish_git_prompt_showupstream auto - - function _nim_prompt_wrapper - set retc $argv[1] - set -l field_name $argv[2] - set -l field_value $argv[3] - - set_color normal - set_color $retc - echo -n '─' - set_color -o green - echo -n '[' - set_color normal - test -n $field_name - and echo -n $field_name: - set_color $retc - echo -n $field_value - set_color -o green - echo -n ']' - end - - set_color $retc - echo -n '┬─' - set_color -o green - echo -n [ - - if functions -q fish_is_root_user; and fish_is_root_user - set_color -o red - else - set_color -o yellow - end - - echo -n $USER - set_color -o white - echo -n @ - - if test -z "$SSH_CLIENT" - set_color -o blue - else - set_color -o cyan - end - - echo -n (prompt_hostname) - set_color -o white - echo -n :(prompt_pwd) - set_color -o green - echo -n ']' - - # Date - _nim_prompt_wrapper $retc '' (date +%X) - - # Vi-mode - # The default mode prompt would be prefixed, which ruins our alignment. - function fish_mode_prompt - end - - if test "$fish_key_bindings" = fish_vi_key_bindings - or test "$fish_key_bindings" = fish_hybrid_key_bindings - set -l mode - switch $fish_bind_mode - case default - set mode (set_color --bold red)N - case insert - set mode (set_color --bold green)I - case replace_one - set mode (set_color --bold green)R - echo '[R]' - case replace - set mode (set_color --bold cyan)R - case visual - set mode (set_color --bold magenta)V - end - set mode $mode(set_color normal) - _nim_prompt_wrapper $retc '' $mode - end - - - # Virtual Environment - set -q VIRTUAL_ENV_DISABLE_PROMPT - or set -g VIRTUAL_ENV_DISABLE_PROMPT true - set -q VIRTUAL_ENV - and _nim_prompt_wrapper $retc V (basename "$VIRTUAL_ENV") - - # git - set -l prompt_git (fish_git_prompt '%s') - test -n "$prompt_git" - and _nim_prompt_wrapper $retc G $prompt_git - - # Battery status - type -q acpi - and test (acpi -a 2> /dev/null | string match -r off) - and _nim_prompt_wrapper $retc B (acpi -b | cut -d' ' -f 4-) - - # New line - echo - - # Background jobs - set_color normal - - for job in (jobs) - set_color $retc - echo -n '│ ' - set_color brown - echo $job - end - - set_color normal - set_color $retc - echo -n '╰─>' - set_color -o red - echo -n '$ ' - set_color normal -end diff --git a/fish/functions/free.fish b/fish/functions/free.fish deleted file mode 100644 index 1588642c..00000000 --- a/fish/functions/free.fish +++ /dev/null @@ -1,3 +0,0 @@ -function free --wraps='/usr/bin/free --giga -h -w' --wraps='/usr/bin/free -h' --description 'alias free=free -wth --si' - command free -wth --si $argv; -end diff --git a/fish/functions/grep.fish b/fish/functions/grep.fish deleted file mode 100644 index 65baf8e9..00000000 --- a/fish/functions/grep.fish +++ /dev/null @@ -1,3 +0,0 @@ -function grep --description 'alias grep=grep -i --color=auto' - command grep -i --color=auto $argv; -end diff --git a/fish/functions/lsblk.fish b/fish/functions/lsblk.fish deleted file mode 100644 index 0b1dbdbb..00000000 --- a/fish/functions/lsblk.fish +++ /dev/null @@ -1,3 +0,0 @@ -function lsblk --description 'alias lsblk=lsblk -o +MODEL,LABEL' - command lsblk -o +MODEL,LABEL $argv; -end diff --git a/fish/functions/lt.fish b/fish/functions/lt.fish deleted file mode 100644 index f1255505..00000000 --- a/fish/functions/lt.fish +++ /dev/null @@ -1,3 +0,0 @@ -function lt --wraps='ls -ltr' --description 'alias lt=ls -ltr' - ls -ltr $argv; -end diff --git a/fish/functions/zdiff.fish b/fish/functions/zdiff.fish deleted file mode 100644 index 028c8508..00000000 --- a/fish/functions/zdiff.fish +++ /dev/null @@ -1,3 +0,0 @@ -function zdiff --description 'alias zdiff=zdiff --color=auto' - command zdiff --color=auto $argv; -end