Do you, like me, like to develop your CAP projects with VIM?
I have created a git repository that creates a Docker image with which you can run Lazyvim in a container and use the language server protocol (lsp) for CAP, Typescript, json, ... .
This allows you to get a similar programming experience as in VSCode. However, the fingers stay on the keyboard and do not always switch back and forth between keyboard and mouse.
What is Lazyvim? It is the newest kid in the block of VIM variants. To be exact it's not a new implementation. It is based on Neovim, a very popular vim fork. On top of this it adds a bunch of plugins and configures them as well as Neovim itself.
In the end you get a nice editor, no it's more an IDE, in the terminal
The Docker image you can create with the git repository does the following
A picture is worth a thousand words. So some screenshots follow.
When you first run your Docker container you have to be a bit patient (~30 seconds) cause it does all the installation work. At the end you see something like this (have a look at the README.md to see how I handle my containers).
At this point you can press the 'q' key to close the popup and start editing your files.
Btw. the next time you start your container you'll see this welcome screen.
If you are not familiar with VIM the next step would be to press the <space> key:
Here you see the most important shortcuts you can use to get your work done. The pink entries immediately start an action, the violet ones show you the next level of shortcuts.
In the next screenshot you see the result of 's' at the first level.
To start editing a file press <space><space>. A popup opens from which you can select a file or just enter some characters to reduce the amount shown files and then select one.
Let's come to the cds-lsp (cds language server protocol) plugin.
I opened a cds file and added a new property 'internalnotes' to the entity Books. When I define the type and begin typing I get suggestions (code completion). See the next two screenshots.
If I have an error in my cds file this is immediately shown.
You can navigate to the type under cursor by pressing 'gd' (goto definition)
or show all references of a type by pressing 'gr' (goto references).
If you press <shift>-k you get the documentation of the artifact.
If you want to format a single file just press 'cf' and if you want to format all your cds files use the 'format-cds' script that comes with the cds-lsp package by pressing ':!format-cds<enter>'. Here you see the results of this call
The last screenshot is not from cds-lsp but shows my beloved lazygit which is also integrated into this Docker image and can be displayed by pressing '<space>gg'.
In this blog post I told you about Lazyvim, introduced my Docker image to easily use Lazyvim without manual configuration and showed you how you can easily edit cds files by leveraging the cds-lsp package.
For all those of you who like working in a terminal there is no longer a need to use VSCode.
There is much more you can do with Lazyvim and Docker but that's beyond the scope of this blog post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
8 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |