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 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, then strg+right jumping a word to the right, and then del for deletion of the second quote.

I seem to struggle with this one in vim. First row no problem, 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/
    

    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 pears with apples.

    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.