Fork me on GitHub
#vim
<
2022-09-01
>
walterl22:09:59

[Not Clojure related] How can I create a Neovim window that contains only a section of a file, identified by boundary regexes? I'm working on a large Markdown document, and would like to open one of the sections (`start=/^### Section/, end=/^### /`) in a separate window for reference. I'd like to edit, search and move around in that window without leaving that section. https://github.com/chrisbra/NrrwRgn is the closest I could find (and very neat!), but it prevents the source buffer from being modified while a narrowing window is open.

walterl22:09:53

A simple solution could be to limit the cursor to a region (defined by start/end regexes) in a window

walterl22:09:08

I guess it could be useful in large Clojure files too 🙂

Martynas Maciulevičius23:09:11

Why not use FZF and search for lines in the current buffer?

walterl23:09:46

I think in spacial terms, so having to jump around (even when it's easy to jump back) really breaks my flow.

walterl23:09:07

It's much easier for me to have context A in window 1, and context B in window 2. In this case contexts A and B are in the same buffer.

walterl23:09:40

Conversely, every time the cursor jumps, I have to reorient myself. I try to mitigate this by adding zvzz to some of my jumping mappings.

Martynas Maciulevičius00:09:27

I press <C-o> to go back :thinking_face: But it doesn't work all the time But actually <C-T> is a better one

jkrasnay01:09:17

This looks helpful (I have not tried it myself): https://github.com/Pocco81/true-zen.nvim

walterl05:09:25

Yeah, found that one too. It's a nice plugin, but not what I'm after.