0

I've started using the jVi VIM emulator plugin in Netbeans. One feature that I miss from before I installed that plugin was the ability to select a word or words and surround them with quotes, parentheses or brackets by hitting quote, parenthesis or bracket key.

Is there a quick way to do this with jVi enabled?

bconrad
  • 402
  • 4
  • 14

1 Answers1

0

This can be done through keymapping. For example the following map command

:vnoremap /" <Esc>`>a"<Esc>`<lt>i"<Esc>

Creates a mapping that is valid in visual mode. If, with a visual mode selection, you type the two character sequence

/"

Then the current visual selection is surrounded by double quotes. You can construct similar mappings for the other characters you mentioned. A two character mapping is not required here, but it avoids interfering with normal vi operation.

The first takes jVi out of visual mode. The

`> and `<lt> 

refer to the end and start of the previous visual selection.

This could also be done with a p*map command, if you really wanted to use the mouse to select the characters. In that case, you would want to first go into visual mode with the "v" command since there is currently no way in jVi to refer to the start and end of a platform selection. That would be a nice enhancement.

Ernie Rael
  • 534
  • 7
  • 11