Is it possible to add certain lines to a visual selection via an EX-mode command?
I have text in the following form:
+----------+-----------+
| Some text| other text|
+----------+-----------+
| More text||
| And even more ||
| - ...||
+----------+-----------+
And I want the text to be displayed like this:
+---------------+------------+
| Some text | other text |
+---------------+------------+
| More text | |
| And even more | |
| - ... | |
+---------------+------------+
Using the tabular plugin when I delete the lines with + via the following workflow works:
g!/+/d
// Visually select the remaining lines
Tab /|
// Manually insert the +----+----+ lines
I was wondering if there is a way to keep the delimiting lines and visual-select the lines not containing a + via EX-Mode like :g!/+/ add-line-to-visual-selection.
You could use:
You can find help for
\|in:help /\|or more globally:help pattern, it is the standard way to express alternation in Vim Regular Expressions. So/|\|+/is a pattern with delimiters that matches either|or+. (Reading the whole:help patternhas excellent return on investment, FYI).Concerning the
/l1in the Tabular plugin, you can read the help of the plugin more in depth, it will add space after separator and left-align text.