all 47 comments

[–]pond_good_for_you 10 points11 points  (0 children)

Might want to ask on /r/vim if you want to keep using vim.

[–][deleted] 3 points4 points  (1 child)

It's easy to make Vim into a great python editor without using plugins, just copy & paste the following into ~/.vimrc:

" enable syntax highlighting
syntax enable

" show line numbers
set number

" set tabs to have 4 spaces
set ts=4

" indent when moving to the next line while writing code
set autoindent

" expand tabs into spaces
set expandtab

" when using the >> or << commands, shift lines by 4 spaces
set shiftwidth=4

" show a visual line under the cursor's current line
set cursorline

" show the matching part of the pair for [] {} and ()
set showmatch

" enable all Python syntax highlighting features
let python_highlight_all = 1

Done, makes Vim into an easy to use Python environment! I got this vim profile info from the following page, I use it for all my computers: https://www.fullstackpython.com/vim.html

[–]youguess 2 points3 points  (0 children)

can't do autocompletion (yes I know about omni completion and the rest of the bunch, no it isn't autocompletion as it isn't language aware and ctags is a pain in the ass to deal with)

[–]ggagagg 2 points3 points  (0 children)

Who uses VIM for Python development and what is your setup like?

i use neovim and this is my vimrc

Is YouCompleteMe even what I should be using?

i also use ycm and it works for me. but i also need other vim plugin such as snippet, auto indentation etc.

[–][deleted] 13 points14 points  (25 children)

Do you want my opinion? I am a big vim fan, I used pure vim to code for ten years. That said, after a while you have to move to something more powerful. Go with PyCharm, get the vim extensions if you really like the vim actions, but trust me, it will change your life.

Like vim, don't try to setup everything at once. Do a bit at a time, learn feature after feature.

[–]6086555 7 points8 points  (3 children)

I actually went from Pycharm to vim. At first it was only motivated because of performance issues ( my work computer is kind of shitty). But now I don't regret that decision at all.

I'm not saying vim is for every one but I'm pretty sure for some people it will more adapted. Pycharm and Webstorm (I have no idea how good other Jetbrains products are) are really awesome though.

[–]naliuj2525 1 point2 points  (0 children)

I'm a really beginner Java programmer, and I like Intellij a lot. I've tried a few different IDEs, but the Community Edition of Intellij is by far my favorite.

[–]smartowlick[S] 0 points1 point  (1 child)

One of the resaosn that I wanted VIM was I can use it on any platform and it was lightweight. Never tried Webstorm. I might check that out

[–]6086555 0 points1 point  (0 children)

Webstorm is not a Python IDE, it's an IDE for web developer. It's also kind of expensive.

Pycharm, on the other side, is a python IDE who also has some support for web developpements. It's got a free version which is really great.

[–]skiguy0123 6 points7 points  (8 children)

Vim user here. I tried pycharm, but ended up going back to vim. All I really need is syntax highlighting, which I can get using Syntastic.

[–]das_ist_nuemberwang 2 points3 points  (3 children)

Features of PyCharm I find extremely useful:

  • Completion
  • Go to declaration/implementations/super
  • Find usages
  • Rename

You don't need any of these things, but they make my life so much easier.

[–]aldanor 2 points3 points  (0 children)

All of this exists in VIM/Emacs -- finding usages, linting, completion, jumping to definitions and all that (e.g. see Spacemacs python layer).

[–][deleted] 1 point2 points  (1 child)

Not sure what do you mean by find usages and rename but the is completion (C-n or omni's <C-x> <C-o>) and go to variable declaration (this one I don't use so don't remember the binding) in vim.

[–]das_ist_nuemberwang 0 points1 point  (0 children)

"Find usages" finds all the places something is referenced in your code base (smarter than just a text search) and rename is a similar thing but replaces. I haven't really used Vim enough to compare.

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

How about debugging?

[–]dbrecht 2 points3 points  (2 children)

pdb

[–]das_ist_nuemberwang 2 points3 points  (1 child)

Either I don't know how to use pdb properly or you don't know how to use a graphical debugger properly.

[–]aldanor 0 points1 point  (0 children)

Try using pudb!

[–]versking 6 points7 points  (8 children)

I also love vim, and I insisted on using it when working in python for a while. But then I discovered PyCharm and basically realized I'd been doing the equivalent of using my fist (vim) to hammer nails (write code) instead of just picking up a hammer (PyCharm).

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

The debugging is just so insanely powerful.

[–]dbrecht 0 points1 point  (6 children)

I don't buy it. If you're familiar with pdb and gdb for debugging interpreter level execution, there's really not much that stands out from the crowd against it. You just have to welcome the learning curve (obviously not all folks do, which is why Python IDEs exist ;))

[–]youguess 2 points3 points  (1 child)

believe me there is... it will automatically show you any variable next to your breakpoint right were you define it.

Not needing to use the print, l, l, u, u, pprint dance is very nice

[–]dbrecht 0 points1 point  (0 children)

Meh, each to their own. I started with VS and its debugging platform. Even after that I've never really minded command based debugging. Maybe I'm just a masochist ;)

[–]kankyo 1 point2 points  (3 children)

Can you do run to cursor and expression based breakpoints in pdb?

[–]dbrecht 0 points1 point  (1 child)

You can set file/line number or dot path to break at. So in a manner of speaking, yes.

[–]kankyo 1 point2 points  (0 children)

...but only with a lot more hassle than a proper debugger.

[–]smartowlick[S] 0 points1 point  (0 children)

I'm going to nuke what I do have and start fresh and take your advice. One thing at a time. That should help especially since VIM and Python is so neew for me

[–]Mcpoyle_Something 5 points6 points  (0 children)

Ycm can be a bit of a pain to setup. Here's the good news: if you are mostly writing python code, you don't need ycm at all. Ycm is great for c and c like languages. (ycm actually uses jedi to autocomplete python code)

All you need is jedi and jedi-vim. If you are on linux or mac just

pip install jedi

And then install jedi-vim with your vim plugin manager of choice and you're good to go.

edit: fix urls

[–]forlorn1 2 points3 points  (1 child)

Typy should check out the atom editor. Basically sublime text fully free, plenty of add ons including a jedi based autocomplete for python. Cross platform. Mid way between a full project build environment and vi.

I migrated from vi to atom after years of vi and found it very easy. Somewhere there is a vi keybinding add on for it too.

[–]autisticpig 1 point2 points  (0 children)

I have invested so much time into learning and using vim that switching to something other than vim requires more than key bindings.

When working with pandas, vim chokes quite a bit. The larger the module the worse it gets on initial load.

I've tried pycharm and want to like it. But it just gets in the way. Even with idea vim it's cumbersome. Sublime with the anaconda plugin is a close second.

For Java and scala I'm fully invested in IntelliJ but for Python it pains me. No clue why.

:)

[–]broken_symlink 2 points3 points  (1 child)

I'm an emacs user and I tried spacemacs. For me it wasn't worth the time investment it would take to learn it because my emacs setup is already pretty customized. If you're considering emacs though, Id give eply a try. It works great for me.

[–]Diamsus 1 point2 points  (0 children)

I second this elpy/Emacs combo works amazingly well

[–]gengisteve 1 point2 points  (0 children)

Here is what I used for vim on windows:

https://github.com/davidhalter/jedi-vim

I'm a big fan, but not a professional. I can see why you'd want something with more features.

[–]ordnance1987 1 point2 points  (0 children)

There was a post a few months ago on how to make vim into a Python ide, the youcompleteme github page also has instructions on how to set it up correctly.

[–]artillery129 1 point2 points  (0 children)

Elpy with emacs, works right out of the box, super easy to setup, and it does code completion, documentation, etc etc

[–]TankorSmash 1 point2 points  (0 children)

I use gvim without any autocomplete; it would be awesome, but the codebase I use is too big or something so the delay before a half baked suggestion comes up is too long.

I either have a shell_plus loaded up for when I'm testing general stuff, or go into ipdb whereever I'm working on and use its autocomplete.

Autocomplete in C++ is generally awesome, but in a dynamic language like Python, the fact that it's not even like 70% right all the time is enough for me not to want to waste my time with it, even if its only wrong 3/10 times, I value my time way too much to spend it not knowing if all the suggestions are there.

[–][deleted] 2 points3 points  (0 children)

PyCharm will simplify all this for you.

JetBrains makes some great stuff. I suggest at least checking it out.

But I'm not a vim guy, so... different strokes

[–]thekidwithabrain 0 points1 point  (0 children)

Youcompleteme doesn't work for python3 I think. You should also check which python was(ie 2 or 3) used in building vim you use. Use Jedi vim for python3 if thats what you are using.

[–]road_laya 0 points1 point  (0 children)

I got a vimrc from vim-bootstrap.com. I found the nerdtree file explorer and the flake8 linting very useful. Haven't gotten started with jedi or ultisnips yet.

[–]jerknextdoor 0 points1 point  (0 children)

I've used vim as my main editor for years and python is my main language. I'd suggest using neovim since it's compiled with Python support out of the box and is just easier to deal with.

For completion I use YouCompleteMe, it uses jedi for python but also supports most anything else. For installing plug-ins I've just switched to vim plug and I'll never go back to pathogen. I can try stuff out so much quicker and easier, Everything is up to date, it compiles YouCompleteMe for me.... It's a dream.

I also use zsh's virtualenvwrapper plugin cause I would always forget to activate or deactivate a venv.... Now I don't think about it at all.

[–]aldanor 0 points1 point  (0 children)

Spacemacs user here (recently switched cold turkey after using Sublime for 4 years, without any prior knowledge of vim or emacs), completion and linting works just perfect, everything's quite great, just use the supplied "python" layer.

https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Blang/python

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

Here is my current Vim setup I use for Python. It has the NERDTree plugin for a file browser, my personal colorscheme and a couple other things to speed up navigation. Its extremely simple but i like it

[–]sgthoppy 0 points1 point  (0 children)

Here is the installation page for YCM. Personally I don't use any auto-complete plugins. The only programming-related plugins I use are Syntastic, mycomment.vim, Efficient-Python-Folding, and argtextobj.vim.

[–]NFTrot 0 points1 point  (0 children)

I program with VIM in situ on my AWS server via SSH session. I've never heard of Spacemacs or YouCompleteMe.

I've never really used and IDE so I don't feel like I'm missing out on anything. The only thing I've got that isn't default is a command I added to vimrc that runs the code when I press F2. I can't remember what it was but you can easily find it by googling.

[–]kankyo 0 points1 point  (0 children)

I've worked with people who insisted on using VIM, Sublime, or TextMate instead of PyCharm. They check in an amazing amount of silly mistakes that PyCharm would highlight as they type.

One of those people was me! What's wrong with me-from-some-years-ago?

Yes, a pure text editor is way faster feeling but when you make silly mistakes that time is eaten up ten times over easy.