How to swap clipboard contents for current selection in Visual Studio

醉酒当歌 提交于 2019-12-01 23:46:11

问题


Does anyone know of a simple way to swap whatever is currently in my clipboard with the current mouse selection?

So lets say my clipboard has the text Foo in it.

On a line of code public void DoBar() { ... I have Bar selected

I'd like a simple key combination that changes DoBar() to DoFoo() and leaves me with the text Bar"in the clipboard (so that if I was to press CTRL-V it would paste Bar).

Note: I don't want to have to fiddle with anything graphical (i.e. clipboard switcher, paste ring). I'm just after a simple key-combination (so CTRL-X: Cut, CTRL-C: Copy, CTRL-V: Paste, CTRL-B?: Swap)

Bonus points for a general solution that works throughout Windows.


回答1:


I know you didn't want a solution that involved installing anything, but I landed on this page with the same question, so I decided to post an answer ( that does include a gui )

install AutoHotKey!

see http://www.autohotkey.com/board/topic/15-clipboard-hotkey-functions/

Kind regards

Ward




回答2:


No generic solution for this exists, so sorry: I anticipate disappointment.

You might be able to build a Visual Studio plugin with an implementation of this, but it isn't a standard solution on any platform besides maybe Vi/Vim or Emacs (and even then I'm not sure).



来源:https://stackoverflow.com/questions/8250513/how-to-swap-clipboard-contents-for-current-selection-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!