I'm trying to define a function so that I can launch Midnight Commander by pressing Alt-, but the function just doesn't work.
I found and modified a function on another site and modified it so:
function _midnight {
zle kill-whole-line
zle -U "mc"
zle accept-line
}
zle -N _midnight
bindkey '\e,' _midnight
And this is what I think I'm telling it to do:
define _midnight as {
erase everything on the line
insert "mc" on the command line
execute as a shell command
}
create _midnight as a custom widget
bind alt-comma to the widget
What it actually does is just send a carriage return and then insert mc on the next line, without sending it.
The reason I'm using this instead of bindkey -s '\e,' '^Umc^M is because I'd eventually like to find a way to run Midnight Commander without anything appearing on the command line.