summaryrefslogtreecommitdiffstats
path: root/computer/vim_vs_ide.rst
blob: 4f30d79373f0fbe93908cde3da58870152641841 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
vim v. IDE for Python programming
#################################

:date: 2017-10-30
:category: computer
:tags: blogComment, python, vim, emacs, git, FLOSS

(somebody asked me in email about my opinions on vim v. IDE for 
Python programming, I think it could be worthy of being available 
to others as well)

    Obviously you are interested in Python and Vim. Therefore I'd 
    like to ask you whether you use a Python IDE. If so, is it 
    a Vim-based one or a different tool like Eric or PyCharm (by 
    JetBrains with its headquarters in Prague).

NetBeans was a Czech project, Eclipse and JetBrains just have 
labs here (JetBrains is more a Russian company, headquartered in 
St. Petersburg, as far as I know, although I wonder whether they 
won’t follow all smart Russians and move out of the reach of Mr.  
Putin).

Concerning me and IDE. No, I don't write my emails in my $EDITOR, 
but that's just because I work for Red Hat as a Desktop QA, so 
I am trying to use our products as much as possible (i.e., 
switching between Thunderbird and Evolution with local mails on 
IMAP server on localhost).  Otherwise, everything else (from 
Python to writing a novel) I do in vim.

However, I constantly feel in background that there is something 
wrong with using ``gqap`` in Normal mode when it is year 2017, so 
I tried I believe almost all alternatives (I have been using 
Linux since 2000, most of the time having vim as my $EDITOR).  
From other editors (Emacs, gedit … I have even started 
https://gitlab.com/mcepl/gedit-rope, Sublime) to all possible 
IDEs (Eclipse with PyDev, NetBeans … just briefly, PyCharm, VS 
Code, yes, even Eric) and scenario is always the same. First 
moment is enchantment with new opportunities (e.g., I really 
liked Mylyn on Eclipse) and then hard life of trying to survive 
with the new environment. After grinding my teeth over the need 
to learn new stuff I always get to that state of uncontrollable 
rage when I have no clue how to do what I would like to do, but 
I know four keystrokes which would do it for me in vim. So, I am 
back with vim again.

Part of my problem is that I really don’t do large Python 
projects with zilion of files, classes, etc. in the Java meaning 
of the word ‘project’. A colleague from the JBoss team was 
sitting next to me for many years. He was working almost all his 
hours on one project inside of the gigantic cloud of Java classes 
and symbols.  For him there never was anything else than his IDE 
(originally Eclipse, now mostly IntelliJ IDEA), it was literally 
only program he run most of the day. He finally learnt how to run 
his unit tests inside of his IDE and then he just didn't use 
anything else (except, for some weird reason, he hated integrated 
support for git, so he used terminal just for that). When he 
needed that weird class in one of the other hundreds of classes 
it was just at his fingertips and life was good again. The only 
other alternative of using editor was him using a debugger, which 
was again in his IDE. 

That is unfortunately (?) not how I work. I usually write just 
plenty of not so complicated Python scripts and I need to run 
them in bash all the time (or via some other command line utility 
in our testing server on the other side of the world). I don’t 
use complicated weird list of classes (aside from one or two 
external libraries we try to keep ourselves mostly inside of the 
stdlib), I mostly don't use debugger (usually ``logging.debug()`` 
is the best debugging tool I can get anyway), so there is really 
not much I can expect from IDE. 

I tried some attempts to use some vim plugins for project-like 
organization, but I usually don’t use them in the end. I even use 
too little of vim-snippets (although these could be useful). 

In the end I have decided to stay with vim (and I maintain 
https://copr.fedorainfracloud.org/coprs/mcepl/vim8/), but I think 
that your decision to use one or another depends a lot on the 
style of your work. I can imagine that with complicated large 
Django project you may be closer to my JBoss colleague and use 
good Python IDE (and if using professional PyCharm, you can use 
Django-specific support and/or SQL databases support). PyCharm 
has surprisingly good vim emulation (not just hjkl keys, which 
I don't use anyway, but really nice work with objects, like ci" 
or similar). 

The only thing which made me think for a second over VS Code from 
Microsoft was their debugger. Really slick, if you can use it, 
worthy of consideration. 

    Some of my colleagues developing big Python/Django projects 
    used PyDev (http://www.pydev.org/) or vim-pydjango 
    (https://github.com/yodiaditya/vim-pydjango) but switched to 
    PyCharm after a while. 

Just to note that vim-pydjango looks like one of those poorly 
stitched together collections of „everything I have currently on 
my disc“. I prefer to use original plug-ins themselves (ropevim 
or Jedi for code completion and jumping in the code, UltraSnips 
& vim-snippets, of course everybody has to have vim-fugitive 
installed, etc.). With the packages support now in vim8 (did 
I tell I maintain Fedora/RHEL builds of the latest vim8? ;), it 
is really no trouble to have multiple plug-ins constantly updated 
(put ~/.vim/pack into git repository and all individual modules 
as git submodules), and you get the latest code and the best 
support. 

    My younger colleagues say they were much more productive with 
    a good IDE and PyCharm is perhaps the best one, at least the 
    commercial version. I prefer open source tools with the full 
    feature set, so PyCharm would not be my first choice. 

There is free (both as in beer and as in free speech) version of 
PyCharm, but it doesn't have those special plugins for 
Django/SQL. Fedora/RHEL packages from one of my colleagues are on 
https://copr.fedorainfracloud.org/coprs/phracek/PyCharm/ but I am 
sure you get them somewhere for any Linux distribution. 

However, as I said, ‘better’ means different things for different 
people. Try some IDE and you can see how it works for you. 

    Do you have a recommendation? In case you use a Vim-based IDE 
    which one do you prefer? If you use Vim as pure text editor 
    and not as IDE: Do you have special plugins and settings for 
    Python? 

By the way, vim-based IDE (i.e., those vim-pydjango or 
https://github.com/python-mode/python-mode) are usually horrible 
combination of all worst parts of vim and IDE. Too heavy, not 
well maintained, and not as good as true IDE. Use vim plugins 
directly and sparingly. 

https://michiganlabs.com/2014/08/29/vim-python-ide/ 
and 
https://blog.jetbrains.com/pycharm/2013/06/vim-as-a-python-ide-or-python-ide-as-vim/ 
(yes, it is from marketing guy at JetBrains) 

are two articles worthy of consideration. However, the conclusion 
depends on you. 

    I myself take the standard Vim distribution maintained by 
    Bram and a small .vimrc with no real Python-specific 
    settings. For me that has been enough so far but I want to 
    find out if there is a better environment I can live with. 

I really believe that SOME plug-ins are worthy of installation.  
Below is the output of ``ls -1 -d ~/.vim/pack/*/*/*`` I have too 
many plugins, and there are many I don't use, but some (ALE for 
running pylint/flake8/etc.  in background, fugitive for weirder 
aspects of life with git, vim-unimpaired, vim-textobj*, 
ultisnips, ropevim, Ack.vim with ripgrep) are seriously useful.::

    $ /bin/ls -d ~/.vim/pack/*/*/*
    /home/matej/.vim/pack/own/start/slovnik-seznam
    /home/matej/.vim/pack/own/start/vim-diff_navigator
    /home/matej/.vim/pack/thirdparty/opt/vim-ditto
    /home/matej/.vim/pack/thirdparty/opt/vim-racer
    /home/matej/.vim/pack/thirdparty/start/ack.vim
    /home/matej/.vim/pack/thirdparty/start/ale
    /home/matej/.vim/pack/thirdparty/start/asyncrun.vim
    /home/matej/.vim/pack/thirdparty/start/closetag.vim
    /home/matej/.vim/pack/thirdparty/start/ctrlp.vim
    /home/matej/.vim/pack/thirdparty/start/editorconfig-vim
    /home/matej/.vim/pack/thirdparty/start/fugitive-gitlab.vim
    /home/matej/.vim/pack/thirdparty/start/html5-natalian
    /home/matej/.vim/pack/thirdparty/start/lexima.vim
    /home/matej/.vim/pack/thirdparty/start/mediawiki.vim
    /home/matej/.vim/pack/thirdparty/start/pydoc.vim
    /home/matej/.vim/pack/thirdparty/start/pyunit.vim
    /home/matej/.vim/pack/thirdparty/start/Recover.vim
    /home/matej/.vim/pack/thirdparty/start/ropevim
    /home/matej/.vim/pack/thirdparty/start/todo.txt-vim
    /home/matej/.vim/pack/thirdparty/start/ultisnips
    /home/matej/.vim/pack/thirdparty/start/unicode.vim
    /home/matej/.vim/pack/thirdparty/start/VCard-syntax
    /home/matej/.vim/pack/thirdparty/start/vim-behave
    /home/matej/.vim/pack/thirdparty/start/vim-characterize
    /home/matej/.vim/pack/thirdparty/start/vim-commentary
    /home/matej/.vim/pack/thirdparty/start/vim-cuesheet
    /home/matej/.vim/pack/thirdparty/start/vim-fugitive
    /home/matej/.vim/pack/thirdparty/start/vim-gitlab
    /home/matej/.vim/pack/thirdparty/start/vim-indent-object
    /home/matej/.vim/pack/thirdparty/start/vim-makegreen
    /home/matej/.vim/pack/thirdparty/start/vimoutliner
    /home/matej/.vim/pack/thirdparty/start/vim-repeat
    /home/matej/.vim/pack/thirdparty/start/vim-restructuredtext
    /home/matej/.vim/pack/thirdparty/start/vim-rooter
    /home/matej/.vim/pack/thirdparty/start/vim-scriptease
    /home/matej/.vim/pack/thirdparty/start/vim-snippets
    /home/matej/.vim/pack/thirdparty/start/vim-solarized8
    /home/matej/.vim/pack/thirdparty/start/vim-speeddating
    /home/matej/.vim/pack/thirdparty/start/vim-sticky-notes
    /home/matej/.vim/pack/thirdparty/start/vim-surround
    /home/matej/.vim/pack/thirdparty/start/vim-textobj-function
    /home/matej/.vim/pack/thirdparty/start/vim-textobj-python
    /home/matej/.vim/pack/thirdparty/start/vim-textobj-quote
    /home/matej/.vim/pack/thirdparty/start/vim-textobj-user
    /home/matej/.vim/pack/thirdparty/start/vim-unimpaired
    /home/matej/.vim/pack/thirdparty/start/vim-vinegar
    /home/matej/.vim/pack/vimballs/start/math-vba
    /home/matej/.vim/pack/vimballs/start/vim-info
    $