Jump to content

Wikipedia:Reference desk/Archives/Computing/2016 October 28

From Wikipedia, the free encyclopedia
Computing desk
< October 27 << Sep | October | Nov >> October 29 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


October 28[edit]

How do I use vi on the new macbookpro without an escape key?[edit]

175.45.116.104 (talk) 05:33, 28 October 2016 (UTC)[reply]

Ctrl-[ is equivalent to Esc. Assuming that Macs have a Ctrl key. LongHairedFop (talk) 09:59, 28 October 2016 (UTC)[reply]
The touch bar is reconfigured by the keyboard-focus-owning application. Presumably the terminal emulator application will put an ESC key on it, in the normal place. In Apple's developer introduction to the Touch Bar API they show an app with just that. Given how heavily vi uses ESC (I can't think of any program that routinely uses it as much) it may prove to be a bit annoying for the key to lose the tactile feedback of a physical key. -- Finlay McWalter··–·Talk 12:22, 28 October 2016 (UTC)[reply]
The vim wiki has been recommending avoiding the escape key since at least 2002: http://vim.wikia.com/wiki/Avoid_the_escape_key --Guy Macon (talk) 12:57, 28 October 2016 (UTC)[reply]
Another solution: http://www.jeffgeerling.com/blog/2016/apple-giveth-and-apple-taketh-away-escape-key-macbook-pro --Guy Macon (talk) 13:00, 28 October 2016 (UTC)[reply]
I use Mac Book Pros ... quite extensively. I am also an avid vi enthusiast. For the uninitiated, the escape key is very important for users of the vi text editor; the new Mac Book Pro, announced yesterday, has removed the Escape Key and replaced it with a digital key row called "Touch Bar." Most mortals who will use Apple's new Touch Bar equipped Mac Book Pro don't need to worry - the Touch Bar's escape key will "just work," in proper Apple fashion.
Indeed, it is wise to learn about the key-chord "ctrl-[" which will escape to the vim command-line. Ctrl+[ provides an escape-sequence to the escape-key. This is useful anyway - there are conditions on any computer where you might need an alternate key sequence.
When you are using a Mac equipped with Touch Bar and you are using vim, the Escape key is always available on the Touch Bar's virtual key layout, where you would expect it to be. This was actually described in the full Apple presentation yesterday - the October 2016 event. The Touch Bar's key layout depends on the application you are using, and there is even special support for Terminal.app.
If you use gVim, you might opt to use the UI menus in certain circumstances - but if you use gVim, you aren't really a keyboard-shortcut fanatic, are you?
Nimur (talk) 16:52, 28 October 2016 (UTC)[reply]
I'm not sure how that last bit follows. I use gvim, and hardly ever use the mouse with it. I prefer it over straight vi for what you can say are fairly trivial reasons, I suppose: I like that it spawns a new window, so that I can keep working in the window I started it from, and I like the colors better (sure, I could probably configure that in .vimrc, but why should I bother?). --Trovatore (talk) 19:11, 28 October 2016 (UTC)[reply]
That's fair. The real take-away is that the unique and specially-designed Touch Bar behaviors that apply in Terminal.app do not automatically occur in gVim (because gVim is not running inside Terminal.app).
The escape key, however, is available in both cases.
I am extraordinarily happy to see that developer documentation was published this morning, so all of the officially-supported behaviors are now committed to the public, by way of published API.
Nimur (talk) 21:20, 28 October 2016 (UTC)[reply]