intellij-ideavimideavim

IdeaVim multiline editing


I am working with IntelliJ and IdeaVim. I often end up in a case, where I need to change a JSON file from

{
  "key": "value",
  "keytwo": "value"
}

to

{
  key: "value",
  keytwo: "value"
}

Working with IntelliJ, I could easily use the multi-cursor function for deleting the quotes in the first row, by Ctrl + right jumping a word to the right and Del for deletion of the second quote.

I seem to struggle with this one in Vim. The first row isn't a problem. Use Ctrl + V marking block and X. But the remaining quotes are not in the same row. If I do f", the complete block is selected.

How do I do this, without using repeating actions and without using macros? Or is IntelliJ nowadays superior to Vim (I doubt it)?


Solution

  • Visually select the two lines you want to change using, e.g., Vj and then :substitute using

    :'<,'>s/"\(\w*\)"/\1/
    

    It removes the quotes around the first word in the line.

    To address the comparison with IntelliJ: Vim is an editor, not an IDE. So that's apples and oranges.

    Vim offers robust support for line-wise operations (like the one above). What it supports only through plugins is gimmicks functionality like multi-cursor editing. If things like that rock your boat, go ahead and install that plugin.

    If you want to have full IDE functionality, use an IDE.