开发者

Notepad++: Encapsulate text in tags

开发者 https://www.devze.com 2023-01-25 06:44 出处:网络
I was wondering if there is an easy way to put entire lumps of text in tags in Notepad+开发者_开发百科+.

I was wondering if there is an easy way to put entire lumps of text in tags in Notepad+开发者_开发百科+.

For example, say I have the following:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Is there a way how I can select the text in each line and then press a hotkey or something, and have all the text I just selected encased in a tag (such as a p tag)?

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>


Have a look at the Macro capabilities of Notepad++.

Your Macro would do the following, giving you have selected the Text to put in Tags.

CTRL-X
Type: <p>
CTRL-V
Type: </p>


Update: The Notepad# plugin is unfortunately no longer maintained, making it unavailable for Notepad++ version 7 and up. There doesn't appear to be another plugin available that works quite as smoothly, but the Emmit plugin comes very close. Once installed via the Plugin Manager, you can select text, press Ctrl + Alt + Shift + Enter, type the tag you wish to use in the dialog box that appears, then hit Enter again to wrap the selection in the tag.


Having recently upgraded Notepad++ and having the plugin I normally use to wrap text in an HTML tag disabled (the name of which I didn't remember), I happened upon this thread first and a dozen others that didn't mention the answer I was looking for: the Notepad# plugin.

You can install it via the Plugin Manager. Once installed, you can select text, press Ctrl+Alt+W, and simply type any tag you want to use. This operation wraps the selection in an opening and closing tag where your keystrokes edit both tags simultaneously.

Notepad++: Encapsulate text in tags


For more functionality you can also try the plugin "WebEdit" or the plugin "Zen Coding - Python". I use that last one myself, but you'll have to install the "Python Script" plugin too, and install Python on your comp...


if you want to wrap every line in list with "tag"
then select lines, go to Plugins / Emmet / Wrap with abbreviation / Enter abbreviation: tag* / press "OK"

0

精彩评论

暂无评论...
验证码 换一张
取 消