/_posts/2013/2013-02-20-using-unix-terminal-keyboard-shortcuts-in-the-windows-command-prompt.md

https://github.com/jpoehls/jpoehls.github.com · Markdown · 27 lines · 20 code · 7 blank · 0 comment · 0 complexity · 462dfa00608fde35ecddccd71940a638 MD5 · raw file

  1. ---
  2. title: Using Unix terminal shortcuts in the Windows command prompt
  3. layout: post
  4. categories: powershell autohotkey windows
  5. description: "Unix terminals have a few basic keyboard shortcuts that the Windows command prompt doesn't support. I'll show you how to fix that with AutoHotkey."
  6. redirect_to: http://joshua.poehls.me/2013/using-unix-terminal-keyboard-shortcuts-in-the-windows-command-prompt
  7. ---
  8. Unix terminals have a few basic keyboard shortcuts.
  9. * `CTRL+L` to clear the window
  10. * `CTRL+D` to close the window
  11. * `CTRL+V` to paste text
  12. The Windows command prompt doesn't support these by default but we can fix that with [AutoHotkey](http://www.autohotkey.com).
  13. _If you don't already have it installed, you can follow the steps in [my blog post]({{site.url}}/2011/use-autohotkey-to-remap-your-numpad-keys-to-something-useful/)._
  14. Add this magic to your AutoHotkey script to enable these shortcuts in the Windows command prompt and PowerShell.
  15. <pre>#IfWinActive ahk_class ConsoleWindowClass
  16. ^L::SendInput , {Esc}cls{Enter}
  17. ^D::SendInput , {Esc}exit{Enter}
  18. ^V::SendInput , {Raw}%clipboard%
  19. #IfWinActive</pre>
  20. Back away from the mouse, my friends.