From 9a873a6e8a06da7d033066dfc96fe56c6c283c69 Mon Sep 17 00:00:00 2001 From: Alwin Berger Date: Tue, 24 Sep 2024 10:11:02 +0200 Subject: [PATCH] fish++ --- .config/fish/config.fish | 6 ++++ .config/fish/fish_variables | 37 +++++++++++++++++++++++++ .config/fish/functions/dotfiles.fish | 4 +++ .config/fish/functions/fish_prompt.fish | 20 +++++++++++++ .config/fish/functions/rsrp.fish | 4 +++ .config/fish/functions/vim.fish | 3 ++ 6 files changed, 74 insertions(+) create mode 100644 .config/fish/config.fish create mode 100644 .config/fish/fish_variables create mode 100644 .config/fish/functions/dotfiles.fish create mode 100644 .config/fish/functions/fish_prompt.fish create mode 100644 .config/fish/functions/rsrp.fish create mode 100644 .config/fish/functions/vim.fish diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..210daa5 --- /dev/null +++ b/.config/fish/config.fish @@ -0,0 +1,6 @@ +set -x PATH $PATH /home/ab/code/cosmocc/bin +umask 0027 +#. ~/.nix-profile/etc/profile.d/nix.fish +if status is-interactive + # Commands to run in interactive sessions can go here +end diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables new file mode 100644 index 0000000..f0c07bb --- /dev/null +++ b/.config/fish/fish_variables @@ -0,0 +1,37 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3400 +SETUVAR _fish_abbr_ga:git\x20add +SETUVAR _fish_abbr_gco:git\x20checkout +SETUVAR _fish_abbr_gps:git\x20push +SETUVAR _fish_abbr_gpu:git\x20push +SETUVAR _fish_abbr_gs:git\x20status +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:a3be8c +SETUVAR fish_color_redirection:b48ead +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:\x2dr diff --git a/.config/fish/functions/dotfiles.fish b/.config/fish/functions/dotfiles.fish new file mode 100644 index 0000000..f829af1 --- /dev/null +++ b/.config/fish/functions/dotfiles.fish @@ -0,0 +1,4 @@ +function dotfiles --wraps='/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"' --description 'alias dotfiles=/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"' + /usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME" $argv + +end diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..db0599c --- /dev/null +++ b/.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 diff --git a/.config/fish/functions/rsrp.fish b/.config/fish/functions/rsrp.fish new file mode 100644 index 0000000..5074293 --- /dev/null +++ b/.config/fish/functions/rsrp.fish @@ -0,0 +1,4 @@ +function rsrp --wraps='rsync --recursive --compress --times --human-readable --info=progress2' --description 'alias rsrp=rsync --recursive --compress --times --human-readable --info=progress2' + rsync --recursive --compress --times --human-readable --info=progress2 $argv + +end diff --git a/.config/fish/functions/vim.fish b/.config/fish/functions/vim.fish new file mode 100644 index 0000000..f9e4cf4 --- /dev/null +++ b/.config/fish/functions/vim.fish @@ -0,0 +1,3 @@ +function vim --wraps=nvim --description 'alias vim nvim' + nvim $argv; +end