Questions tagged [python]

83 questions
5
votes
1 answer

Is there a way to make vim use a python3 interpreter which is not explicitely installed under Windows 10?

I want to use a certain python interpreter instead of an installed one. My gvim version is VIM - Vi IMproved 8.2 (2019 Dec 12 kompiliert am Dec 12 2019 13:30:17) MS-Windows 32 Bit GUI Version mit OLE-Unterstützung Übersetzt von mool@tororo Riesige…
slash
  • 73
  • 3
3
votes
1 answer

Evaluate an expression from visual selection in Python

I'd like to be able to select a part of a line, send it to a python interpreter, and have the selection replaced by the expression result. The use case is for doing math in Markdown documents: 1. Text here and then an expression 12 * 200 1. More…
A1Liu
  • 31
  • 2
3
votes
2 answers

How to run a single Python unittest.TestCase test in VIM?

I have two simple Python tests in my_tests.py file: from unittest import TestCase class MyTestCase(TestCase): def test_true(self): self.assertTrue(True) def test_false(self): self.assertFalse(True) which can be executed…
niekas
  • 1,575
  • 4
  • 17
  • 25
1
vote
1 answer

How do I use the Vim code for Google's python style?

I found interesting code on GitHub at https://github.com/google/styleguide/blob/gh-pages/google_python_style.vim I would like to use it, but when I just dropped it in my .vimrc, it interfered with editing of other kinds of code such as C. How do I…
ForDummies
  • 111
  • 2
1
vote
1 answer

Correct Vim package for python development?

I'm trying to setup Vim with Flake8, YouCompleteMe and other python add-ons using Vundle. What is the correct Vim package (vim/vim-gtk/vim-gtk3/...) to install on Linux? I noticed after apt install vim-gtk, python3 is enabled but not python when I…
st203
  • 11
  • 2
1
vote
0 answers

UnicodeDecodeError caused by the key

To simplify the problem, run following command will get the same error :py3 print(vim.eval('"\\"')) And the real situation is while 1: vimcmd("let nr = getchar()") vimcmd("let ch = type(nr) ? nr : nr2char(nr)") if vimeval('ch ==…
ZhiyuanLck
  • 212
  • 1
  • 8
0
votes
1 answer

Executing Python scripts in Vim such that Vim remembers previously run code

Supposing I have the following python script open in Vim: a=1 b=2 c=a+b I know that I can type :! python3 in normal mode either for the whole script or by selecting the rows that I want to run in visual mode. But I can't run the first two lines…
0
votes
2 answers

How to get vim using anaconda as default python3?

I am using Manjaro/Arch Linux and I use vim from sudo pacman -S vim instead of build it from source I want to run my .py files in vim by F5 but when I added these to ~/.vimrc: map :call CompileRunGcc() func! CompileRunGcc() exec…