2

Sometimes when working with big files containing many functions I would like to create some splits showing specific functions and nothing more.

Is it possible in vanilla vim or with some plugin to limit the window to show only a region of a buffer?

Just to be clear, currently I open several splits for the same buffer and navigate to the function and that works. but I would like to enhance that by:

1) Not showing the before and after text , to help me focus 2) Locking the windows to that region of text so I cannot accidentally move away (by searching , etc).

2 Answers 2

3

The NrrwRgn - A Narrow Region Plugin similar to Emacs plugin can show parts of the buffer in a separate scratch buffer, with automatic syncing back. That looks like a solution when you're concerned about moving away from the view. Otherwise, I would just size a split window to show exactly what you want, and keep it at that.

0

You can use folds to fold the portions you do not want to pay attention to.

To create a fold use v{motion}zf in visual mode. Use za and zd to unfold and remove a fold respectively. You can also create folds in command mode. Essentially {motion}zf.

This video might be a handy reference.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .