Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resources concerning Python scripting in Vim

Tags:

python

vim

People also ask

How do I create a Python script in vim?

Write Your Python Script To write in the vim editor, press i to switch to insert mode. Write the best python script in the world. Press esc to leave the editing mode. Write the command :wq to save and quite the vim editor ( w for write and q for quit ).

Is vim good for Python programming?

Why is Vim a good Python development environment? Vim's philosophy is that developers are more productive when they avoid taking their hands off the keyboard. Code should flow naturally from the developer's thoughts through the keyboard and onto the screen.

Which Python is vim using?

Currently -python and -python3 seem to be the default for the Debian vim package. If you need vim support for scripting languages, install vim-nox , which is dedicated to them and therefore has (among other things) +python3 enabled.

How do I import a python module in vim?

You can use Gutentags plugin for automatic tags management. Type :ImportName [<name>] to add an import statement at the top of the file. Type :ImportNameHere [<name>] to add an import statement above the current line. Needs Vim 7.0, preferably built with Python support.


Here is all I know of in terms of such docs:

  • A nice presentation by Sean Reifschneider
  • The "official" VIM Python Interface reference
  • some shorter notes
  • Extending Vim With Python

:help python-vim is a good start. The best vim resource is always at your fingertips and the sooner you get used to referring to it the better you will get at vim overall.

I got better at searching vim help with this..

How do I make vim do normal (bash like) tab completion for file names?

also :he vim-script-intro

I'd also recommend looking straight at the source of existing plugins that do something similar to what you want to do. That way you cut out the middle man and dont have to deal with blog ads and other distractions.


Vimscript The Hard Way

Have you checked out Learn Vimscript The Hard Way? It is an excellent read.

Scripting Vim With Python

vim 7.0 and above can be compiled with the +python flag, which gives vim Python support. This is a (albeit, somewhat extreme) path to getting the language support you want.

Links

  • I Code With Things And Stuff delves a into how to extend your editor with a scripting language like Python.
  • Extending Vim With Python seems like more of a reference for the topic.

Refer to the Scripting chapter in 'A Byte of Vim'.