From 16a7b26fd53731370708e30fc8fd81b5fc331e57 Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 15 Aug 2022 18:31:22 +0200 Subject: Initial commit --- aliases.fish | 4 ++++ config.fish | 10 ++++++++++ fish_variables | 34 ++++++++++++++++++++++++++++++++++ functions/cd.fish | 10 ++++++++++ functions/fish_prompt.fish | 7 +++++++ functions/fish_right_prompt.fish | 10 ++++++++++ functions/fish_user_key_bindings.fish | 5 +++++ functions/foreground-vi.fish | 3 +++ functions/md.fish | 4 ++++ functions/quote-word.fish | 4 ++++ functions/sa.fish | 3 +++ functions/sudo-execute.fish | 5 +++++ prompt_settings.fish | 7 +++++++ 13 files changed, 106 insertions(+) create mode 100644 aliases.fish create mode 100644 config.fish create mode 100644 fish_variables create mode 100644 functions/cd.fish create mode 100644 functions/fish_prompt.fish create mode 100644 functions/fish_right_prompt.fish create mode 100644 functions/fish_user_key_bindings.fish create mode 100644 functions/foreground-vi.fish create mode 100644 functions/md.fish create mode 100644 functions/quote-word.fish create mode 100644 functions/sa.fish create mode 100644 functions/sudo-execute.fish create mode 100644 prompt_settings.fish diff --git a/aliases.fish b/aliases.fish new file mode 100644 index 0000000..7ad22a4 --- /dev/null +++ b/aliases.fish @@ -0,0 +1,4 @@ +function mkae; make; end +function vim; command nvim -p $argv; end +function rm; command rm -I $argv; end +function mux; command tmuxinator $argv; end diff --git a/config.fish b/config.fish new file mode 100644 index 0000000..39fda42 --- /dev/null +++ b/config.fish @@ -0,0 +1,10 @@ + +set -x GREP_OPTIONS +set fish_greeting "" +set -x ncpus (grep -c "^processor" /proc/cpuinfo) +set -x EDITOR vim +set -x PAGER less +set -x VIRTUAL_ENV_DISABLE_PROMPT 1 + +source ~/.config/fish/aliases.fish + diff --git a/fish_variables b/fish_variables new file mode 100644 index 0000000..71efd8d --- /dev/null +++ b/fish_variables @@ -0,0 +1,34 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR --export LS_COLORS:rs\x3d0\x3adi\x3d01\x3b38\x3b2\x3b139\x3b233\x3b253\x3aln\x3d01\x3b38\x3b2\x3b241\x3b250\x3b140\x3amh\x3d00\x3api\x3d40\x3b38\x3b2\x3b255\x3b184\x3b108\x3aso\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3ado\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3abd\x3d40\x3b33\x3b01\x3acd\x3d40\x3b33\x3b01\x3aor\x3d40\x3b31\x3b01\x3ami\x3d00\x3asu\x3d37\x3b41\x3asg\x3d30\x3b43\x3aca\x3d30\x3b41\x3atw\x3d30\x3b42\x3aow\x3d34\x3b42\x3ast\x3d37\x3b44\x3aex\x3d01\x3b38\x3b2\x3b80\x3b250\x3b123\x3a\x2a\x2etar\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etgz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2earc\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2earj\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etaz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2elha\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2elz4\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2elzh\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2elzma\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etlz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etxz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etzo\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2et7z\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ezip\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ez\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2edz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2egz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2elrz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2elz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2elzo\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2exz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ezst\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etzst\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ebz2\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ebz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etbz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etbz2\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2etz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2edeb\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2erpm\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ejar\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ewar\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2eear\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2esar\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2erar\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ealz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2eace\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ezoo\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ecpio\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2e7z\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2erz\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ecab\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ewim\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2eswm\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2edwm\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2eesd\x3d01\x3b38\x3b2\x3b255\x3b121\x3b198\x3a\x2a\x2ejpg\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2ejpeg\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2emjpg\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2emjpeg\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2egif\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2ebmp\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2epbm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2epgm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eppm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2etga\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2exbm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2expm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2etif\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2etiff\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2epng\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2esvg\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2esvgz\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2emng\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2epcx\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2emov\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2empg\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2empeg\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2em2v\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2emkv\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2ewebm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2ewebp\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eogm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2emp4\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2em4v\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2emp4v\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2evob\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eqt\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2enuv\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2ewmv\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2easf\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2erm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2ermvb\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eflc\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eavi\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2efli\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eflv\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2egl\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2edl\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2excf\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2exwd\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eyuv\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2ecgm\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eemf\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eogv\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eogx\x3d01\x3b38\x3b2\x3b189\x3b147\x3b249\x3a\x2a\x2eaac\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2eau\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2eflac\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2em4a\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2emid\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2emidi\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2emka\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2emp3\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2empc\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2eogg\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2era\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2ewav\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2eoga\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2eopus\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2espx\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a\x2a\x2exspf\x3d00\x3b38\x3b2\x3b241\x3b250\x3b140\x3a +SETUVAR __fish_initialized:3400 +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_host_remote:yellow +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: +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/functions/cd.fish b/functions/cd.fish new file mode 100644 index 0000000..53b8d45 --- /dev/null +++ b/functions/cd.fish @@ -0,0 +1,10 @@ +# Modified cd that also displays the directory's contents if the listing is less than 5 lines long +function cd + if test -n "$argv" + if test -e $argv -a ! -d (realpath $argv) + set argv (dirname $argv) + end + end + builtin cd $argv + and test (ls -C -w $COLUMNS |wc -l) -le 5; and ls +end diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish new file mode 100644 index 0000000..a61830a --- /dev/null +++ b/functions/fish_prompt.fish @@ -0,0 +1,7 @@ +function fish_prompt + printf "\e[37m%s\e[38;5;123m%s" (hostname) (prompt_pwd) + if test $VIRTUAL_ENV + printf " \e[37m(%s)" (basename $VIRTUAL_ENV) + end + printf " \e[38;5;212m<3\e[0m " +end diff --git a/functions/fish_right_prompt.fish b/functions/fish_right_prompt.fish new file mode 100644 index 0000000..4fc17d1 --- /dev/null +++ b/functions/fish_right_prompt.fish @@ -0,0 +1,10 @@ +function fish_right_prompt + set stat $status + + printf "\e[38;5;244m%s\e[0m " (date +%H:%M) + + if test $stat -ne 0 + printf "\e[91m(%d) " $stat + end + printf "\e[37m%s\e[0m" (__fish_git_prompt "%s") +end diff --git a/functions/fish_user_key_bindings.fish b/functions/fish_user_key_bindings.fish new file mode 100644 index 0000000..6caad84 --- /dev/null +++ b/functions/fish_user_key_bindings.fish @@ -0,0 +1,5 @@ +function fish_user_key_bindings + bind \co sudo-execute + bind \cv foreground-vi + bind \cq quote-word +end diff --git a/functions/foreground-vi.fish b/functions/foreground-vi.fish new file mode 100644 index 0000000..e05cfe6 --- /dev/null +++ b/functions/foreground-vi.fish @@ -0,0 +1,3 @@ +function foreground-vi + fg %vi >/dev/null +end diff --git a/functions/md.fish b/functions/md.fish new file mode 100644 index 0000000..9de46ed --- /dev/null +++ b/functions/md.fish @@ -0,0 +1,4 @@ +function md + mkdir "$argv" + cd "$argv" +end diff --git a/functions/quote-word.fish b/functions/quote-word.fish new file mode 100644 index 0000000..0205273 --- /dev/null +++ b/functions/quote-word.fish @@ -0,0 +1,4 @@ +function quote-word -d "Command line editor function that cycles between 'quoting' \"styles\" for the current word" + commandline -t (commandline -t|sed 's/^\'\(.*\)\'$/\1/;t;s/^"\(.*\)"$/\'\1\'/;t;s/^\(.*\)$/"\1"/') + commandline -f repaint +end diff --git a/functions/sa.fish b/functions/sa.fish new file mode 100644 index 0000000..bcaf761 --- /dev/null +++ b/functions/sa.fish @@ -0,0 +1,3 @@ +function sa + ssh-add "$HOME/.ssh/id_rsa.$argv" +end diff --git a/functions/sudo-execute.fish b/functions/sudo-execute.fish new file mode 100644 index 0000000..3e3a463 --- /dev/null +++ b/functions/sudo-execute.fish @@ -0,0 +1,5 @@ +function sudo-execute -d "Command line editor function that prepends the current commandline with \"sudo\" and executes it afterwards" + commandline sudo\ (commandline | sed 's/^\W*sudo\?\W*//') + commandline -f repaint + commandline -f execute +end diff --git a/prompt_settings.fish b/prompt_settings.fish new file mode 100644 index 0000000..18fd209 --- /dev/null +++ b/prompt_settings.fish @@ -0,0 +1,7 @@ +set -g __fish_git_prompt_showuntrackedfiles "" +set -g __fish_git_prompt_showdirtystate "" +set -g __fish_git_prompt_showupstream "auto" + +set -g __fish_git_prompt_char_upstream_ahead "↑" +set -g __fish_git_prompt_char_upstream_behind "↓" +set -g __fish_git_prompt_char_upstream_prefix "" -- cgit