How do I duplicate a line or selection within Visual Studio Code?

前端 未结 17 2385
青春惊慌失措
青春惊慌失措 2020-12-04 04:38

Using Microsoft\'s Visual Studio Code, how do I duplicate a line of code and then move it up and down? (Similar to Sublime\'s cmd+shift+d be

17条回答
  •  盖世英雄少女心
    2020-12-04 05:06

    In VSCode Ctrl+CCtrl+V duplicates the whole line below.

    I prefer this to the accepted answer, because it only requires one hand to do this and feels way more natural.

    The accepted answer will probably do it for most people, however Down sits the other side of the keyboard. So you have two options, use both hands on (Left Hand:L Shift+L Alt+ Right Hand:Up/Down), or with a single hand use the right R Shift+R Alt+Up/Down. The second option feels weird in my opinion. I'd rather use the option where my hand naturally sits on the keyboard, and if its one hand, even better.

提交回复
热议问题