问题
Is it possible without any plugins? Or what's the best plugin for edit python file?
回答1:
try vis to visualy select and o to jump edges
回答2:
With this plugin https://github.com/bps/vim-textobj-python you can select, delete, change, etc:
af: a function
if: inner function
ac: a class
ic: inner class
回答3:
The way I do it is not specific to functions. It will just select a continuous code of Python code:
v]] if what you want to select is below the cursorv[[ if it is above the cursor.
Just remove one bracket if the cursor is on the first line of the code block you want to select.
回答4:
I assume you mean visually selecting the whole function quickly. One way is to use Indent text object. You can use vai to select the whole function, provided your cursor is inside the function and only 1 indentation level lower.
If you really want select function regardless of indentation level, I suggest you read this and write your own text object. I imagine it would be quite easy since Python has def keyword for defining function.
回答5:
you have to use omnicompletion for vim7 but it's only working with vim-nox, vim-gtk, vim-gnome o vim-athen
also read throu this page for configuring vim with python (autoindend, syntax highlight and autocompletion)
来源:https://stackoverflow.com/questions/6579723/whats-the-fastest-way-to-select-a-function-of-python-via-vim