How to yank an entire block in Vim?


Is it possible to yank an entire block of Python code in Vim?

Be it a def, for, if, etc. block...

6/23/2012 12:06:01 AM

Accepted Answer

You can yank a paragraph with y}. This will not yank all the methods if you have a blank line though.

6/23/2012 12:06:41 AM

The excellent add-on suite Python-mode includes some key commands to navigate classes, methods, and function blocks.

  • To yank a method: yaM (inner method: yiM)

  • To yank a class: yaC

There are other handy motions, like moving from function-to-function (]]). See the complete list of keys for more.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow