When i use dired mode in emacs, I can run a shell command by type !xxx, But how to bind a key to run this command?
For example, I want to press O on a file, then dired will run ‘cygstart’ to open this file.
When i use dired mode in emacs, I can run a shell command by
Share
You can use the
shell-commandfunction. For example:To define a command in a single buffer, you can use
local-set-key. In dired, you can get the name of the file at point usingdired-file-name-at-point. So, to do exactly what you asked: