diff --git a/fish/.config/fish/functions/lo.fish b/fish/.config/fish/functions/lo.fish new file mode 100644 index 0000000..b4d61b1 --- /dev/null +++ b/fish/.config/fish/functions/lo.fish @@ -0,0 +1,13 @@ +function lo --description 'Open a .log file in /tmp or given path' + if count $argv >/dev/null + set logpath "$argv" + else + set logpath /tmp + end + + find $logpath -maxdepth 1 -regextype posix-extended -regex ".*\.(log)" -printf '%T@ %p\n' | sort -k 1 -n -r | fzf --bind "ctrl-d:half-page-down,ctrl-u:half-page-up" | awk -F' ' '{print $2}' | read -l result + + if test -n "$result" + nvim "$result" + end +end