> Been a long long time vi user but bizarrely never made the > jump to vim until quite recently.
Welcome! > I'm editing a lot of complex html/cake-php thtml templates at > the moment and despite useful color highlighting I'm finding > it quite difficult to see the "wood for the trees" due to the > complex templates i have to edit. Typically for example, I've > got tags with just about every possible attribute populated > stretching over 3-4 lines sometimes. Imagine that embedded in > huge multi level tables with specific tags.... I'm stuck with > the templates to adhere to corporate style. Well, since they can be slightly reformatted, as HTML generally ignores whitespace, you may be able to use an external tool like "tidy" to clean up the code so it's a bit easier to read. It should also help with normalizing the indentation. You may also be interested in reading about "folding" which collapses multiple lines into one: :help folding You can manually create folds to hide away particularly nettlesome segments if there are just a handful, or you can go for a more automated way of folding them. Folds are only line-wise rather than character-wise (though there is an vim patch floating around to also do column-wise folding...this is hearsay, as I've never tried it). Folding can be done by a variety of methods, defaulting to "manual", but also allowing it to be done by syntax, by expression, or by indentation. Or even the manual folding can be done in a semi-automated fashion via a :g command such as :g/<[^>]*$/.,/>/fold which may be a good first place to start. If you used "tidy" and it has normalized indentation, you can just use :set foldmethod=indent and it may allow you to get a bird's-eye view of your code. > to abbreviate or partially hide the detail so i can see the > overall structure more clearly. In essence I would like to > collapse huge (single) lines of tags to something like <a > id="xyz" href="/img ....... - where "...." implies I could > expand if required. Another lazy option might just be to visually hide it with something like :match Ignore /<\_[^>]*>/ which will just hide all the tags (making them background-color on background-color). This is dangerous if you start editing and treat them like you would treat whitespace, but it can help make your content pop. Or you might try /<\s*\w\+\s\+\zs\_[^>]*/ which will just discolor your attribtes. If you want to see them but make them more subdued, you can opt for a different highlighting group than "Ignore", something like :match Comment /.../ where, at least in my setup, Comment is dark grey on black which allows me to see it, but it isn't quite as intrusive. When done, you can un-:match them with :match none You can read all about this at :help :match > For lots of boring reasons I don't have the option of funky > graphical html editors or environments - i'm in a remote shell > using vim in text mode. You have Vim...what more do you need? ;-) Hope this gives you some ideas with which to work... -tim