cameron-wags / rainbow_csv.nvim

Neovim port of mechatroner/rainbow_csv
MIT License
80 stars 4 forks source link

first row as header when editing? #9

Open gilbh opened 1 year ago

gilbh commented 1 year ago

Hi,

I am minimally using this plugin for viewing and light editing of csv files in neovim, activating RainbowAlign in autocmd for *.csv

My question is: is there a way to open the file with the first row appearing as header (that is: floating when scrolling down or right, etc.)?

Thanks for any help!

cameron-wags commented 1 year ago

Not right now, unless you're willing to add a lot more to that autocmd 😉. If I'm understanding correctly, you'd like to pin some text(the CSV header in this case) to the top of the window for reference. I might add this as a feature when I have time, it seems useful.

I know nvim-treesitter-context has similar behavior. Using the screenshot as an example: line 1044(the function I'm in) is pinned to the top of the window when it wouldn't be visible in vanilla neovim.

image

I'll probably borrow heavily from their implementation when I get around to it.

gilbh commented 1 year ago

Thanks for considering this. What you describe here reminds me also of wellle/context.vim ...

On the autocmd improv, here's what I ended up adding when a csv file is opened:

  execute "split"
  execute "wincmd k"
  execute "resize 1"

-- as so to create two windows of the same csv buffer, with the top as one row height serving as a header. But this is lame on so many levels ...

cameron-wags commented 1 year ago

From the little I've seen, windows are the best way to do it. Fortunately, nvim apis let you control the window & buffer behavior very specifically.

gilbh commented 1 year ago

That's good. In my mind, that would help with syncing horizontal scrolling etc. (but I have no idea about coding in lua/nvim). Best!

benjamin051000 commented 11 months ago

Any progress on this?