Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Copy Current Line?

justavian
2013-01-07
2013-01-08
  • justavian
    justavian
    2013-01-07

    If there's one single feature that would simplify my life when using Notepad++, it's the copy and paste full line feature you find in Visual Studio.

    In Visual Studio, if you put the cursor on a line (without selecting any text) and press Ctrl+C, it copies the entire line. If you then put the cursor on a different line, Ctrl+V will paste the entire line above the current one. I'm so used to using that feature that i'm constantly trying to do it in Notepad++.

    EDIT: Also very nice is the ability to use a CUT command to clear the current line in Visual Studio. Thus, any copy, cut, or paste operation is automatically performed on the full line if nothing is selected.

    Is there any way to accomplish this goal? I love everything about Notepad++, minus this one seemingly little thing.

    Thanks!

    -RP

     
    Last edit: justavian 2013-01-07
  • John Bowman
    John Bowman
    2013-01-07

    Try this:
    Ctrl+D to duplicate the current line
    Ctrl+Shift+(up or down arrow) to move the current line up or down.

     
    • justavian
      justavian
      2013-01-07

      I appreciate the response. I'm familiar with that ability, but the moving it up and down isn't quite what i'm looking for. While that works fine if you intend to drop the line nearby, it's not quite as helpful if you need to copy and paste between documents, or if you need to copy a line and move it several pages up.

      I know it seems nitpicky, but just the fact that it's a different set of keystrokes is also problematic for me. My mouse has copy, cut, and paste mapped to buttons on the sides - i'd like to be able to use those buttons for this activity.

       
  • Loreia2
    Loreia2
    2013-01-08

    See this stackoverflow question:
    http://stackoverflow.com/questions/619754/how-to-mimic-visual-studios-ctrl-x-ctrl-v-
    functionality-in-notepad
    

    This is so simple it should be integrated into main branch, biggest part would be adding a tick box in Preferences dialog. I really wish I had few hours of free time these days....

    BR,
    Loreia

     
  • Byzod
    Byzod
    2013-01-08

    BTW, is there any way to delete current line? Like what dd does in VIM

     
  • Loreia2
    Loreia2
    2013-01-08

    Hi Byzod,

    I do it by using Ctrl+l to cut the line.
    That's good enough for me.

    BR,
    Loreia

     
  • Frank Fesevur
    Frank Fesevur
    2013-01-08

    Two things should be done. The SCI_CUTALLOWLINE command should be added to Scintilla and N++ should allow these two commands to have their shortcut key assigned to them.

    The former seems not too difficult, after a quick look at the code. There is a feature request https://sourceforge.net/p/scintilla/feature-requests/957/ that states that a proper SCI_CUTALLOWLINE patch is likely to be accepted.

    Adding those two command to the list of possible shortcuts seems easy. Adding two lines to Parameters.cpp around line 300 is probably all it takes.

    Maybe I make some time soon, to try and create the scintilla patch. That is the most work. After that, the N++ part can done.

     
  • Loreia2
    Loreia2
    2013-01-08

    Sounds great !!

    BR,
    Loreia