Skip to content

Instantly share code, notes, and snippets.

@Drezil
Last active January 15, 2020 08:46
Show Gist options
  • Save Drezil/7022e13c052d989f95142870c7d58187 to your computer and use it in GitHub Desktop.
Save Drezil/7022e13c052d989f95142870c7d58187 to your computer and use it in GitHub Desktop.
Fish-functions
function first
for file in $argv
echo "$file"
dd if="$file" count=25 status=none | head -n1
echo ""
end
end
function groupby
for o in (cut -d ',' -f 1 $argv[1] | uniq)
echo -n "{\"$o\":["
grep "$o," "$argv[1]" | cut -d ',' -f 2 | sed 's/^\(.*\)$/"\1"/' | tr '\n' ','| sed 's/,$//'
echo "]}"
end
end
function man --description 'Format and display the on-line manual pages'
set -l manpath
if set -q MANPATH
set manpath $MANPATH
else
set manpath ''
end
# Notice the shadowing local exported copy of the variable.
set -lx MANPATH $manpath
# Prepend fish's man directory if available.
set -l fish_manpath (dirname $__fish_data_dir)/fish/man
if test -d $fish_manpath
set MANPATH $fish_manpath $MANPATH
end
set -lx LESS_TERMCAP_mb (printf "\e[1;33m")
set -lx LESS_TERMCAP_md (printf "\e[1;31m")
set -lx LESS_TERMCAP_me (printf "\e[0m")
set -lx LESS_TERMCAP_se (printf "\e[0m")
set -lx LESS_TERMCAP_so (printf "\e[1;44;33m")
set -lx LESS_TERMCAP_ue (printf "\e[0m")
set -lx LESS_TERMCAP_us (printf "\e[1;32m")
command man $argv
end
function now
date "+%F_%T"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment