0

Can you target a spesific line number in the gutter? Let's say I want line 20 in the gutter te be red for some reason. Possible? Like CursorLineNr, but defining the line number yourself. In short I'm looking to write a simple plugin showing some simple warnings through colours, not relying on the sign column feature. I use Neovim.

  • "not relying on the sign column feature" why this restriction? – Mass Mar 7 at 17:59
  • I'm simply wondering if it's possible. The ability to colour individual lines of the gutter is a common feature of graphical editors. I strive to keep vim free of clutter, and I thought this would be a nice compromise. – Audun Olsen Mar 7 at 18:30
  • But sign column was designed specifically for your purpose. And I have not seen any GUI editors where you can color specific line number, any example? Just curious. – klaus Mar 7 at 18:42
  • The whole lot of the Electron based ones, where you can add custom CSS and JavaScript interacting with the DOM, which makes it very easy to customise just about anything, including the style of the individual line numbers. Again, I'm only asking if it is possible, as I have not seen any talk of it elsewhere. – Audun Olsen Mar 7 at 18:59
  • 1
    If you're asking if it's possible, as in is there a setting without hacking the source code, then the answer is no. For further assurance, you don't even get CursorLineNr highlight if you don't use cursorline or relativenumber.But if you really need this settings, then you could hack something up so that the line numbers are part of the buffer itself and then you could use typical :h matchadd(). I mean when you're editing vim will add line numbers to the first column of each lines and when you save you have a keybinding that substitutes it with nothing. But this is a huge overhead! – klaus Mar 7 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.