Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrap Text with Quotation Marks in Notepad++ [duplicate]

Is there a shortcut, plugin or code to wrap text with quotation marks ("" or '') in Notepad++?

Eg "text".

I don't know Python and other advanced programming languages, so please explain in a simple way ...

like image 894
Bayu Avatar asked Oct 31 '11 04:10

Bayu


2 Answers

To create the new macro functions:

  1. Open the file shortcuts.xml you find in Notepad++ directory
  2. Into "macro" section add the following code:

    <Macro name="Selection Into Double Quotes" Ctrl="yes" Alt="yes" Shift="no" Key="50">
        <Action type="0" message="2177" wParam="0" lParam="0" sParam="" />
        <Action type="1" message="2170" wParam="0" lParam="0" sParam='&quot;' />
        <Action type="0" message="2179" wParam="0" lParam="0" sParam="" />
        <Action type="1" message="2170" wParam="0" lParam="0" sParam='&quot;' />
    </Macro>
    <Macro name="Selection Into Single Quotes" Ctrl="yes" Alt="yes" Shift="no" Key="49">
        <Action type="0" message="2177" wParam="0" lParam="0" sParam="" />
        <Action type="1" message="2170" wParam="0" lParam="0" sParam="&apos;" />
        <Action type="0" message="2179" wParam="0" lParam="0" sParam="" />
        <Action type="1" message="2170" wParam="0" lParam="0" sParam="&apos;" />
    </Macro>
    
  3. Save, close, the file, restart N++: You will find the new functions into "Macro" Menu.

To use it: Simply select the text and choose the desired menu item or use the desired keyboard shortcut showed at the right side of the menu item itself.

like image 117
willy wonka Avatar answered Sep 22 '22 11:09

willy wonka


I'm not sure if you want the whole line or just each word. This will do each line: Open replace (ctrl H)
Find: ^.
Replace with: "
make sure you select "regular expression" in the search mode.
Select replace all.
That will add a " at the start of each non-blank link.

For the ending one:
Find: .$
Replace with: "

like image 22
nichos Avatar answered Sep 23 '22 11:09

nichos