Notepad++ Multi editing

前端 未结 9 1348
一向
一向 2020-12-12 13:09

How can I have multiple cursors in Notepad++?

I will have a couple of tab delimited values . I need to write a query for all of these values. For example, if I get a

相关标签:
9条回答
  • 2020-12-12 13:45

    Notepad++ also handles multiple cursors now.

    Go into Settings => Preferences => Editing and check "Enable" in "Multi editing settings" Then, just use Ctrl+click to use multiple cursors.

    Feature demo on official website here : https://npp-user-manual.org/docs/editing/

    0 讨论(0)
  • 2020-12-12 13:45

    Notepad++ only has column editing. This is not completely the same as multiple cursors.

    Sublime Text has a marvelous implementation of this, might be worth checking out...
    It's a relatively new editor (2011) that is gaining popularity quite fast: http://www.google.com/trends/explore#q=Notepad%2B%2B%2C%20Sublime%20Text&cmpt=q

    Edit: Apparently somewhere around Notepad++ version 6.x multi-cursor editing got added, but there are still a few more advanced features for it in Sublime, like "select next occurrence".

    0 讨论(0)
  • 2020-12-12 13:46

    You can use the plugin ConyEdit to do this. With ConyEdit running in the background, follow these steps:

    1. use the command line cc.spc /\t/ a to split the text into columns and store them in a two-dim array.
    2. use the command cc.p to print, using the contents of the array.
    0 讨论(0)
  • 2020-12-12 13:47

    You can add/edit content on multiple lines by using control button. This is multi edit feature in Notepad++, we need to enable it from settings. Press and hold control, select places where you want to enter text, release control and start typing, this will update the text at all the places selected previously.

    Ref: http://notepad-plus-plus.org/features/multi-editing.html

    0 讨论(0)
  • 2020-12-12 13:52

    Notepad++ has a powerful regex engine, capable to search and replace patterns at will.

    In your scenario:

    1. Click the menu item Search\Replace...

    2. Fill the 'Find what' field with the search pattern:

      ^(\d{4})\s+(\w{3})\s+(\w{3})$
      
    3. Fill the replace pattern:

      Insert into tbl (\1, \2) where clm = \3
      
    4. Click the Replace All button.

    And that's it.

    NotePad++ replace window screenshot

    0 讨论(0)
  • 2020-12-12 13:52

    The easiest method to solve your problem (without going to a different editor or learning regex) is to record a macro.

    • Place your cursor at the start of your text, click the 'record' button in the ribbon, and then edit just that one row of text. You may only use arrow keys or ctrl+arrow keys to move around characters/words rather than clicking with your mouse. The 'home' and 'end' keys are also useful.
    • When you're finished with that one line, move your cursor (again without using the mouse) to the start of the next line.
    • Click the 'stop recording' button.
    • Click the 'play macro' button to check that it works on the next line as expected.
    • Click the 'run macro multiple times' to do it again, and again, and again... :P
    One advantage of this over 'multi-editing' cursors is you don't have to manually click and place cursors on every single row. The second advantage is that you can work with tab-delimited data that doesn't have consistent size/length - just use ctrl+left/right to skip words.

    Honestly, macros in N++ have saved about a year of my life.

    0 讨论(0)
提交回复
热议问题