[lug] Vim maps / vimrc files for html editing
dio2002 at indra.com
dio2002 at indra.com
Sun Feb 18 14:20:17 MST 2007
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
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 ;-)
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
More information about the LUG