Sunday, December 8, 2013

Re: autocompletion for html (and other things)

> >> How can I configure vim to allow me to type this...
>
> >>
>
> >> <html>
>
> >>
>
> >> ...and have the closing tag created, too...
>
> >>
>
> >> </html>

> > Actually HTML defines omnicompletion by default in a way that pressing <C-X><C-O> after typing "</" will auto-complete whatever tag is open.

yes, but I find that too much work!

> > Or the popular surround plugin allows creating matching pairs of open...close tags with the cursor between. I think using <C-S> in insert mode. But I don't quite remember, consult the help.

yes, I've been checking out surround. I like it, but the workflow is a little different: in the case of html, say, you might type content and then command in the tags after. So, I like it, and it has obvious use in other cases, e.g., deleting or changing surrounding items, including tags, but it's not quite the flavor or what I've seen in some IDEs with autocompletion.

> http://mattn.github.io/emmet-vim/

Yes, this looks great -- it is specialized for html and css.

Seems to me like surround is the best short-run fix, because it helps for more than just tag autocompletion.

I appreciate Erik's suggestion...

> In .vimrc or a more application-specific config file, add the line:
> iab ht <html> </html>
> Now, typing ht<space> gives: "<html> </html>" (i.e. RHS <> are literal)

but it seems this would duplicate emmet-vim.

BTW - this has been one of the more fruitful mailing-list response threads I've enjoyed in awhile -- if this is indicative of the spirit of the vim tool, then I feel fortunate to be switching to vim!

G

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment