Home > OS >  How to change some characters at the same time in Vscode?
How to change some characters at the same time in Vscode?

Time:09-04

i have Vscode and Anaconda.

There are 50 ipynb tutorial files that i studied. I work with cells. These files have some Turkih characters that i want to change. These characters are both in uppercase and lowercase.

Ç --> C
Ğ --> G
Ö --> O
Ş --> S
Ü --> U
İ --> I

ç --> c
ğ --> g
ö --> o
ş --> s
ü --> u    
ı --> i

In Vscode there are replace function. How can i change all these characters at the same time for a ipynb file or for all ipynb files

Thanks very much.

CodePudding user response:

use the extension Replace Rules

Add the following to your settings:

  "replacerules.rules": {
    "Replace Turkih": {
      "find": ["Ç", "Ğ", "Ö", "Ş", "Ü", "İ", "ç", "ğ", "ö", "ş", "ü", "ı"],
      "replace": ["C", "G", "O", "S", "U", "I", "c", "g", "o", "s", "u", "i"]
    }
  }
  1. Open the file
  2. Execute the command: Replace Rule: Run Rule...
  3. Select the Replace Turkih rule.

With extension Command on All Files you can apply a command on a selection of files in the workspace.

We need the extension multi-command because the have to add arguments to the command.

Add the following to your settings:

  "multiCommand.commands": [
    {
      "command": "multiCommand.replaceTurkih",
      "sequence": [
        { "command": "replacerules.runRule",
          "args": { "ruleName": "Replace Turkih" }
        }
      ]
    }
  ],
  "commandOnAllFiles.commands": {
    "Add Hello to the End": {
      "command": "multiCommand.replaceTurkih",
      "includeFileExtensions": [".ipynb"]
    }
  }
  • Related