Is it possible to yank an entire block of python code in vim? be it a def, for, if, etc. block..
+4
A:
You can yank a paragraph with y}. This will not yank all the method if you have blank line though.
Vincent
2009-10-07 13:15:24
You can use Ctrl-v and y} to see which lines will be yanked. You can press } as you want to cover your block.
noomz
2009-10-07 13:24:48
+3
A:
There's a vim add-on script python_fn.vim which has, as one of its functions, a key binding to visually select a block of Python code using ]v
. You could then yank it with y
as normal.
Adam Bellaire
2009-10-07 13:15:30
+2
A:
I usually just use visual block mode. Shift-V, move, and 'y'ank the highlighted block. There's only so many shortcuts I can keep in memory at once :)
JimB
2009-10-07 14:27:09
+1
A:
You can combine a search with yank, so if your function ends with return retval
you can type y/return retval
gnibbler
2009-10-08 00:32:07