Questions tagged [python]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
19 views

ALE project root for Python

I use ALE to run linters while editing Python code in vim. When working on code in a package, I can't get ALE to respect the pylint configuration in the project root. I've had it in .pylintrc as well ...
0
votes
0answers
25 views

Suppress Deprecation Warning from Python

I am using gVim on Windows, and when I enter insert mode for the first time on a fresh document I am hit with a deprecation warning from Python regarding the imp package. This is quite jarring and I ...
0
votes
0answers
9 views

How to leave insert mode immediately with python (or force vim to dispatch its event queue)?

Reproduction step : Use this vimrc : function! Ttt() py3 << EOF vim.command('echom mode()') vim.command('stopinsert') vim.command('echom mode()') EOF endfunction au InsertChange * :call Ttt()...
0
votes
0answers
28 views

Jedi-vim autocompletion installed with Vundle but not working

I installed jedi-vim with Vundle in my vim8 through the .vimrc file. call vundle#begin() Plugin 'davidhalter/jedi-vim' call vundle#end() I wrote it the .vimrc file with :w, I went to vim and ...
0
votes
0answers
19 views

Neovim - How do you call Python from Lua and store the results as a Lua variable?

I am trying to improve a GitHub repository for Neovim called quangnguyen30192/cmp-nvim-ultisnips It's a Lua repository that calls another Vim plugin repository, SirVer/ultisnips , a primarily Python-...
0
votes
1answer
44 views

Is there a vim that uses python instead of vimscript throughout?

There is a vim plugin that allows even the .vimrc to be composed in lua. But I would prefer python. Does anyone know of such a plugin or version of vim that uses python throughout the internals, ...
0
votes
1answer
27 views

Make LanguageServer aware of requirements without activating virtual environment (Python)

I have a typical python project structure: ├── requirements.txt └── src.py where requirements.txt is holding the requirements of my project, and src.py has my code. In my minimal example, they look ...
1
vote
2answers
62 views

Use poetry shell in Vimspector

I'm using Poetry to manage my virtual environments for Python and I'm using Vimspector as a debugger plugin for Vim. How can I use the Poetry venv when starting debugging? I'm thinking that all that ...
1
vote
1answer
226 views

Cannot find implementation or library stub for module named "flask"

In a Python file, my first line is: from flask import Flask Which triggers an error in the gutter that shows the following message when I drag the cursor over that line: Cannot find implementation or ...
1
vote
0answers
33 views

How to select a python interpreter in vim

I have multiple versions of python on my ubuntu system, python2.7 which is default one and i have installed python3.8. I have a python module installed in python3.8 which is not installed in python2.7....
1
vote
1answer
87 views

`termwinsize` cannot be accessed from Python 3

The option termwinsize cannot be accessed from Python 3. Input python3 << EOD import vim for window in vim.windows: if (window.buffer.options['buftype'] == b'terminal'): window....
1
vote
1answer
312 views

How to add python3 interface to vim?

I want to use Ultisnips and get the following error: E319: Sorry, the command is not available in this version: py3 import vim Press ENTER or type command to continue Error detected while processing /...
1
vote
2answers
160 views

No fold found with python code, mac and debian

I'm trying to get vim to do code folding with my python code and I could really use your help with the last bit here. I have this in my ~/.vimrc: set number "set tabstop=2 "set expandtab &...
1
vote
1answer
44 views

Convert print statements to log statements using a custom mapping

I want to write or find a plugin that helps me convert print statements to log statements in Python 3. Consider a situation: I am writing some code, I want to add a feature based around some API, I ...
0
votes
0answers
24 views

Vim installs with 3.5.2 even with ./configure 3.6 ubuntu 16.04

I am trying to install vim with python3.6 in order to be able to use YouCompleteMe. I cloned the source repository and install with commands: ./configure --with-features=huge \ ...
0
votes
0answers
23 views

Change indentation behavior when `:filetype plugin indent on` is set

Tested with vim --clean \<filename>.py, then did :filetype plugin on and :filetype plugin indent on. To make code look better, i wanted to write something like this for a dictionary: test = { ...
0
votes
1answer
134 views

Environment variables on vimspector

I'm using vimspector for debugging python, with debugpy. However, I need to source some environment variables before debugging in order for everything to work. How can I set up these env variables ...
2
votes
1answer
266 views

How to auto import Python functions in VIM?

Let's say I need reverse function in my newly created hello_world.py file and I have not imported it yet: url = reverse('hell-world') I would love to go onto the reverse name, press VIM binding and ...
0
votes
1answer
39 views

Exclude trailing newline when reading in skeleton file

I have the following in my .vimrc: au BufNewFile *.py 0r ~/.vim/skeletons/py.skel | let IndentStyle = "python" However, when I open a new .py file, there is always a trailing empty line ...
0
votes
3answers
1k views

How to tell NeoVim to use “python” instead of “python3”?

Im using pyenv to administer my python versions (Im on Manjaro Linux) and the command for python on my system is python but nvim wants to use python3. How can I change it? Error: [coc.nvim] Error on ...
1
vote
0answers
34 views

Keep matched filename, line number and column number in the error message

I'm currently trying to create some errorformat rules to parse the output of the black formatter. The output of this formatter is as follows: would reformat /home/ricks/Development/personal/...
0
votes
1answer
407 views

nvim-completion-manager: neovim shows a Python syntax error in cm.py when opening a new file i despite no actual syntax error in file

In ~/.config/nvim/plugged/nvim-completion-manager/pythonx/cm.py, line 151 is self.nvim.call('cm#complete', name, ctx, startcol, matches, refresh, async=True) I'm using Python 3.8 and copying ...
2
votes
1answer
782 views

VimWiki - create a "smart" index page for subdir/section of wiki?

I'm using VimWiki for a writing project and for certain sections (like "chapters", contained in sub-directories) I want to create indexes that work similarly to the way VimWiki's diary index ...
1
vote
0answers
42 views

UnicodeDecodeError caused by the key <bs>

To simplify the problem, run following command will get the same error :py3 print(vim.eval('"\\<bs>"')) And the real situation is while 1: vimcmd("let nr = getchar()") ...
2
votes
1answer
174 views

Ignore lines with string in errorformat

I'm writing a GitHub action that creates an annotation for files that would be reformatted when the black python formatter is run. For this, to work, I want to parse the following example output: ...
0
votes
2answers
184 views

How to disable the quickfix window?

This is the display when I typed :AsyncRun -mode=term -pos=bottom ~/.anaconda/bin/python %. But if I set: filetype plugin on map <F5> :call RunPython()<CR> function! RunPython() exec &...
0
votes
1answer
21 views

Debugging python2 under windows

For a while I've been trying now to get python debugging under windows to work with a precompiled GVim to work (with dynamical python2/python3 support): MS-Windows 32 Bit GUI Version mit OLE-...
0
votes
0answers
53 views

Starting an interpreter and dumping the output to a new buffer

I am working on some Python code, and I would like to call an IPython interpreter from within a script. I have no problem doing this, however, I would then like to dump all of the output from both the ...
0
votes
2answers
308 views

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 <F5> :call ...
3
votes
1answer
245 views

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-...
1
vote
1answer
2k views

Jedi module is not found (deoplete)

:checkhealth shows neither errors nor warnings about jedi: health#jedi#check ==================================== ## jedi #### Jedi-vim debug information ##### jedi-vim version - jedi-vim git ...
2
votes
1answer
74 views

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 ...
0
votes
1answer
45 views

Adding python directory

After following some advice my vimrc contains: set rnu set nu set autoindent set pythonthreedll=C:\Program Files (x86)\Vim\vim82\autoload\python37.dll set pythonthreehome=C:\Program Files (x86)\Vim\...
1
vote
0answers
45 views

How to set the Bash python env and vim python env paths the same?

When I check for python version in vim file, it displays 3.6 whereas it shows python 3.7 when I check from the bash terminal. As a result, when I pip install from the terminal, it installs in the ...
1
vote
2answers
1k views

How to let Vim work with pyenv?

I've created some Python virtual environments: hmanx ~ » pyenv virtualenvs 3.7.4/envs/nn (created from /home/roach/.pyenv/versions/3.7.4) 3.8.2/envs/py38 (created from /home/roach/.pyenv/versions/...
0
votes
2answers
278 views

Do not use the system Python 3 version in Vim

I am running Ubuntu 16.04, which requires the Python 3 system version to be 3.5: updating it to 3.7 breaks the package manager. At the same time, I want to use Vim with YouCompleteMe. YouCompleteMe ...
1
vote
1answer
2k views

"The ycmd server SHUT DOWN" with vim 8.1

I just upgraded my system, in the process vim was itself updated to version 8.1 (from 8.0). Now every time I start vim the following error is displayed: The ycmd server SHUT DOWN (restart with ':...
4
votes
2answers
346 views

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): ...
4
votes
1answer
608 views

Installing vim8.2 with python3.8 : Python.h not found

I have cloned the vim git repository (even tried to run git clean -xdf prior to configuring, as suggested here), then compiled with: ./configure --with-python3-command=python3.8 --with-python3-config-...
0
votes
1answer
33 views

Is there a way to create a new file from the editior once I have a file open?

So I have the following file number11.py open in vim, this is the route I usually take to create a new file I do ESC :save number11.py, and then :x. Then from my Ubuntu terminal I do the following vim ...
0
votes
1answer
181 views

GVim Shows Python Support Error When Opening

Every time I open up gVim there is an error that says that Python is not supported. I have checked numerous websites and everything that I have tried does not seem to work. In my vimrc file, I have ...
0
votes
1answer
94 views

How to import library in my template python script? (not working like in vim like in the repl)

I have a python script for generating templates that's being invoked by this line in my vimrc file: autocmd BufNewFile ~/Documents/wiki/diary/*.mkd :silent 0r !vimwiki-diary-template.py That works. ...
3
votes
1answer
126 views

Vim thinks Python @ operator is decorator

Python3 has the matrix multiplication operator (@) which is used to multiply numpy matrices. But when we write something like A = B @ C in vim, the @ C portion gets highlighted. Apparently Python has ...
2
votes
1answer
92 views

UltiSnips shows error with Python `If-Else`

I am using UltiSnipswith vimtex as explained here and trying to use the snippet for Inline Math for LaTeX as shown in the link above. Everytime I try to execute the snippet it executes but immediately ...
1
vote
0answers
49 views

Why does Gvim treat ansi escape codes differently than Vim in python code?

The following python code uses ansi escape sequences to clear the terminal screen and change the text color to red. It then prints "Hello from Vim." print ('\033c\033[31m Hello from Vim.') In Vim I ...