Key binding to wrap a selection with an html tag in VSCode

ぃ、小莉子 提交于 2019-12-20 10:36:15

问题


Is there a default key binding in VSCode to wrap a selection in an HTML tag like the keyboard shortcut Shift+alt+W in Visual studio 2015? I could not find anything similar in documentation or in the default keyboard shortcuts that indicates its availability out of the box.


回答1:


To automate this go to.

File > Preferences > Keyboard Shortcuts

and add this into your keybindings.json (right hand side window)

{
    "key": "ctrl+shift+enter",
    "command": "editor.emmet.action.wrapWithAbbreviation",
    "when": "editorTextFocus && !editorReadonly"
}

You can replace ctrl+shift+enter with your own key combination.




回答2:


you can use this extension: https://github.com/Microsoft/vscode-htmltagwrap

or you can:

  1. open the Command Palette: Command/Control+Shift+P (⇧⌘P)
  2. type "wrap", then select "Wrap with abbreviation"
  3. type the tag you want and press enter



回答3:


Or simply search for the HTMLtagwrap extension in VScode, Make selection. Then use Alt + W. Then enter the new tag.



来源:https://stackoverflow.com/questions/37421335/key-binding-to-wrap-a-selection-with-an-html-tag-in-vscode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!