{"id":13898420,"url":"https://github.com/kurkale6ka/vim-swap","last_synced_at":"2026-01-23T22:26:46.003Z","repository":{"id":1425644,"uuid":"1567246","full_name":"kurkale6ka/vim-swap","owner":"kurkale6ka","description":"Easy swapping of text in Vim","archived":false,"fork":false,"pushed_at":"2020-04-06T09:40:53.000Z","size":28,"stargazers_count":18,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-07T18:46:13.007Z","etag":null,"topics":["vim","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kurkale6ka.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-04-04T14:16:42.000Z","updated_at":"2022-06-07T13:29:55.000Z","dependencies_parsed_at":"2022-07-29T13:18:59.645Z","dependency_job_id":null,"html_url":"https://github.com/kurkale6ka/vim-swap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurkale6ka%2Fvim-swap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurkale6ka%2Fvim-swap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurkale6ka%2Fvim-swap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurkale6ka%2Fvim-swap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kurkale6ka","download_url":"https://codeload.github.com/kurkale6ka/vim-swap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226274890,"owners_count":17598861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["vim","vim-plugin"],"created_at":"2024-08-06T18:04:17.133Z","updated_at":"2026-01-23T22:26:45.963Z","avatar_url":"https://github.com/kurkale6ka.png","language":"Vim script","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"Swapping of text in Vim\n=======================\n\nA plugin which makes swapping of text in Vim easier\n\n\u003ch2\u003e1. Visual mode\u003c/h2\u003e\n\n**1.1 `\\x`**\n\nFirst select some text (`[]` represents the highlighted area). Then press `\\x`\n\n    [a ==   123] [  a == 123 ] [a==123]\n          |            |           |\n          V            V           V\n    123 ==   a     123 == a    123==a\n\n_Note:_ Your selection can be loose and include white spaces at both ends.\n\n**1.2 `\\cx`**\n\nBy default the plugin acts on comparison operators  \nYou are however allowed to specify any pivot for the swapping.\n\nFirst select some text. Then press `\\cx`  \nYou will be asked to give a pattern (`%` used here)\n\n    Just testing  %  a percentage as a pivot\n                      |\n                      V\n    a percentage as a pivot  %  Just testing\n\n**1.3 Multiple lines**\n\nYou can also use `V`, `v` or `^v` to select several lines (`v` used), then press `\\x`\n\n    a == [123\n    user !~ unknown\n    0]!=#1\n       |\n       V\n    123 == a\n    unknown !~ user\n    1!=#0\n\n\u003ch2\u003e2. Normal mode\u003c/h2\u003e\n\nSwap with WORD on the right `\\x`\n\n`#` indicates the cursor position in the examples below.\n\n          #\n    zero one      a_longer_word three\n             |\n             V\n    zero a_longer_word      one three\n\nSwap with WORD on the left  `\\X`\n\n    zero one two     three\n    let's have some more fun\n      #      |\n             V\n    zero one two     let's\n    three have some more fun\n\n**2.1 Repeat**\n\nThis plugin integrates with Tim Pope's repeat plugin. It means that you can  \nuse **. (dot)** to repeat any normal mode (for now) swap mapping you just used!\n\nFor more information see: http://github.com/tpope/vim-repeat\n\n\u003ch2\u003e3. Supported operators\u003c/h2\u003e\n\n_Comparison operators_  \n```\n===    !==     \u003c\u003e    ==#    !=#     \u003e#\n\u003e=#     \u003c#    \u003c=#    =~#    !~#    ==?\n!=?     \u003e?    \u003e=?     \u003c?    \u003c=?    =~?\n!~?     ==     !=     \u003e=     =~     \u003c=\n!~      ~=\n```\n\n_Logical operators_  \n`\u0026\u0026     ||`\n\n_Assignment operators_  \n```\n+=     -=     *=     /=     %=     \u0026=\n|=     ^=    \u003c\u003c=    \u003e\u003e=\n```\n\n_Scope operators_  \n`::`\n\n_Pointer operators_  \n`-\u003e*     -\u003e     .*`\n\n_Bitwise operators_  \n`\u003c\u003c     \u003e\u003e`\n\n_Misc operators_  \n```\n\u003e      \u003c       =      +      -      *\n/      %       \u0026      |      ^      .\n?      :       ,     '=     '\u003c     '\u003e\n!\u003c     !\u003e\n```\n\n**3.1 Custom operators**\n\nYou can define your own operators by putting a similar line in your _vimrc_:\n\n    let g:swap_custom_ops = ['first_operator', 'second_operator', ...]\n\n\u003ch2\u003e4. Custom mappings\u003c/h2\u003e\n\nYou have the possibility to define your own custom mappings in your _vimrc_:\n\n    vmap \u003cleader\u003ex         \u003cplug\u003eSwapSwapOperands\n    vmap \u003cleader\u003e\u003cleader\u003ex \u003cplug\u003eSwapSwapPivotOperands\n    nmap \u003cleader\u003ex         \u003cplug\u003eSwapSwapWithR_WORD\n    nmap \u003cleader\u003eX         \u003cplug\u003eSwapSwapWithL_WORD\n\n_Note:_ You can replace `\\x`, `\\cx`, `\\X` with whatever you like.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurkale6ka%2Fvim-swap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkurkale6ka%2Fvim-swap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurkale6ka%2Fvim-swap/lists"}