Questions tagged [python]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

Vim don't recognize python310.dll in Miniconda virtual environment

If I use the following set pythonthreehome=C:\\Users\\myname\\Miniconda3 set pythonthreedll=C:\\Users\\myname\\Miniconda3\\python39.dll I have no problems, but if I set the following set ...
  • 141
1 vote
1 answer
18 views

Gvim Python loading issue (despite being correctly installed)

I found a lot of questions about it, some problem was about 32 or 64 bit, other was about python support compiled in vim, etc. None was my case. Preamble: Software installed I installed Python on ...
  • 167
1 vote
0 answers
78 views

Pyright LSP flagging errors in class using pandas method

Using the following code example: import pandas as pd from typing import Dict class Test: def __init__(self, df : pd.DataFrame) -> None: self.df = df def example(self, ...
  • 795
0 votes
1 answer
25 views

Set location to be same as path

I keep a vimrc file stored on Dropbox and use symlinks to point to this so my vimrc is always synced up. Recently I got a new laptop and the location of some utilities are different from that of my ...
  • 145
1 vote
0 answers
14 views

I am developing my own python package, but Omnicomplete won't recognize it

I have my package in a local folder (say C:/Users/Myself/PythonStuff/MyPackage). Next, I created a new file in C:/Users/Myself/PythonStuff where I import my package, i.e. on top of my new file I have ...
  • 141
1 vote
1 answer
80 views

Issues of UI when combining Tmux and neovim and sourcing a python virtual env created with Poetry

The issue I recently switched to nvim + tmux and I have a fully working setup with various plugins. I use Poetry to manage my python virtual envs and it's a mandatory tool. I highlight the fact that ...
  • 11
0 votes
0 answers
21 views

Vim and env for python

I have Vim v. 8.2 with huge feature, installed using Brew, mostly used for Python dev. I also use Pipenv for python, having the .venv dir in the project's folder. For Vim, I'm using the vim-pipenv ...
  • 165
1 vote
1 answer
40 views

vim broken after python update (error while loading shared libraries: libpython3.9.so.1.0)

I built vim from source with option --enable-python3interp. But after a system wide update (pop-os / ubuntu 21 to 22.04), python went from 3.9 to 3.10 and I suppose this is what broke my vim: $vim vim:...
0 votes
1 answer
80 views

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 ...
1 vote
3 answers
3k views

How to configure neovim to properly format python code?

I have neovim 0.8.0 installed. I have neovim/nvim-lspconfig plugin installed. I have installed pyright language server on my system (pip install pyright) I have configured neovim to use the pyright ...
  • 317
0 votes
0 answers
25 views

Why is Ctrl-f and o not using the same definition of the indentation level for Python?

Vim is automatically indenting Python code quite well. For the following code everything works well: 1 while True: 2 | If the cursor is at line 1 and the user hit o in normal mode a new ...
0 votes
0 answers
34 views

Accessing python dataframe columns in vim editor upon pressure of a key

I have the following situation import pandas as pd T = read_csv("MyFile") I would like to have a list of the dataframe T columns when I type T[" and then I hit a key like <tab> ...
  • 141
0 votes
0 answers
22 views

Vim python cant import module jedi in direnv, still uses correct python

When I'm in my virtual environment: which python /home/a/b/.direnv/python-3.9.9/bin/python python >>> import jedi >>> No error When I'm in vim: :py3 import sys; print(sys....
  • 1
0 votes
0 answers
42 views

Empty line indentation for Python

Whenever I press o or O, VIM starts the line with the desired indentation. At work, people have decided that they want empty lines to be indented as if it contained code, such that code can be copied ...
1 vote
1 answer
55 views

Making an autocmd conditional

I have the official black plugin installed in vim. I have in my vimrc: au FileType python autocmd BufWritePre <buffer> Black This works fine, but I would like to be able to disable the ...
  • 130
1 vote
0 answers
29 views

How can I create a key combination that sends the content of a markdown code cell to a tmux pane with slime?

I am a happy user of nvim-R, which enables to send R markdown chunks to an R console with <localleader>ca. R cells code blocks look like this in R markdown files: ```{r} head(faithful) ``` When ...
7 votes
4 answers
678 views

Vim plugin where the first lines in the editor show the first line(s) with less indendation that are not visible

I would like to either find or write a plugin that does the following: Assume I have this python code: def foo(a,b,c): # comment [100 lines that do stuff] for i in range(N): [100 ...
  • 279
1 vote
0 answers
258 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
0 answers
145 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 ...
  • 145
0 votes
0 answers
11 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()...
  • 101
0 votes
0 answers
123 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 ...
1 vote
0 answers
467 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
1 answer
89 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
1 answer
112 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
2 answers
256 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 ...
  • 165
1 vote
1 answer
746 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 ...
  • 113
2 votes
0 answers
119 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....
  • 21
1 vote
1 answer
100 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....
  • 259
2 votes
2 answers
891 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 /...
  • 121
1 vote
2 answers
730 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
1 answer
115 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
1 answer
382 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
1 answer
553 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 ...
  • 1,205
0 votes
1 answer
64 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
4 answers
2k 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 ...
  • 119
1 vote
0 answers
37 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/...
1 vote
1 answer
1k 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 ...
  • 121
2 votes
1 answer
1k 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 ...
  • 715
1 vote
0 answers
47 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
1 answer
269 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
2 answers
371 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
1 answer
23 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-...
  • 53
0 votes
0 answers
86 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
2 answers
507 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
1 answer
417 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-...
  • 53
3 votes
1 answer
3k 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
1 answer
140 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 ...
  • 21
0 votes
1 answer
50 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\...
's user avatar
1 vote
0 answers
64 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 ...
  • 11
1 vote
2 answers
2k 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/...