{"id":50,"date":"2014-08-03T00:00:38","date_gmt":"2014-08-02T22:00:38","guid":{"rendered":"http:\/\/kurt.www.pinboard.jp\/blog\/?p=50"},"modified":"2014-07-20T15:57:32","modified_gmt":"2014-07-20T13:57:32","slug":"comments-in-scripts","status":"publish","type":"post","link":"http:\/\/kurt.www.pinboard.jp\/blog\/kurt\/50\/","title":{"rendered":"comments in scripts"},"content":{"rendered":"<p>When writing scripts, I prefer to have my comments aligned with the code. However, as I use <code>smartindent<\/code>, vim always moves me to the first column whenever I start a line with hash. Annoying.<!--more--> This annoyance can be disabled, however, with a small entry in your <code>.vimrc<\/code> configuration file:<\/p>\n<pre style=\"background-color: lightyellow; color: green;\">:inoremap # X^H#\r\n                        \" do not move to left margin when the first character\r\n                        \" of a line is # and smartindent is set\r\n<\/pre>\n<p>Be careful, the <code>^H<\/code> part is not two characters but one single control character! In vim you can enter it with <code>CTRL-v<\/code> followed by <code>H<\/code>.<\/p>\n<p>Don&#8217;t ask me what exactly this setting does. It is remapping what happens when you type a hash mark in insert mode. Instead of what was done before, it will type an X, then a backspace and then the hash character. This way the first character typed on the line is no longer the hash mark. But how exactly this works, I don&#8217;t know either.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When writing scripts, I prefer to have my comments aligned with the code. However, as I use smartindent, vim always moves me to the first column whenever I start a line with hash. Annoying.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[8],"_links":{"self":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/50"}],"collection":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":2,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":52,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions\/52"}],"wp:attachment":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}