Introduction
I am using Neovim for programming.
I was initially already using a certain scrollbar plugin, but it was very simple and could not display git, diagnostic or search results.
I had never made a Neovim plugin before, but when I read the source of the plugin, I decided to make my first neovim plugin nvim-scrlbkun, because it was not too big and I thought I could implement my own plugin based on it.
nvim-scrlbkun displays the cursor position, the results of git, search, diagnostics in addition to a scrollbar itself, with the auto-hiding feature.
I would be happy if you used it.
Implementation
nvim-scrlbkun is written in lua.
I had very little experience with lua, but it was very easy to use and I had no trouble understanding the functional aspects of the language. I was used to a language with classes, so the lack of class functionality was a bit painful for me.
Personally, I find it very similar to JavaScript.
nvim-scrilbkun displays a floating window at the right edge of each window, and draws elements such as search, git, diagnostics, on the floating window as virtual text.
I thought about using only virtual text without floating windows, but gave up because the display collapses if there are long lines that are wrapped.
I had a bit of trouble implementing the display of the search results, since the v:hlsearch
, an internal variable of Neovim, does not change at the moment of search, so I decided to delay rendering the results. It is a simple idea now, but it seemed like a very good idea when I first came up with it(I had to remove some resulting bugs, though).
Impressions after implementation
Through this experience, I realized again that the best way to improve coding skills is to read codes excellent people write.
I think it is a waste of time if you are struggling on your own, so there is no way you can avoid using github, where you can immediately see codes written by excellent people.
Top comments (0)