Vim cursor position after expanding html tag

后端 未结 4 1667
悲哀的现实
悲哀的现实 2020-12-31 10:02

I most IDEs and modern text editors (Sublime Text 3) the cursor is correctly indented after inserting a newline in between an html tag (aka \'expanding\" the tag):

B

4条回答
  •  离开以前
    2020-12-31 10:42

    @RandyMorris and @romainl have posted good solutions for your exact problem.

    There are some other possibilities you might be interested in if you are typing out these tags yourself: there's the ragtag.vim plugin for HTML/XML editing.

    With ragtag.vim you type this to create your "before" situation (in insert mode):

    div
    

    To create your "after" situation you would instead type:

    div
    

    So if you know beforehand that you are going to "expand" the tag, typing just the element name and the combo CtrlX followed by Enter is enough.

    There are also other more advanced plugins to save keystrokes when editing HTML, such as ZenCoding.vim and Sparkup.

提交回复
热议问题