2

Why I switched to Neovim

 3 years ago
source link: https://blogs.sap.com/2021/01/17/switching-to-neovim/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Technical Articles
Posted on January 17, 2021 2 minute read

Why I switched to Neovim

3 Likes 230 Views 0 Comments

In my professional career, I’ve exclusively used IDEs for software development even though they:

  • have long startup times
  • are bloated and slow
  • have inefficient key bindings
  • require a mouse

Eclipse_Logo2014_New.jpg1024px-Visual_Studio_Code_1.35_icon.svg_.png

The reason for that is because I desperately needed (and still need) many of their features which plain text editors couldn’t properly provide, namely:

  • language features for all my used languages (go to definition, autocompletion, etc.)
  • a debugger

However, I really like the features of my favourite text editor Vim, it:

  • is 100% keyboard driven
  • has a command centric approach with a huge amount of commands
  • is modal
  • does not need a GUI and can run in your terminal
  • is highly configurable using simple text files
  • has a low memory footprint

vim_editor.gif

Having already invested many years in Vim (which has an immense learning curve), I did not want to give up my acquired skills. Unfortunately, I never managed to add the needed features to Vim.

So instead of adapting Vim to be more IDE-like, I tried to make my IDEs behave more like Vim using plugins and keybindings. Depending on the IDE, this worked to some extend, but I was never really happy with it because a lot of commands were not supported, keystrokes were occasionally ignored, many features still required a mouse and the problem of sluggishness persisted.

My most successful attempt was using VSCode with the Neo Vim extension where keybindings are not just mapped, but a complete instance of Neovim was run inside of VSCode. It worked really well, but the bloat of VSCode, which is an Electron app, still concerned me.

VSCode also introduced two very important innovations: The Language Server Protocol (LSP) and the lesser known Debug Adapter Protocol (DAP), which solve the problem of every editor/IDE having to support every programming language. Now, an editor/IDE only needs to support the LSP and the DAP. These innovations provide unified and standardised access to language and debugger features of specific programming languages.

Vim supports the LSP and DAP through plugins. Neovim is a fork of Vim and has a more modern governance structure (many contributors as opposed to only one), allowing the development of many new features, including native support for the LSP.

neovim-logo-flat-1.png

And now, after so many years, I finally managed to set up both the LSP and the DAP, providing Neovim with all the language features and debuggers I need. It wasn’t easy to set up and I even had to write some scripts, but it works. Finally, there’s no reason to use IDEs anymore. I made the switch.

I created a short demo, showcasing some of the features.

I managed to make Neovim’s native LSP client use the LSP server of the SAP Cloud Application Programming Model (CAP) and I added syntax highlighting for cds files. DJ Adamsvideo on cds-lsp was of great help for me.

Screen-Shot-2021-01-17-at-13.01.56.png

I can confidently say, I learned a lot during this process and I’ve grown as a programmer. I’m finally comfortable with my development setup and I’m curious of Neovim’s future innovations.

Thanks a lot for your time and keep your programming tools sharp,
David


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK