[lug] Vim maps / vimrc files for html editing

Steve Webb steve at badcheese.com
Sun Feb 18 14:53:36 MST 2007

Might want to check out VIM's "folding" mode.  Not sure if it'll help 
a lot with deleting between tags, but you could use it to move around 
quicker and make more sense out of the HTML.

I use VIM for html editing, but mostly just use the "visual highlighting" 
of what I want to delete or change and then operate on it.

- Steve

On Sun, 18 Feb 2007, dio2002 at indra.com wrote:

> Date: Sun, 18 Feb 2007 14:20:17 -0700 (MST)
> From: dio2002 at indra.com
> Reply-To: "Boulder (Colorado) Linux Users Group -- General Mailing List"
>     <lug at lug.boulder.co.us>
> To: lug at lug.boulder.co.us
> Subject: [lug] Vim maps / vimrc files for html editing
> The ide thread prompted me to post this.
> My ide has always tended to be vim/make as well.  that said, i've been
> doing some html work as of late.
> Anybody out there use vi/vim for HTML editing?
> Do you have any good/fav html "tag" / editing maps (cut n pasted) or
> sample vimrc files you'd like to share here?  Some of the reg expressions
> to do what i want are a little crazy.  countless searches on
> google/vim.org don't seem to bring up anything.
> Some things i can think of are maps for:
> 1a) automatically complete an end tag for the nearest existing matching tag
> 1b**) tag replacement/deletion (delete everything between the current < >
> OR </ > tags without deleting the < > OR </ > tags themselves
> 2a**) deleting/changing everything between the two nearest surrounding
> tags your cursor happens to be located [the stumper here is how to do this
> if your matching tags are spread out over multiple lines]
> 2c**) delete/replace everything between the two nearest surrounding tags
> your cursor happens to be located INCLUDING THE TAGS THEMSELVES [the
> stumper here is how to do this if your matching tags are spread out over
> multiple lines]
> 2b**) replacing the two nearest surrounding tags where your cursor is
> located (the opposite of 2a).  Not sure this is possible.  Basically it
> would delete both tags first, then put you in insert mode, put in the beg
> tag and then automatically use that tag to create the matching end tag.
> 3) reformatting a table indented with a command so that tr and td are
> visually nested for better reading
> 4**) quick key to go to the next/prev tag and postion on first character
> AFTER the OPENING "<".  If it's and end tag then you want to go to the
> first charcter after teh "/".  Doing a regular search on "<" is not fast
> enough and it tends to leave you on the "<" and not the first character of
> the tag you want to delete.
> 4b**) same as 4 except go to first character after teh CLOSING "<"
> fwiw, items with ** are most desired ;-)
> Also.
> Is there away for vim to do substitutions across multiple files that are
> in the same directory or lower as teh current file you're applying the
> substittion to?  The idea is that once you finish the substitutions in teh
> current file, it loads the next file, etc and applies teh substitution.
> If you want, you can have it prompt you to confirm the replacement as well
> versus doing it all automatically.
> this is useful for changing paths in multiple files if you change your
> site structure around or duplicate a directory to a different path.. the
> ability to be prompted is very cool because sometimes paths don't need to
> change in one file for whatever reason.
> actually maybe there's a way to use a regexp on the substitute command to
> have it limit what files it will do the substitutions on?
> I'm pretty sure i saw this somewhere recently but i can't find it.
> fyi, i ask because i sometimes use vim on a windows platform where
> grep/xargs isn't available and because even on linux, doing the subs in
> vim would allow me that "prompt before change capability" to make sure i'm
> only changing the links i want to.
> thanks in advance
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug

EMAIL: (h) steve at badcheese.com  WEB: http://badcheese.com/~steve

More information about the LUG mailing list