Initial commit

This commit is contained in:
jaseg 2020-11-04 17:35:19 +01:00
commit 29daecb0ce
23 changed files with 3745 additions and 0 deletions

10
fish/functions/cd.fish Normal file
View file

@ -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

View file

@ -0,0 +1,7 @@
function fish_prompt
printf "\e[37m%s\e[96m%s" (hostname) (prompt_pwd)
if test $VIRTUAL_ENV
printf " \e[37m(%s)" (basename $VIRTUAL_ENV)
end
printf " \e[91m<3\e[0m "
end

View file

@ -0,0 +1,7 @@
function fish_right_prompt
set stat $status
if test $stat -ne 0
printf "\e[91m(%d) " $stat
end
printf "\e[37m%s\e[0m" (__fish_git_prompt "%s")
end

View file

@ -0,0 +1,5 @@
function fish_user_key_bindings
bind \co sudo-execute
bind \cv foreground-vi
bind \cq quote-word
end

View file

@ -0,0 +1,3 @@
function foreground-vi
fg %vi >/dev/null
end

4
fish/functions/md.fish Normal file
View file

@ -0,0 +1,4 @@
function md
mkdir "$argv"
cd "$argv"
end

View file

@ -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

3
fish/functions/sa.fish Normal file
View file

@ -0,0 +1,3 @@
function sa
ssh-add "$HOME/.ssh/id_rsa.$argv"
end

View file

@ -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