neovim as an IDE for Linux dev
neovim as IDE

neovim as an IDE for Linux dev

I have been a vim user for long time, and always I loved vim for any kind of programming. Though mostly I have worked on Unix and Linux kernel, but sometimes I have used python, go code bases and that time I really liked some of the IDE like pycharm, vscode with some plugins. But none of them I felt very comfortable with while working on C based code bases and also the fast and responsiveness of vim always made me to come back to vim.

Then recently I started playing with neovim, a new vim maintained by multiple vim enthusiasts, and it is vim with support for lsp, lua plugins. Please check out neovim:

Now after couple of days of hacking and working with it, I have created a script to ease the initial setup of neovim in Ubuntu 20.04 and later. After running the script it sets up the init.vim and also installs all required plugins for a good IDE environment for linux kernel or for most system programming projects.

There may be some minor errors but can be easily fixed by looking at the error message. Now the script nv_setup.sh, will install neovim, nodejs, running update-alternative for setting neovim as vim, populating init.vim. For plugin management I am using vim-plug, and using PlugInstall command in neovim, one can install all the plugins after the script is run.

For lsp support, we are using coc.nvim and for C language, we need to install using CocInstall command coc-clangd, then CocCommand clangd.install for clangd installation.

Now clangd based lsp needs compile_commands.json, and in linux kernel we can easily generate that after one successful compilation of kernel. To generate that please use the script scripts/clang-tools/gen_compile_commands.py in linux source tree. Now you are ready to work with neovim as an IDE for linux kernel development.

For non-Linux kernel, but for system programming, please refer to scan-build repository and use intercept-build to generate compile_commands.json file to use with clangd.

Sajal Agarwal

Technical Leader at Cisco Systems

2 年

will try it out..cool stuff

要查看或添加评论,请登录

Souradeep Chakrabarti的更多文章

社区洞察

其他会员也浏览了