HTML editing and tag completion

311 zobrazení
Přeskočit na první nepřečtenou zprávu

NM Public

nepřečteno,
3. 3. 2008 9:58:0303.03.08
komu: vim...@googlegroups.com
Thanks to travis's post, I learned about Omni Completion. I've
been experimenting with it and it's not really what I want for
HTML editing and I wonder if you all could point me to some
features or scripts that would get Vim to do the following: When
I type the beginning of a tag, e.g.:

<ul

and then press a key, e.g. TAB, it would automatically be
expanded to this:

<ul><li> </li></ul>
^
cursor here

I've gotten spoiled by this in Dreamweaver, but I'm really trying
to escape from Dreamweaver and would love to just use Vim.

Any tips for efficient HTML editing are welcome.

Thank you,
Nancy

PS - I know this is a general Vim question rather than a MacVim
question, but I'm starting here because I mainly use MacVim and
this is where I learned about Omni Completion.

Nico Weber

nepřečteno,
3. 3. 2008 10:08:3503.03.08
komu: vim...@googlegroups.com
> Thanks to travis's post, I learned about Omni Completion. I've
> been experimenting with it and it's not really what I want for
> HTML editing and I wonder if you all could point me to some
> features or scripts that would get Vim to do the following: When
> I type the beginning of a tag, e.g.:
>
> <ul
>
> and then press a key, e.g. TAB, it would automatically be
> expanded to this:
>
> <ul><li> </li></ul>
> ^
> cursor here
>
> I've gotten spoiled by this in Dreamweaver, but I'm really trying
> to escape from Dreamweaver and would love to just use Vim.
>
> Any tips for efficient HTML editing are welcome.

Lowtech solution:

:iabb ul <ul><li></li></ul><C-o>13h

After that, `ul` gets replaced by what you wrote. You might also want
to check out the snippets plugin: http://www.vim.org/scripts/script.php?script_id=1318
I haven't used it, but I heard good things about it.

Nico

Ted Pavlic

nepřečteno,
3. 3. 2008 10:31:4203.03.08
komu: vim_mac
> <ul><li> </li></ul>
> ^
> cursor here


I know the Vim-LaTeX plugin comes with the ability to do exactly this. I
use it with LaTeX all the time.

From what I understand, it improves upon what's already in Vim. So, I
HIGHLY recommend you go to the main Vim list (or a FAQ).

--Ted


--
Ted Pavlic <t...@tedpavlic.com>

Matt Tolton

nepřečteno,
3. 3. 2008 11:28:5303.03.08
komu: vim...@googlegroups.com
Additionally, the surround.vim plugin does wonders when editing these
kinds of files.

http://www.vim.org/scripts/script.php?script_id=1697

IMHO, this plugin should be included in the vim distribution (just as
matchit is).

Matt

Morel David

nepřečteno,
3. 3. 2008 10:32:3303.03.08
komu: vim...@googlegroups.com

Le 3 mars 08 à 15:58, NM Public a écrit :

>
> Thanks to travis's post, I learned about Omni Completion. I've
> been experimenting with it and it's not really what I want for
> HTML editing and I wonder if you all could point me to some
> features or scripts that would get Vim to do the following: When
> I type the beginning of a tag, e.g.:
>
> <ul
>
> and then press a key, e.g. TAB, it would automatically be
> expanded to this:
>
> <ul><li> </li></ul>
> ^
> cursor here

http://www.vim.org/scripts/script.php?script_id=1318

D.Morel

travis

nepřečteno,
3. 3. 2008 12:00:0503.03.08
komu: vim_mac
For HTML editing there's a few scripts you want.

SnippetsEmu - is exactly what you want, it's very similar to
TextMate's snippets, you can set it to that completion you want.
(http://www.vim.org/scripts/script.php?script_id=1318)
Surround - surrounding bunch of text and adding tags to them, you can
add your own commands as well to be faster. (http://www.vim.org/
scripts/script.php?script_id=1697)
HTML.vim - add's macros and menus (http://www.vim.org/scripts/
script.php?script_id=453)
xmledit - automatically closes tags when you type them in and if you
press another > after making a tag it automatically indents it for
you. (http://www.vim.org/scripts/script.php?script_id=301)

NM Public

nepřečteno,
5. 3. 2008 4:27:4505.03.08
komu: vim...@googlegroups.com
Sur 2008-03-03, travis e'crit:

>
> For HTML editing there's a few scripts you want.
>
> SnippetsEmu - is exactly what you want [...]

Thank you all for all your excellent suggestions. I now need to
find some time to experiment with all these!

Long live Vim!
Nancy

Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv