![]() ![]()
While I was working my way through the default Emacs keybindings I noticed some shortcuts in Emacs I’d never thought about.įile file is bound to: Ctrl-x Ctrl-f (release Ctrl between typing x and f) This macro tries to emulate how Emacs deletes lines by first selecting the entire line, cutting it and then deleting it. keyStroke ( nil, 'right' ) end hotkeyModal : enter () clearCtrlX () end hotkeyModal : bind ( ![]() keyStroke ( 'cmd', 'o' ) else print ( 'Moving cursor forward.' ) hs.eventtap. doAfter ( 1, clearCtrlX ) end function clearCtrlX () print ( 'Clearing ctrlXActive flag.' ) ctrlXActive = false end function forwardOrOpen () hotkeyModal : exit () if ctrlXActive then print ( 'Opening file.' ) hs.eventtap. modal.new () function startCtrlX () ctrlXActive = true hs.timer. Local ctrlXActive = false local hotkeyModal = hs.hotkey. Text selection in AutoHotkeyįirst I set out to see if AutoHotkey could emulate Emacs style text selection. HAMMERSPOON AUTOHOTKEY SCRIPT CODEHammerspoon and AutoHotkey had potential, but I needed to make sure they could do what I wanted, so I wrote some experimental code in these new environments. AutoHotkey A scripting language that intercepts keystrokes and mouse events (Windows).Hammerspoon A Lua based scripting language to intercept keystroke and mouse events (Mac).These scripts didn’t solve the problems of selecting text or chord keys, but they were written in two apps / frameworks that were new to me. Next I searched Github for solutions and I found some interesting, scripts. Prefix keys or chords shortcuts involving a modifier key and two other keystrokes such as Ctrl+xs (save).Selecting text with Ctrl+Space (start mark), move down a few lines to expand the text selection and Ctrl+Space (end mark). HAMMERSPOON AUTOHOTKEY SCRIPT FOR MACFor example Ctrl+a is mapped to the start of the line character just like Emacs.īoth XKeymacs and the default shortcuts for Mac failed to support two important Emacs features: On Mac I couldn’t find any app to solve the problem, but OSX supports most Emacs shortcuts out of the box. For Windows I found XKeymacs which described it self as “a keyboard utility to realize Emacs like-usability on all windows applications”. ![]() I started by looking for something I could download or buy to solve the problem. Would it be possible to use Emacs shortcuts to control both operating systems in the same way? Are there any apps that already do this? Navigating text starts by holding down a modifier key such as Ctrl or Alt and your hands never leave the home row. Once inside Emacs you enter another world of keyboard shortcuts. Instead of memorizing these differences I wondered if there was a better solution. Copy and paste can be dealt with by changing settings in the OS, but other shortcuts are quite different such as Cmd+q and Alt+F4 (quit an app). Some differences are easy to workaround such as Ctrl+c and Cmd+c (copy). ![]() But there was one frustrating aspect of switching back to Windows, keyboard shortcuts. Having Ubuntu in your terminal is handy because it more closely resembles the servers I deploy my code to. I was pleasantly surprised with Ubuntu on Windows 10. HAMMERSPOON AUTOHOTKEY SCRIPT FOR WINDOWS 10When Microsoft released Ubuntu for Windows 10 I took the opportunity to try web development on Windows after 8 years on a Mac. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |