Skip to content

A vscode extension to copy the selected text before pasting

License

Notifications You must be signed in to change notification settings

Gruntfuggly/swap-and-paste

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swap and Paste

Sometimes it's useful to be able to swap two pieces of code. This extension simply copies anything selected when pasting and inserts it in the paste buffer. Note: Only works with single selections - multiple selections would get too complicated!

Overrides the default cut, copy, paste and undo key bindings. If you want to use in conjunction with another clipboard extension, set the appropriate commands as per the configuration below.

Installing

You can install the latest version of the extension via the Visual Studio Marketplace here.

Alternatively, open Visual Studio code, press Ctrl+P or Cmd+P and type:

> ext install swap-and-paste

Source Code

The source code is available on GitHub here.

Configuration

swap-and-paste.pasteCommand

If there is no selection when pasting, this command is executed instead. This allows you to use an alternative clipboard extension if required. Defaults to the standard editor.action.clipboardPasteAction.

swap-and-paste.copyCommand

When copying the selected text, the extension will call this command after copying the selection to it's own clipboard. Defaults to the standard editor.action.clipboardCopyAction.

swap-and-paste.cutCommand

When cutting the selected text, the extension will call this command after copying the selection to it's own clipboard. Defaults to the standard editor.action.clipboardCutAction.

swap-and-paste.undoCommand

If you paste accidentally, undo will swap the selections back. The default is to call the standard undo command afterwards, but this can be overridden using this setting if required.

swap-and-paste.retainThroughDuplicateSelections

Normally, if xxx is copied and then pasted when yyy is selected, yyy is copied into the clipboard for the next paste. This is problematic if you want to do multiple replacements, so if yyy is selected subsequently again, xxx will be repasted. If you want to always swap yyy for xxx regardless of the previous paste contents, then set this false.

swap-and-paste.debug

Set to true to create a debug log in the Output panel.

Credits

Icon made by Freepik from www.flaticon.com

About

A vscode extension to copy the selected text before pasting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published