Initial commit

This commit is contained in:
2025-04-10 03:54:27 +08:00
commit 06a1116840
10 changed files with 91 additions and 0 deletions

4
config.fish Normal file
View File

@@ -0,0 +1,4 @@
if status is-interactive
# Commands to run in interactive sessions can go here
fish_add_path "$HOME/.local/bin"
end

33
fish_variables Normal file
View File

@@ -0,0 +1,33 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3800
SETUVAR fish_color_autosuggestion:brblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:blue
SETUVAR fish_color_comment:red
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:green
SETUVAR fish_color_error:brred
SETUVAR fish_color_escape:brcyan
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:brcyan
SETUVAR fish_color_param:cyan
SETUVAR fish_color_quote:yellow
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
SETUVAR fish_color_search_match:white\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:\x1d
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:yellow\x1e\x2di
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:\x2dr
SETUVAR fish_user_paths:/home/ytshih/\x2elocal/bin

View File

@@ -0,0 +1,26 @@
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)
set -l cwd (pwd)
if git rev-parse --is-inside-work-tree >/dev/null 2>&1
set -l git_root (git rev-parse --show-toplevel)
set -l git_root_basename (basename "$git_root")
set cwd (string replace --regex "^$git_root" "($git_root_basename)" "$cwd")
end
printf '[%s] %s%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) $cwd $pipestatus_string \
(set_color yellow) (string trim -l (fish_git_prompt)) (set_color normal)
end
end

4
functions/k.fish Normal file
View File

@@ -0,0 +1,4 @@
function k --wraps=kubectl --description 'alias k kubectl'
kubectl $argv
end

4
functions/kctx.fish Normal file
View File

@@ -0,0 +1,4 @@
function kctx --wraps='kubectl config use-context' --description 'alias kctx kubectl config use-context'
kubectl config use-context $argv
end

4
functions/kns.fish Normal file
View File

@@ -0,0 +1,4 @@
function kns --wraps='kubectl config set-context --current --namespace' --description 'alias kns kubectl config set-context --current --namespace'
kubectl config set-context --current --namespace $argv
end

4
functions/mctl.fish Normal file
View File

@@ -0,0 +1,4 @@
function mctl --wraps='sudo machinectl' --description 'alias mctl sudo machinectl'
sudo machinectl $argv
end

4
functions/pctl.fish Normal file
View File

@@ -0,0 +1,4 @@
function pctl --wraps='sudo portablectl' --description 'alias pctl sudo portablectl'
sudo portablectl $argv
end

4
functions/rgrep.fish Normal file
View File

@@ -0,0 +1,4 @@
function rgrep --wraps='grep -rE' --wraps=grep --wraps='grep -rnE' --description 'alias rgrep grep -rnE'
grep -rnE $argv
end

4
functions/tree.fish Normal file
View File

@@ -0,0 +1,4 @@
function tree --description 'alias tree tree -C'
command tree -C $argv
end