Search code examples
visual-studio-codesublimetext3

how to replace more than one word in visual studio code


how can i replace more than one word in visual studio code

to replace a word inside a folder contains files i use

ctrl shift H

to replace a word inside a same file i use

ctrl H

the issue is i can only replace one word at a time is it possible to replace more than one word at the same time

like ::

search  [     numper1 , numper2       ]

replace [     numper0 , numper1       ]
files to include [   F:/*** FILE LOCATION   ]

if it possible please let me know - or if you have a plugin i can donwload please link it to me , i'd appreciate that

and if it possible in sublime to let me know


Solution

  • With Replace Rules you can replace more than one item

    "replacerules.rules": {
        "Replace Multi": {
          "find": ["numper1","numper2"],
          "replace": ["numper0","numper1"]
        }
    }  
    

    With multi-command you can create a custom command with arguments

    With Command on All Files you can apply the command on all files in the workspace.

    "multiCommand.commands": [
        {
          "command": "multiCommand.multiSearchReplace",
          "sequence": [
            { "command": "replacerules.runRule",
              "args": { "ruleName": "Replace Multi" }
            }
          ]
        }
      ],
      "commandOnAllFiles.commands": {
        "Replace Multi": {
          "command": "multiCommand.multiSearchReplace",
          "includeFileExtensions": [".py"]
        }
      }
    

    I will modify Command on All Files so you can select the command from a list.