Introduction
This post provides a quick comparison of RStudio, Vim and Visual Studio Code for Data Science. After experimenting in parallel these three editors I decided to stick with RStudio for my Data Science work. In summary RStudio is pure open source and competes very well with Visual Studio Code in functionality. Vim seemed to bring ergonomy and speed but the cost of configuration and learning is not paying off in my view. A key point on the comparison was to confirm that RStudio provides the possibility to minimize the use of the gui thus making the benefit of Vim minimal. The keyboard list also presented here strongly influenced our assessment and encouraged to continue the road to “keyboard only” even without Vim.
IDEs assessment
RStudio
Advantages
* Excellent python-R integration
* Minimal IDE configuration required for Data Science
* Widely used among the R community
* All Vim keyboard shortcuts have an equivalent in RStudio default (see list below)
* Many of the benefits provided by Vim can also be provided by RStudio defaults, it’s a matter of searching for them (e.g. using more the keyboard and less the gui)
* Good potential for becoming a standard with Posit growing
* Is and will remain pure open source
Drawbacks
* no critical drawbacks
Vim
Advantages
* Speed
Drawbacks
* Many benefits provide by RStudio are not easily available on Vim (e.g. require plug-ins, extensive configuration and learning config details)
* Vim brings an additional domain to learn with significant redundancy, mostly with different ways to do the same things just for the sake of being faster
Visual Studio Code
Advantages
* Extremely broad, complete and extensible
* Good packages for Data Science
* Good python and R integration
* Runs Jupyter notebooks
Drawbacks
* Although open source it is backed by Microsoft
Shortcuts comparison
Vim main selling point is the speed provided by a keyboard only approach. There are endless combinations of keystrokes to never have to leave the keyboard. The proposal may seem logic but there are two challenges: is typing the bottleneck? is it worth to learn a second system as myself and I assume many people are already familiar with some system. Or if not the common question of which standard to adopt applies. Personally I’m quite convinced for the direction of keyboard only not for the speed but for the argument of removing layers from brain to machine just as in a musical instrument or a tennis racket we’re not thinking anymore as the years of practice make the instrument more and more the prolonging of the brain.
The list below has been used primarily to confirm that most Vim shortcuts have an equivalent in RStudio. RStudio key shortcuts accessible with Alt + Shift + k. In a separate article I’ll be providing a simple sheet cheat of the keyboard shortcuts that I’ve started with and that I recommend.
Move
Left |
h |
Left |
Right |
l |
Right |
Up |
k |
Up |
Down |
j |
Down |
home |
0 |
Start of line |
End |
$ |
End of line |
Ctrl + Left |
b |
Word backward |
Ctrl + Right 2x |
w |
Word forward |
Ctrl + Right 4x |
2w |
Move 2 words |
Ctrl + Right |
e |
End of word |
Ctrl End |
G |
Last line |
File
|
:q |
Exit |
|
:q! |
Exit discard changes |
Ctrl+s |
:w |
Write |
Ctrl+w |
:wq |
Write quit |
Ctrl+o |
|
Open |
Delete
Del |
x |
Delete under the cursor |
Ctrl + Del |
dw |
Delete word |
Ctrl + Backspace 4x |
d2w |
Delete 2 words |
Shift + End, Del |
d$ |
Delete to End of line |
Home, Shift + End, Del |
dd |
Delete whole line |
Home, Shift + Down, Del |
2dd |
Delete two lines |
Edit
Just type |
i |
Insert text |
End |
A |
Append text |
Enter |
o |
Insert in next line |
Up |
O |
Insert in previous line |
Home, Shift + End, Ctrl + c |
yy |
Yank (copy) a line |
Home, Shift + Down, Ctrl + c |
n,Nd |
Yank lines n to N |
Home,Shift+PageDown, Ctrl+c |
n,Nd |
Yank lines n to N |
Ctrl+z |
u |
Undo |
|
U |
Undo all current line |
Ctrl+Shift+z |
Ctrl+R |
Redo |
|
10J |
Join 10 lines |
Terminal
|
:close |
Close window |
|
Ctrl+W |
Switch window |
Ctrl + 1 |
|
Focus on Source |
Ctrl + 2 |
|
Focus on Console |
Shift + Alt + M |
:term |
Focus on Terminal |
|
:term python3 |
open python terminal |
Help
Alt + Shift + k |
|
Keyboard shortcuts |
Config
|
:set number |
Line numbers on |
|
:set nonumber |
Line numbers off |
|
:syntax on |
Syntax highlight on |
|
:syntax off |
Syntax off |
Vim syntax
syntax: operator [number] motion
operation: Delete two words
command: d2w