@kyanny's blog

My thoughts, my life. Views/opinions are my own.

今日のPerlMonks


I use vim as my editor, and it's been driving me crazy: I use smartindent which means after I type this: if(some_condition()) { and press enter, it automatically tabs me in the correct number of tabs to line up my next line of code. However, if I then type a # character to start a comment, it jumps the cursor to the beginning of the line and then shows the character on the screen. So if I am 3 tabs in, and I press a #, it automatically jumps me to the 0th character of the line. Anybody know how to fix this? Here are my customized vim settings (I'm assuming everything else is the default - and by the way, I use gvim (vim-gtk package in Debian)).

えー・・・つまり


while(1)
{
$i++;
# ラーメン食いたいなァ ← ここ
last if $i>100;
}
こう書いたときに「ここ」の行の行頭に#を書いてコメント行にしようとするとインデントがずれるっていう話でしょ。それはわかるんだけどそれ全くPerlと関係ない話題じゃんか。vim.orgにも同じようなBBSはないのか?そもそも he:smartindentしろとか言われてるし。

ちなみに#ではじまるコメント行を書いて改行すると次の行の行頭にも#が挿入されるのだが、これはCTRL-hすると消せるよというのもFAQっぽくていたるところで見かけたな。Backspaceキーを押したのと同じこと、という理解でいいんだろうか。