1

I spend my days working on 3k to 10k line files, and most of the time, I only work on 200 lines.

  • I usually set a mark at the beginning and the end of the region I am working on, but this has limitations. To search for example I have to select the region and then search inside this region.
  • I tried to use folding, but I am editing tcl, and the plugin that allow folding for tcl syntax makes vim freeze horribly, so it is not usable. I could use manual folding but I would still have this issue for search.

Also, as some portions of the files are very similar (a LOT of duplicate code), I sometimes edit the wrong part and realize only after a lot of changes.

What would be your workflow with vim to handle such situation ?

2
  • i don't understand your question, you want us to explain to you how to manage the code better for editing purposes? Jan 27, 2014 at 18:47
  • No, the code is as it is, I can't change that. My question is about how to efficiently work on a small portion of a big file in vim. marks and folding are cool but limited. Jan 27, 2014 at 19:20

1 Answer 1

3

Manually created folds would be the lightweight solution, but motions like search will open them, so some effort (or additional mappings) is required.

The NrrwRgn - A Narrow Region Plugin similar to Emacs allows to open parts of a file in a separate scratch buffer, with changes being synchronized back to the original buffer. That's the comprehensive, professional solution I would recommend.

1
  • @Ingo Karkat wrote, > motions like search will open them (referring to folds). This is the default behavior, but it is controlled by the 'foldopen' option. If you :set fdm=manual fdo= then your folds should stay closed except when you open them manually. Feb 10, 2014 at 22:38

You must log in to answer this question.

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