Reputation: 3158
I have the following HTML:
1 <div>
2 <p>This is a paragraph</p>
3 <p>This is the second paragraph</p>
4 </div>
If I do not have my cursor anywhere near the above item and try to yank
:1yat
:1yit
:2yit
None of the above commands work. Any idea how I can yank inner/outter div elements without moving the cursor (#extremelaziness)?
Thank you
Upvotes: 0
Views: 48
Reputation: 15091
Vim is commonly called "modal" editor, because it has modes. What it truly means is that all the commands and keyhits are different between different modes. That's the main point which must be learnt by anyone who uses Vim.
In your case yat
and such belong to the Normal mode, while :
switches into Command-line mode. While in the Command-line mode you can only execute its commands.
Of course, there is :normal
which serves as a sort of "bridge" between Normal and Command-line, however it's primarily used in scripting as typing :1norm yat
looks like anything but #extremelaziness.
So you have either to write some custom command yourself or to keep typing 2ggyat<C-O>
and such.
Upvotes: 1