Suppose I have the following text (cursor is in middle of first word 'begin.'
blah blah blah blah stuff stuff stuff
\\\begin{tabular}
{
|p{0.25\textwidth}
|p{0.2\textwidth}
|p{0.5\textwidth}
|}
\hline
Item & Type & Notes\\\hline
Text text text text text text text text &
Text text text text text &
Text text text text text text text text text text text text text text text text text
text text text text text text\\\hline
Installation instructions &
.txt / .html / TBD &
Installation help should be conspicuous but not the central item\\\hline
\end{tabular}
blah blah blah more stuff more stuff
I want to cut the table out and move it somewhere else. The lines are actually much longer so they wrap several times and I can't easily determine how many lines I want to cut.
I type
d
2
/
a
r
}
/
e
⏎
to delete until the second match of "ar}" stop at the 'e'nd of the pattern.
But this grabs from the middle of the word 'begin' to the end of where I want to cut. I'd like to grab complete lines and I feel like there should be a shortcut for this in under 6 keystrokes. I'm not using Latex-VIM because it doesn't like my standard Windows installation of GVIM so no, I can't (as far as I know) easily grab from the \begin
to the \end
. I'd love to be proven wrong on that.
Yes, this question is potentially a crossover of StackExchange sites including Tex, StackOverflow, and Unix. Feel free to suggest a better site for asking this.
Best Answer
With an Ex command:
Breakdown:
:{range}command{address}
..
but it can be skipped like here, and we finish with a pattern matching\end
.d
elete the lines in that range.With a combination of search and contextual marks:
Breakdown:
\e
.d
elete from here to the line of the previous cursor position.With visual mode:
Breakdown:
\e
.d
elete the lines in the selection.Variation of the method above with an Ex command instead of a normal mode command:
Breakdown:
\e
.:
, the'<,'>
range is inserted automatically.d
elete the lines in the selection.