2 votes
Accepted

Auto-fix missing Python f-string prefix in insert mode

I was pointed to this Neovim plugin by a fellow Vimer on a Discord I frequent. It meets my needs perfectly. For non-Neovim users, it should be possible to adapt Vivian's answer to achieve the same ...
Ryan's user avatar
  • 151
2 votes

Auto-fix missing Python f-string prefix in insert mode

I would do the following: inoremap <expr> { (map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') == ['pythonString'] && search('f"', 'bn', line('.')) == 0) ? &...
Vivian De Smedt's user avatar
2 votes

ALE Code Action for python

I'm not aware of a Vim plugin that provide fix for warning detected by the linter. But for automatic correction of missing Python import you could be interested by autoimport You can fix the import ...
Vivian De Smedt's user avatar
2 votes
Accepted

Wrong indentation in brackets

This automatic indentation is controlled by the indentexpr option. For python the default procedure is configurable and if you set the following global variable g:pyindent_open_paren to shiftwidth() ...
Vivian De Smedt's user avatar
2 votes
Accepted

Integration of mypy and QuickFix window

I would do: Create a ~/.vim/compiler/mypy.vim file with the following content: set makeprg=mypy In your python session you can activate the compiler with the following command: :compiler mypy More ...
Vivian De Smedt's user avatar
2 votes
Accepted

How do I disable snake_case naming style warning in ALE?

Fun fact: ALE doesn't check your code. ALE doesn't produce any warnings. What ALE does do, it runs code checkers that do the actual code checking and aggregates their output. Like that co-worker you ...
Friedrich's user avatar
  • 1,877
1 vote

Integration of mypy and QuickFix window

Thank you, really helpful. What I ended up doing, inspired by @Vivian De Smedt's answer, was: In .vimrc autocmd BufRead *.py set makeprg=mypy nnoremap <leader>m :silent make %:S <Bar> ...
backseat's user avatar
  • 121
1 vote
Accepted

How to replace the default python syntax in Neovim without a plugin manager?

"plugins" subdirectory is meant for the scripts sourced upon Vim startup. You should not put all that random stuff there. Instead, buffer-specific scripts must be put under appropriately ...
Matt's user avatar
  • 20.7k
1 vote
Accepted

What is the difference between `au BufNewFile,BufRead *.py` and `au Filetype python` in this specific case?

The BufRead event is triggered after the FileType event if the corresponding autocommand is after the filetype plugin on command (or after the plug#end() call if you are using plug) I suppose the ...
Vivian De Smedt's user avatar
1 vote

How to display vim-test output in a quickfix window?

In .vimrc, define strategies to send the test output let test#strategy = "make" " or " let test#strategy = "dispatch" After running vim test's :TestFile or :TestSuite on ...
Paul Rougieux's user avatar
1 vote

ALE Code Action for python

For Rust it seems that the language server propose fix that can be leverage by the light-bulb plugin. But for Python it seems that pyright provide warning but no suggestion fix that can be leveraged ...
Vivian De Smedt's user avatar
1 vote

Auto-fix missing Python f-string prefix in insert mode

For those preferring a one-liner to installing a plugin, you could use a substitution with a conditional expression (see :help :s and :help :s\=). Plugin f-string-toggle.nvim suggests mapping <...
Friedrich's user avatar
  • 1,877

Only top scored, non community-wiki answers of a minimum length are eligible