Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To execute the current file in python, you can use the command <code>:!python %</code>. You can bind this to a keyboard shortcut by editing your vimrc. For example, adding <code>nnoremap \ll :!python %&lt;cr&gt;</code> to your vimrc will execute the current file in python when you type <code>\ll</code> in normal mode. (* see footnote for more details). </p> <p>The vim-ipython plugin lets you open an ipython window in vim. You may also be interested in tmux, which allows you to split your terminal in two, vertically (so you can have a shell and vim running in parallel).</p> <p>There are plenty of plugins that can turn vim into a really good python IDE. "pyflakes", which automatically highlights syntax errors, is a particular favorite of mine. </p> <p>This blog post describes vim plugins for python extensively:</p> <p><a href="http://sontek.net/blog/detail/turning-vim-into-a-modern-python-ide" rel="noreferrer">http://sontek.net/blog/detail/turning-vim-into-a-modern-python-ide</a></p> <hr> <p>(*) As an aside, you may want to make this command specific to python files (it doesn't really make sense to execute C++ source in a python interpreter). This can be done either by putting it in a specific <code>python.vim</code> file in your <code>.vim/ftplugin</code> directory, or by writing </p> <pre><code>autocmd FileType python nnoremap \ll :!python %&lt;cr&gt; </code></pre> <p>in your .vimrc. That way, you can rebind the <code>\ll</code> keyboard shortcut to different actions for different types of file.</p> <p>As a second aside, if you just want to execute a section of the current file, select the relevant lines in visual mode (SHIFT+v) and type the <code>:!python %</code> command. The lines selected will get piped to the python interpreter!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload