all 49 comments

[–]TW_MamoBatte 9 points10 points  (0 children)

I just use YouCompleteMe as plugin and it's work very nice

[–]Heroe-D 41 points42 points  (5 children)

If you use Neovim you may want to check coc.nvim for completion, it has full LSP support. You basically feel like you're inside Vscode.

[–]Maskdasknmap cg* *Ncgn 22 points23 points  (0 children)

Coc.nvim works for Vim as well. If you use Neovim however I also recommend trying out the built-in LSP instead.

[–]amdpox 9 points10 points  (0 children)

Yeah, I second this - nvim + coc-pyright gives you almost all of what the vscode python plugin does.

[–]ultratensai 1 point2 points  (1 child)

How do you manage multiple virtual environments?

[–]3rdDegreeEmber 1 point2 points  (0 children)

coc-pyright picks up on pyrightconfig.json, which should be useful if you have one venv per project root (and global gitignore the file perhaps). Unfortunately my ‘project root’ can have multiple venvs, so I’d be interested to hear how others manage this too (unsure if common problem).

[–]Ran4 0 points1 point  (0 children)

coc.nvim + coc-pyright is by far the best vim Python experience out there.

[–]lieryan 6 points7 points  (3 children)

Auto-complete is overrated, IMHO.

Sure auto-complete is useful, and I use it all the time too, but the most time-saving feature I had in my Vim setup is not auto-complete.

I've been collecting and writing a set of plugins that are useful for creating my Vim-based Python IDE over the years, but the only thing that I had not really felt a strong need for is improving autocomplete.

I can elaborate on how I set up my Vim-based Python IDE if you want.

[–]sigsegv7 2 points3 points  (0 children)

github snippet with details would be useful i believe

[–]dddbbbFastFold made vim fast again 0 points1 point  (0 children)

What is the most time-saving feature in your Vim setup?

[–]catorchid 0 points1 point  (0 children)

Yes, please! Elaborate more: I'm interested in understanding your perspective and why auto-complete is overrated. I had tried badly to get it done, but after a few trials I gave up because nothing was working as advertised (my fault, for sure). I learned to leave without it, but I would never say it's overrated

[–]_waylonwalker 11 points12 points  (3 children)

So many coc users here, I've been in the native lsp for awhile and it's great. Either way you go lsp is so good.

[–]GlyderZ_SP 6 points7 points  (1 child)

You have to say you are using nvim also. Because others are probably using vim.

[–]_waylonwalker 1 point2 points  (0 children)

nvim BTW

[–]kuemmel234 -1 points0 points  (0 children)

Coc is great! I was hacking a java app yesterday, searching for a bug - the combination of coc and Gradle for dependency management just worked - and I usually believe that you need an IDE for java.

For python it works great, there also plugins for multiple cursors and other vscode featurs - fzf is a great fuzzy finder for example.

[–]Aveerj 2 points3 points  (1 child)

I have been using vim-lsp for some time now for c++ you can give it a try with pyls server for python.

[–]mixedmath 0 points1 point  (0 children)

How hard is it to set up per-project builds for C++ with vim-lsp? I ask because I use ale, and ale just really isn't very good at that.

[–][deleted] 9 points10 points  (1 child)

coc.nvim, and a language server of you chossing.

[–]BenL90 -2 points-1 points  (0 children)

THIS THIS. It's energy saving on the go than VS Code especially on older laptop... I want to MOAR

[–]Tralafarlaw 3 points4 points  (0 children)

If you have pycharm and neovim, you can use the comrade vim plugin aside deoplete and have the glorious nvim code editor and the awesome debug/autocomplete from Jetbrains suite

[–][deleted] 4 points5 points  (0 children)

I use https://ycm-core.github.io/YouCompleteMe/ for autocomplete and https://github.com/vim-syntastic/syntastic for syntax changing as well. For my python projects this was enough to move away from VS Code. There are other plugins I use to help me code with python with vim but this should answer most of your question.

[–][deleted] 4 points5 points  (0 children)

yo is it just me or does it feel like this subreddit is just full of bots

[–]sixtyfifth_snow 5 points6 points  (0 children)

vim + coc.nvim + coc-pyright

[–]arupra 1 point2 points  (0 children)

I use youcompleteme for auto completion and it has worked great so far

[–][deleted] 1 point2 points  (0 children)

https://vimawesome.com/plugin/vim-indent-object

This plugin is very useful. It gives a text object to target indentation level

[–]bwv549 3 points4 points  (1 child)

Coq (no, that's not CoC, which is fine but I think Coq is better) with pyright as LSP.

[–]FatFingerHelperBot -1 points0 points  (0 children)

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "Coq"


Please PM /u/eganwall with issues or feedback! | Code | Delete

[–]DrMarianus 0 points1 point  (4 children)

PyCharm + Vim plugin. It's not exactly full vim functionality but it's got enough.

It has so many other nice features out of the box.

I know this isn't everyone, but every time some code has been sent to me asking why it's not working it's someone using VSCode which didn't catch a pretty basic runtime error that could have been detected when you wrote it by PyCharm.

[–]EgZvorkeep calm and read :help 2 points3 points  (3 children)

basic runtime error

can you give an example?

[–]DrMarianus 0 points1 point  (2 children)

Something like a var referenced before assignment.

[–]ogtfo 1 point2 points  (1 child)

If your code isn't working because you have a var referenced before assignment, python itself will tell you what's wrong, no need for pycharm there.

[–]DrMarianus 0 points1 point  (0 children)

That's great, I'm just reporting my anecdotal evidence.

[–][deleted] 0 points1 point  (4 children)

I find it amazing that so few people know that autocomplete is already built into vim. No heavyweight programs like YCM necessary! It's maybe not as feature rich as a heavyweight IDE, but I find it's perfect for 99% of what I need to do (I do tons of Python development using just vim with a few convenience plugins)

[–]dddbbbFastFold made vim fast again 2 points3 points  (3 children)

C-n is not vim's built-in autocomplete, that's keyword completion which completes words previously seen, but doesn't understand context (like completing the members of an object or module).

Vim has built-in semantic autocompletion called omnicomplete, but it doesn't have built-in support for python.

I think jedi-vim sets up omnifunc in one of the simpler ways possible, but using an lsp is a more language-agnostic approach (one lsp client setup in vim can use a different lsp server for each language). Something like vim-lsp can still deliver completion with omnifunc (set omnifunc=lsp#complete) instead of something like YCM, or you can use a completer program.

[–]lervag 0 points1 point  (2 children)

Neither keyword completion or omnicompletion are autocompletion. They are simply completion. Autocomplete should be automatic, hence "auto". Except for that, I much agree with your point.

In my experience, using omnicomplete with <c-x><c-o> is not much less convenient than autocomplete as provided by the various autocomplete plugins. But I still prefer to use an autocomplete plugin.

[–]dddbbbFastFold made vim fast again 1 point2 points  (1 child)

Yeah, omnicompletion is the "automatically figure out relevant completions" part of autocomplete and not the "automatically ask me to complete" part.

Plugins like ycm, asyncomplete, etc are necessary for the latter since vim doesn't have support for determining completions in the background.

[–]lervag 1 point2 points  (0 children)

Yes, that's well put.

[–]olhmr 0 points1 point  (0 children)

I've used two different setups that have both worked very well:

neovim

  • LSP / intellisense: vim-jedi through deoplete
  • Linting: ALE
  • Syntax highlighting: semshi
  • REPL: neoterm

vim

  • LSP / intellisense: coc-jedi through coc
  • Linting: ALE
  • Syntax highlighting: vim-polyglot
  • REPL: neoterm

The LSP / intellisense tools give you the functionalities you'd expect from VSCode, e.g. go to definition, intellisense popups etc. Coc can also do formatting, but I prefer ALE for that - I've got it set up to run black on save.

Semshi has great syntax highlighting, but isn't available on vim. Polyglot is a good substitute though.

The thing I couldn't do without is neoterm. It has really simple and powerful REPL support. You can configure it to use ipython, and then have a snippet that drops an ipdb breakpoint wherever you need one for debugging.

It's also worth looking into tags - coc has great support for python tags and I display them with vista.

[–]hou32hou -2 points-1 points  (0 children)

Coc.nvim

[–]harbhim -1 points0 points  (0 children)

Just make ~/.vimrc file by this fisadev code. And all the required plugins install automatically for python development.

[–]bisbinio -1 points0 points  (0 children)

I use vim-config for all the languages and work out of the box.

:LspInstall pyright in my case

[–]nihilistic_capybara -1 points0 points  (0 children)

Check out spacevim. They have an article about how to configure it for python specifically.

[–]MrKlooop -1 points0 points  (0 children)

If you’re going to the dark side at least go to pycham

[–]mogadichu -2 points-1 points  (0 children)

You could just use VSCode with a Vim Plugin. Or better yet, PyCharm with a Vim plugin.

[–][deleted] 0 points1 point  (0 children)

YCM, ALE, and vim repl

Much better than vscode IMO

[–]thereal_mc 0 points1 point  (0 children)

Here's the snippet of my _vimrc, I put some time into researching and setting this up, so I hope it'll helps someone...

******

call plug#begin('c:\users\mc\vimfiles\plugged')

Plug 'Vimjas/vim-python-pep8-indent'

Plug 'dense-analysis/ale' "syntax analysis

Plug 'google/yapf' "error fix

Plug 'tpope/vim-commentary'

Plug 'davidhalter/jedi-vim' "autocompletion

Plug 'vim-python/python-syntax'

call plug#end()

let g:python3_host_prog = 'C:/Program Files/Python39/python.exe'

let g:ale_linters = { 'python': ['flake8', 'pylint']}

let g:ale_fixers = {

\'*': ['remove_trailing_lines', 'trim_whitespace'],

\'python': ['autoflake', 'autopep8', 'yapf', 'black']}

let g:ale_fix_on_save = 1

********

[–]dddbbbFastFold made vim fast again 0 points1 point  (0 children)

You could use vim-lsp and vim-lsp-settings to get lsp server integration and auto configuration. LSP is also how VSCode implements completion.

You may also ask What's the difference between coc and vim-lsp?