Add some helpers for getting most recent file in directory (and editing)

Great for when you just wanna look at the latest log in a dir without
tab-completing through long dates in the filename.
This commit is contained in:
Daniel Flanagan 2019-10-11 11:57:13 -05:00
parent 3490ebdd59
commit f48c3a36a5

View file

@ -17,6 +17,19 @@ alias f='fzf'
alias cp="rsync -ah --progress" alias cp="rsync -ah --progress"
alias year="cal $(date +%Y)" alias year="cal $(date +%Y)"
# gets the newest function for the current directory (or the specified directory
# if one is provided)
function ltl() {
local d="${1-$PWD}"
unset -v l
for f in "$d"/*; do
[[ $f -nt $l ]] && [[ ! -d $f ]] && l="$f"
done
echo "$l"
}
alias vltl="vim \"\$(ltl)\""
# navigation aliases # navigation aliases
function c() { function c() {
if [[ -n $1 ]]; then if [[ -n $1 ]]; then