Monday, July 21, 2014

Re: Treat section of file as entire file

On 10:51 Mon 21 Jul , Ethan Hereth wrote:
> On Mon, Jul 21, 2014 at 10:42 AM, Paul <google1241@rainslide.net> wrote:
> > Say you have a file that contains many code functions, and you're only
> > concerned with one particular function. I wonder if there's a plugin that
> > will let you select a part of a file, in this case our function, and limit
> > vim 'things' to only this selected section. For example, doing a / search
> > would only search within the target area. :%s// would only look inside the
> > area, etc. I know I could copy the area to a new file, edit that, then paste
> > it back, but I really want it the same file, because for example I might
> > want to do a :make on it, which requires the other 'outside' bits of the
> > file to be present.
> >
> > Anyone know if such a thing exists?
>
> You should look into Christian Brabandt's NarrowRegion plugin.
> (https://github.com/chrisbra/NrrwRgn)
> I believe it does what you're looking for.
>
> Cheers,
>
> Ethan Alan

Another choice is my ViewPort plugin
(http://www.vim.org/scripts/script.php?script_id=4296)
which I wrote because I didn't know about NarrowRegion at that time.

Best,
Marcin Szamotulski

No comments: