Skip to content

Swap the Clipboard string(previously copied string) with a Selected string/a Pointed word in code or Swap two selected string/poited word, with multiselection in code.

Notifications You must be signed in to change notification settings

lukaszpolowczyk/swap-selection-with-clipboard

Repository files navigation

Swap Selection with Clipboard

Swap the Clipboard string(previously copied string) with a Selected strings/a Pointed words in code or Swap two selected strings/poited words, with multiselection in code.

Features

How it work descriptions (text):

With One Selection in code and Clipboard:

  • In the code, Select a string/Point a word - in one place, without multiselection.
  • Use Alt+S to swap this string with the string from the clipboard(previously copied string).

With Double Multiselection in code:

  • In the code, Select a string/Point a word - in two places with multiselection (Alt+Select/Click).
  • Use Alt+S to swap these strings.

Point a word means clicking word without selecting it.
Then, the extension will automatically select pointed word when you press Alt+S to swap.

How it work examples (on GIF-s):

Swap pointed word with clipboard string - Click on one word and Alt+S to swap:

swap-pointed-word-with-clipboard-string

Swap selected string with pointed word - Select string, Alt+Click on some word and Alt+S to swap:

swap-selected-string-with-pointed-word

Swap pointed words - Click on first word, Alt+Click on second word and Alt+S to swap:

swap-pointed-words

Reason for creation. In what helps

I wanted to read the VS Code extension API when creating a simple extension.

When I want to swap two strings in one file - Swap Selected strings/Pointed words is helpful. (Why not other ready extensions?)

Without this extension:

  1. select first string
  2. cut string
  3. point place to paste
  4. paste
  5. select second string
  6. cut string
  7. point place to paste
  8. paste

With this extension:

  1. select first string/point word
  2. select second string/point word
  3. use Ctrl+S

When I want to swap thongs in two different files - Swap Clipboard string with Selected string/Pointed word is helpful.

Without this extension:

  1. select string
  2. cut string
  3. switch tab
  4. point place to paste
  5. paste
  6. select string
  7. cut string
  8. switch tab
  9. paste

With this extension (less spectacular difference):

  1. select string/point word
  2. cut string
  3. switch tab
  4. select string/point word
  5. use Ctrl+S
  6. switch tab
  7. paste

Known Issues

Insignificant Bug:

  • A longer string is incorrectly marked when you quickly press Alt+S 3 times, while the strings are of different length.

Release Notes

1.2.6

Update dependencies.

1.2.3

Activate an extension at the startup.

1.1.0

Create extension.

Similar extensions

I will list similar extensions here, and why they are not enough for me.

  • transpose by Varun Vasan V

    • In this extension, is possible to swap selected strings.
    • In this extension, is not possible to swap a word with a clipboard string.
    • In this extension, is not possible to swap pointed word: swaps the two letters between which the cursor, instead of the pointed words.
    • In this extension, you have the ability to swap more than two selected strings, but I do not know what it can be useful for.
  • Copy Swapper by berickson324

    • In this extension, is possible to swap clipboard string with selected string.
    • In this extension, is not possible to swap clipboard string with pointed word.
    • In this extension, is not possible to swap two selected strings/pointed words.
  • swap-word by davidmart

    • In this extension, is possible to swap two selected strings/pointed words.
    • In this extension, is not possible to swap clipboard string with selected string.

In addition, I wanted to use one keyboard shortcut for all these operations Alt+S.
If you used several complementary extensions (E.g. Copy Swapper and swap-word), the shortcuts would conflict with each other.

About

Swap the Clipboard string(previously copied string) with a Selected string/a Pointed word in code or Swap two selected string/poited word, with multiselection in code.

Topics

Resources

Stars

Watchers

Forks