1

in vimgolf challenge Words in parens .I use 'cw(ctrl-r")Esc' to format "one", then use 'w.' to format next two words, but the results are three "(one)", I use ':reg' command confirm '"' register content equal "three", and I find another solution to format correctly, just use 'cw(ctrl-r ctrl-o")Esc' to format "one", then use 'w.' to format next two. But I'm still confused about vim dot command in this case, why dot command act result not same as full type in first way, there's must have something I missed about vim dot command, hope someone give me explanation about this case.

  • 2
    Have you read the help at :help c_CTRL-R_CTRL-O? I think it explains the difference pretty well – Christian Brabandt Jan 4 '18 at 12:17
  • In this case I think one should read :help i_CTRL-R_CTRL-O. I think this is a good question, because based on the content, I would think i_CTRL-R_CTRL-R should work similar to i_CTRL-R_CTRL-O, but it does not. It is not easy to understand why. Based on the docs, it seems the only difference is autoindent. But only i_CTRL-R_CTRL-O works as expected with the dot repeat. – Karl Yngve Lervåg Jan 4 '18 at 13:54
  • @ChristianBrabandt I already read this in vim before,<C-r>" is insert last delete or yank text, so 'w.' should same as 'wcw(<C-r>")Esc', then the last delete text became "two", so the 'w.' act result should "(two)" not "(one)", I don't know why – 9-bits Jan 5 '18 at 3:25
  • @ChristianBrabandt I confirm not set 'textwidth', 'formatoptions', or 'autoindent' in vimrc – 9-bits Jan 5 '18 at 3:33
  • @9-bits if you could create a reproducible example that would certainly help :) – Christian Brabandt Jan 5 '18 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.