vim

Vim [compile and] run shortcut

Vim [compile and] run shortcut Question: Basically what I want is a keyboard shortcut in vim that lets me [compile and] run the currently being edited C, C++ or Python program. In psuedocode: when a shortcut key is pressed: if current_extension == ‘c’ then shell: gcc this_filename.c -o this_filename_without_extension if retcode == 0 then shell: …

Total answers: 6

Automatic insertion of a colon after 'def', 'if' etc

Automatic insertion of a colon after 'def', 'if' etc Question: I recently switched to Vim at the request of a friend after Sublime Text 2 decided it didn’t believe a module was installed even though it was…I digress. I’ve managed to set up some stuff to make editing Python (currently me only language) easier. However, …

Total answers: 6

How to check python version that vim was compiled with?

How to check python version that vim was compiled with? Question: In the terminal, it works to do python -c “import sys; print(sys.version)” but doing :python -c “import sys; print(sys.version)” in vim throws a SyntaxError. Asked By: beardc || Source Answers: I think you want this: Type: :python << EOF import sys; print(sys.version); EOF If …

Total answers: 4

Expand tabs to spaces in vim only in python files?

Expand tabs to spaces in vim only in python files? Question: How do I have the tab key insert 4 spaces when I’m editing “*.py” files and not any other files? Following a recommendation from Vim and PEP 8 — Style Guide for Python Code, I installed vim-flake8 (and vim-pathogen). This gives warnings when PEP8 …

Total answers: 1

Send code from Vim to an external application for execution

Send code from Vim to an external application for execution Question: Using Stata my text editor is gVim. Using scripts from here and here to send code from Vim to Stata keeps me from switching to Linux. The scripts are in AutoIt I cannot use in Linux. They are independent of text editor; people who …

Total answers: 3

How to launch an EDITOR (e. g. vim) from a python script?

How to launch an EDITOR (e. g. vim) from a python script? Question: I want to call up an editor in a python script to solicit input from the user, much like crontab e or git commit does. Here’s a snippet from what I have running so far. (In the future, I might use $EDITOR …

Total answers: 6

Any pointers on using Ropevim? Is it a usable library?

Any pointers on using Ropevim? Is it a usable library? Question: Rope is a refactoring library for Python and RopeVim is a Vim plugin which calls into Rope. The idea of using RopeVim seems great to me, is there any documentation on “getting started” with RopeVim? I’ve followed what documentation there is: https://bitbucket.org/agr/ropevim/src/tip/README.txt I suppose …

Total answers: 4

Errors editing python with Vim

Errors editing python with Vim Question: When I edit a python file in Vim (using MacVim), and I press o to insert a new line, Vim throws the following errors: Error detected while processing function <SNR>20_CheckAlign..GetPythonIndent: line 30: E121: Undefined variable: dummy Press ENTER or type command to continue Error detected while processing function <SNR>20_CheckAlign..GetPythonIndent: …

Total answers: 4

Syntax highlighting in vim for python

Syntax highlighting in vim for python Question: How do I do I set the syntax highlighting in Vim 7 for python? I would like to set my own colorschemes, and syntax highlighting for a type of code file. Asked By: hidroto || Source Answers: Put the line syntax on in your .vimrc. Answered By: Robie …

Total answers: 4

How to enable Python support in gVim on Windows?

How to enable Python support in gVim on Windows? Question: I’m trying to get Python support in gVim on Windows. Is there a way to accomplish that? I’m using: Windows XP SP3 gVim v. 7.3 Python 2.7.13 (ActivePython through Windows Installer binaries) Asked By: wassimans || Source Answers: Usually, python support is built in the …

Total answers: 13