01 April 2014

When I'm using doublecmd to manage files and folders, I frequently open the folder in cmd.exe or cygwin terminal mintty for managing the file with svn, git or other command line tools. Thus I create two shortcuts for the two applications: F9 and Shift-F9.

When I press F9, an windows cmd will open for me, and Shift-F9, a mintty terminal is available for me. Cygwin mintty is a comfortable terminal in windows. Chad Austin has written a blog about Why mintty is the best terminal on Windows1.

The same requirement is needed when I'm using emacs, thus I created two elisp function to handle this tasks. Please be reminded that these functions are only applied to windows environment.

(global-set-key [f9] 'kimim/cmd)
(global-set-key  (kbd "S-<f9>") 'kimim/cyg)

(defun kimim/cmd ()
  "Open cmd.exe from emacs just as you type: Win-R, cmd, return."
  (interactive)
  (w32-shell-execute 
   "open" "cmd"))

(defun kimim/cyg ()  
  "Open cygwin mintty from emacs."  
  (interactive)  
  (w32-shell-execute 
   "open" "mintty" " -e bash"))

By the way, below is the doublecmd configuration screenshot:

  • Shortcut configuration for cmd.exe:
cmd_doublecmd
  • Shortcut configuration for mintty:
mintty_doublecmd