Last active
August 25, 2017 18:57
-
-
Save dmerejkowsky/972c51582d75a3f019fb0ca11707911b to your computer and use it in GitHub Desktop.
Insert most recent file in current command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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