Trying CLion and comparing it with Vim, Neovim
I had to try it after so many people have been talking good stuff about CLion for c++
development.
I do all my stuff with Vim, and since last year with Neovim, including writing this blog post in markdown.
I love the idea of Linux as an IDE, and I have practicing it for a while. My setup consists on a a little bit convoluted .vimrc
, and tmux
. So basically I do it everything in the terminal.
Of course, Vim is an editor, not an IDE, but there are a few plugins that help a lot with IDE-like features: YouCompleteMe for autocompletion, and UltiSnips for generating code snippets, really really good for LaTeX, CMake, and verbose languages in general.
A game changer in favor of neoVim instead of Vim is the fuzzy finder FZF. It is useful for bash/zsh but also using it inside the inline :term
of neoVim.
In times of need, where I am learning a new library, such as ITK, or DGtal for work, I miss the navigation of source files that IDE provides, in those cases I use another plugin called eclim
that creates a server running the eclipse IDE in the background. The problem with this is that you have to create a project in Eclipse CDT, setting appropriate flags for the indexer to work properly, etc. The good thing is that you have to do it once, and then run eclimd
for starting the headless server, and send queries to it from Neovim.
YouCompleteMe has a Checker/Validator based on libclang
, it works great with the help of cmake
to generate the compilation database
in simple projects, but forget about it in heavy or convoluted templated source files, and it doesn’t work in headers. It is a libclang
limitation, YCM
is great, but not really its job.
I have never been against using IDE’s, but I like being proficient in Vim/Neovim for working with a variety of languages in the same environment. I can script a figure in Python, write a manuscript in LaTeX, markdown, or c++
, using the same editor and pretty similar workflow. Vim plugins to the rescue for every case, but all of them sharing 99% of the same functionalities.
For scripting languages I am very fond of tmux
and Slime
plugin to send text from Vim directly to a tmux pane where ipython
or R
interpreters are running.
Still, I am missing easy access to documentation, type checkers (YCM
has one though), refactor, and specially navigating through hierarchies, check where a specific function is called, etc. I only need it for c++
though, and not always. Ah, almost forget I use ConqueGDB
for integrating a GDB console into vim, and works nicely.
Anyway, I am going to try CLion with the IdeaVim plugin (basic Vim emulation), and share my experiences.
EDIT: 2 days later…
Ok, I am out, I am missing tmux
, git in the shell, executing and tweaking stuff in the console, my own shortcuts, I guess I have become linux/vim-dependent! I will wait for clangd
, and implementation of the Microsoft Language Server Protocol using the clang
compiler.
They are now implementing the construction of the index/database, and then, ready to get it into neovim
, see issue #5522, and the plugin LanguageClient-neovim to communicate with LSP servers.