{"id":1647,"date":"2009-09-23T14:46:17","date_gmt":"2009-09-23T21:46:17","guid":{"rendered":"http:\/\/arcanius.silverfir.net\/blog\/?p=1647"},"modified":"2009-09-26T14:51:46","modified_gmt":"2009-09-26T21:51:46","slug":"mac-os-x-terminal-screen-and-ctrl-arrow-keys","status":"publish","type":"post","link":"https:\/\/arcanius.silverfir.net\/blog\/mac-os-x-terminal-screen-and-ctrl-arrow-keys\/","title":{"rendered":"Mac OS X, Terminal, Screen, and Ctrl-Arrow Keys"},"content":{"rendered":"<p>I have had a number of frustrations since I started at Facebook in adapting to the quirks of Mac OS X. I have been in Windows-land for so long that I consider its quirks normal, so figuring out the quirks of OS X has at times been frustrating. Nevertheless, I think I am making good progress.<\/p>\n<p>I am using GNU screen while logged in to linux machines extensively during work, so I invested a little time in setting up a good screenrc. Afterwards, I noticed that I was unable to get the screens to switch using ctrl-left and ctrl-right the same way I would be able to from a Windows machine.<\/p>\n<p>After being frustrated with trying to get Terminal to send the right control characters, and getting screen to recognize them using bindkey, I took a step back and found a solution that actually works. Despite its failings at behaving like PuTTY in every respect, Terminal does offer a lot of customizations, including the ability to change what control characters get sent when you press control-left and control-right, for example. So instead of trying to divine the right bindkey option for Mac OS X (which no one seems to have succeeded at as far as I can tell), I took another approach:<\/p>\n<p>I told Terminal to send &#8220;ctrl-a p&#8221; (\\001ap) for ctrl-left, and &#8220;ctrl-a n&#8221; (\\001n) for ctrl-right. This makes hitting those keys the equivalent of going to the previous and next screens manually, but without the manual part. Of course, if you use a different control character for your screen, you will want to use that instead of ctrl-a as I did, but this finally got screen to behave the way I wanted, which makes me quite happy.<\/p>\n<p>For reference, my screenrc looks like this right now:<\/p>\n<pre>vbell off\r\nautodetach on\r\nstartup_message off\r\ndefscrollback 10000\r\n\r\nhardstatus alwayslastline\r\nhardstatus string '%{= kG}%-Lw%{= kW}%50&gt; %n*%f %t%{= kG}%+Lw%&lt; %{= kG}'<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have had a number of frustrations since I started at Facebook in adapting to the quirks of Mac OS X. I have been in Windows-land for so long that I consider its quirks normal, so figuring out the quirks of OS X has at times been frustrating. Nevertheless, I think I am making good [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[29,8],"class_list":["post-1647","post","type-post","status-publish","format-standard","hentry","category-everything","tag-linux","tag-technology"],"_links":{"self":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/1647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/comments?post=1647"}],"version-history":[{"count":4,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/1647\/revisions"}],"predecessor-version":[{"id":1661,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/1647\/revisions\/1661"}],"wp:attachment":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/media?parent=1647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/categories?post=1647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/tags?post=1647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}