Visual Studio : short cut Key : Duplicate Line

后端 未结 30 1308
[愿得一人]
[愿得一人] 2020-12-12 10:01

Is there a shortcut for Duplicate Line command in Visual Studio 2008?

Some similar examples:

  • in
相关标签:
30条回答
  • 2020-12-12 10:19

    While I realize this is not a keyboard shortcut, I figured I would add this, as it does not require the usage of the clipboard and might help some people.

    Highlight the row you want to duplicate. Press control, mouse click the highlighted text, and drag to where you want to go to. It will duplicate the highlighted text.

    0 讨论(0)
  • 2020-12-12 10:19

    in VS2019 and also in VS2017 you can select Tools->Options->Keyboard and you can choose in the scheme drop-down Resharper (Visual Studio) option, and you will get a mapping like if you were using Resharper, in this case Ctrl + D will do the trick for duplicating the line. Anyways, based on the documentation this should be out of the gate in Visual Studio 2017 Version 15.8 or greater

    0 讨论(0)
  • 2020-12-12 10:21

    Ctrl + D works for me in VS2012 with Resharper. It's Resharper's hot key.

    0 讨论(0)
  • 2020-12-12 10:21

    For Visual Studio Code 2019:

    Edit menu keyboard shortcuts with: ctrl+k and ctrl+s

    Edit "Copy Line Down" (Shift + Alt + DownArrow) to your your own shortcut.

    You can find it, with the command ID: editor.action.copyLinesDownAction

    For me, It's ctrl+d

    0 讨论(0)
  • 2020-12-12 10:21

    Visual Studio Code : May 2020 (version 1.46) Shift + UpArrow/DownArrow : To Duplicate the line of code

    0 讨论(0)
  • 2020-12-12 10:22

    I use application link:AutoHotkey with below code saved in CommentDuplikateSaveClipboard.ahk file. You can edit/remove shortcuts it is easy.
    I have link to this file "Shortcut to CommentDuplikateSaveClipboard.ahk" in Autostart in windows.
    This script protect your clipboard.
    If you are more curious you would add shortcuts to thisable/enable script.
    I sometimes use very impressive Multi Clipboard script to easy handle with many clips saved on disk and use with CTRL+C,X,V to copy,paste,cut,next,previous,delete this,delete all.

    ;CommentDuplikateSaveClipboard.ahk
    
    !c:: ; Alt+C === Duplicate Line
    ^d:: ; Ctrl+D
    ClipSaved := ClipboardAll
    Send, {END}{SHIFTDOWN}{HOME}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{END}{ENTER}{CTRLDOWN}v{CTRLUP}{HOME}
    Clipboard := ClipSaved
    ClipSaved =
    return
    
    !x:: ; Alt+X === Comment Duplicate Line
    ClipSaved := ClipboardAll
    Send, {END}{SHIFTDOWN}{HOME}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{LEFT}//{END}{ENTER}{CTRLDOWN}v{CTRLUP}{HOME}
    Clipboard := ClipSaved
    ClipSaved =
    return
    
    !z:: ; Alt+Z === Del uncomment  Line
    ClipSaved := ClipboardAll
    Send, {END}{SHIFTDOWN}{UP}{END}{SHIFTUP}{DEL}{HOME}{DEL}{DEL}
    Clipboard := ClipSaved
    ClipSaved =
    return
    
    !d:: ; Alt+D === Delete line
    Send, {END}{SHIFTDOWN}{UP}{END}{SHIFTUP}{DEL}
    return
    
    !s:: ; Alt+S === Swap lines
    ClipSaved := ClipboardAll
    Send, {END}{SHIFTDOWN}{UP}{END}{SHIFTUP}{CTRLDOWN}x{CTRLUP}{UP}{END}{CTRLDOWN}v{CTRLUP}{HOME}
    Clipboard := ClipSaved
    ClipSaved =
    return
    
    !a:: ; Alt+A === Comment this line, uncomment above
    Send, {END}{HOME}//{UP}{HOME}{DEL}{DEL}
    return
    
    0 讨论(0)
提交回复
热议问题