Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [python]

The tag has no usage guidance.

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

How to jump to a specific file and line from an error output in Neovim?

I use Neovim as an IDE for Python development. When I execute a Python script inside Neovim using the :terminal command, and an error occurs, I get an output similar to the following: Traceback (most ...
john's user avatar
  • 68
1 vote
1 answer
67 views

Pyright LSP, leading spaces appears as " " in hover

I am using pyright LSP with the neovim (0.10.0-dev), and am seeing any leading spaces in docstrings replaced by  . For example, see the attached image: As far as I can tell it seems very ...
Tom's user avatar
  • 11
1 vote
2 answers
103 views

Integration of mypy and QuickFix window

I would like to have a keyboard shortcut to run mypy on the current buffer put the output in the QuickFix window I only want mypy to run and populate the QF window on demand, not constantly. I do ...
backseat's user avatar
  • 131
0 votes
1 answer
35 views

Semantic completion does not work for argparse.Namespace

I have a problem with the semantic completion for specific class argparse.Namespace with YouCompleteMe. Here's a minimal repro case I can provide: # .vimrc silent! call plug#begin() Plug 'ycm-core/...
Felixoid's user avatar
  • 111
1 vote
1 answer
133 views

How can I enable highlighting such that all Python variables use the same color?

When I was using VSCode as my main code editor, many extensions like The One Dark Pro theme offered variable highlighting. This is not Semantic highlighting, where each variable is assigned its own ...
KhodeNima's user avatar
  • 131
0 votes
1 answer
159 views

Python formatter stop working in Neovim [closed]

No errors are being thrown for the code with a lot of issues. I have tried black, ruff but nothing works. I have also tried reinstalling with mason. I have disabled diagnostics for the lsp (pyright) ...
Sid's user avatar
  • 109
0 votes
1 answer
541 views

How to configure pylsp installed by Mason with lsp-zero for nvim?

I want to disable a specific error/warning - E203. This is my lsp.lua where I tried to add ignore config according to this doc from lsp-zero git local lsp = require("lsp-zero") lsp.preset(&...
hdw3's user avatar
  • 101
2 votes
2 answers
178 views

How to see command lines and output for linters, etc

I've used vim and python for decades, but since Syntastic has been deprecated, I recently switched to ALE. I'm coding in Python 3.11 and running vim 8.1 under Linux Mint, and have created a virtual ...
Michael Scheper's user avatar
2 votes
1 answer
444 views

Neovim shows python related error after installing semshi

I'm currently in the process of setting up my configuration for my Neovim environment and I'm struggling with some Python related issues. I'm on macOS with nvim 0.9.4, installed over brew (if that ...
Sito's user avatar
  • 121
0 votes
1 answer
225 views

Unable to import Python packages into Vim

I have to get into some python programs so I thought I'd edit my Vim workflow so that Python is optimally efficient too. I have quite some packages (vim airline, vim ale, ...), a virtual environment ...
Airbornedawn345's user avatar
1 vote
1 answer
4k views

Get ruff / ruff_lsp to work with neovim

I tried kickstart.nvimi to get to work with the ruff-lsp. It did not work, therefore I built a minimal example with only the default configuration from the documentation. Here is the problem: When I ...
Dronakuul's user avatar
1 vote
2 answers
246 views

ALE Code Action for python

I have a working linter with the ALE plugin. Plugin 'dense-analysis/ale' let g:ale_virtualtext_cursor = 0 let g:ale_python_flake8_options = '--extend-ignore=E501' nnoremap <leader>ar :ALERename&...
Surya's user avatar
  • 21
1 vote
1 answer
189 views

Remote neovim command that changes the selected range (python)

I want a simple command that changes the range that the user selected to a constant string I set (with possibly differently number of lines) - effectively adding lines if the constant string has more. ...
eyal karni's user avatar
  • 1,136
0 votes
1 answer
786 views

Why does :!python3 differ from g:python3_host_prog?

I am using Ubuntu 22 and the default (OS) Python version is 3.10.6. I don't need this python version; rather I need 3.8.16. I've installed it and set the g:python3_host_prog to its path to use it when ...
TOK's user avatar
  • 1
0 votes
1 answer
84 views

coc-pyright is using buffers irresponsibly

I've been noticing that my buffer number increases really fast without me even using them. I rely on buffers quite a lot to switch between files, and it's really annoying when I open a second file and ...
jmbeck's user avatar
  • 101
0 votes
3 answers
672 views

How can I auto-format long function calls in Python?

I am a Python programmer using Vim. When writing a long function call, it often exceeds the width of my document: a_long_python_function(with_some, additional, arguments, kwarg1=kwarg1, kwarg2=kwarg2, ...
Tyrion97's user avatar
1 vote
1 answer
261 views

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 ...
ForDummies's user avatar
1 vote
0 answers
635 views

nvim-dap debugging with Ipython instead of the default REPL

I wanted to ask if it is possible to combine nvim-dap with ipython for debugging purposes in a reasonable way. Now I am using the repl that is being opened by nvim-dap-ui. But it is not the most ...
Nie Dzwiedz's user avatar
1 vote
1 answer
443 views

Handle star imports in Python

I'm currently developing a lot with Python. I use projects like pwntools and sometimes I'm contributing to repositories that use star imports in their source code. I know that star imports are not ...
Lukas's user avatar
  • 111
1 vote
1 answer
114 views

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 ...
st203's user avatar
  • 11
2 votes
2 answers
237 views

How to get the right indent size in python lists?

In my vimrc I have filetype indent plugin on When I write python code, the indentation mostly looks good, but in lists it is too big: def fun(): return 'indent looks good' my_list = [ '...
Burrito's user avatar
  • 131
0 votes
0 answers
95 views

Display lint info in vim ruler

I've installed the vim-flake8 plugin and it works correctly to lint Python in vim. When I am on a particular line, I can use :call flake8#Flake8ShowError() and it will display the error in the vim ...
efthimio's user avatar
  • 101
3 votes
2 answers
561 views

Improve `gf` such that it would jump to the exact line, if possible

If a path is written in form filepath:line (i.e. python exception), I want gf to jump straight to the line.
eyal karni's user avatar
  • 1,136
1 vote
1 answer
135 views

Build a custom vim binary with python syntax highlighting

Background The Debian 11 vim package doesn't include python3 support. See the section titled "No python support in Debian 11 vim - evidence" below I need vim with python3 support for the ...
Mike Pennington's user avatar
2 votes
1 answer
149 views

Separate virtualenv for vim plugins and application code

I have multiple vim plugins (ropevim, taskwarrior etc.) which depend on python libraries. These libraries are installed in system python3 When I am working on a python project, the virtual environment ...
vijayvithal's user avatar
1 vote
1 answer
2k views

LSP with pyright and poetry

I want LSP to allow me to use pyright with peotry projects. The problem is, that the venv of a poetry project is kind of arbitrary and can change. So I can not configure it in the pyright config file. ...
Nathan's user avatar
  • 121
1 vote
2 answers
305 views

Python not working on Windows

I have a couple of plugins which use Python. They work fine on Linux but on Windows I am having difficulty in getting Python recognised. " Language Providers if has('unix') let g:...
paradroid's user avatar
  • 377
1 vote
2 answers
151 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 ...
Antonio's user avatar
  • 287
2 votes
0 answers
466 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, ...
baxx's user avatar
  • 1,025
0 votes
1 answer
72 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 ...
Lockjaw's user avatar
  • 145
1 vote
0 answers
19 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 ...
Barzi2001's user avatar
  • 606
1 vote
1 answer
640 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 ...
AxZxP's user avatar
  • 21
1 vote
1 answer
319 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:...
calocedrus's user avatar
0 votes
1 answer
2k 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 ...
Damask_Rose's user avatar
10 votes
6 answers
30k 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 ...
lesnik's user avatar
  • 471
0 votes
0 answers
33 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 ...
Vivian De Smedt's user avatar
1 vote
0 answers
104 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> ...
Barzi2001's user avatar
  • 606
0 votes
0 answers
237 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 ...
user40801's user avatar
1 vote
1 answer
207 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 ...
larsks's user avatar
  • 130
1 vote
0 answers
34 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 ...
Paul Rougieux's user avatar
7 votes
4 answers
825 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 ...
cmosig's user avatar
  • 299
1 vote
0 answers
787 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 ...
Will Brannon's user avatar
0 votes
0 answers
235 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 ...
Lockjaw's user avatar
  • 145
2 votes
0 answers
1k 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-...
ColinKennedy's user avatar
0 votes
1 answer
252 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, ...
Byron Hawkins's user avatar
0 votes
1 answer
364 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 ...
Jonathan Herrera's user avatar
1 vote
2 answers
591 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 ...
Xxxo's user avatar
  • 187
2 votes
1 answer
2k 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 ...
Bastien's user avatar
  • 123
3 votes
0 answers
362 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....
Manoj's user avatar
  • 131
1 vote
1 answer
109 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....
ynn's user avatar
  • 289