Skip to content

Instantly share code, notes, and snippets.

@dmerejkowsky

dmerejkowsky/latest.zsh

Last active Aug 25, 2017
Embed
What would you like to do?
Insert most recent file in current command line
# Display most recent file in the current directory
function latest() {
echo $(ls --quoting-style=shell -t | head -n1)
}
# Insert most recent file in the current line
latest-file-widget () {
LBUFFER="${LBUFFER} $(latest)"
local ret=$?
zle redisplay
return $ret
}
zle -N latest-file-widget
bindkey '^[l' latest-file-widget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.