Comment changer le terminal intégré dans visual studio code ou VSCode

je veux changer de terminal intégré CMDER j'utilise Vscode sur windows 8.1 j'ai vérifié le doc et aussi le fichier de préférences, mais j'ai eu confondre ainsi, à partir des lignes suivantes, quelle ligne va le changer

// Terminal Externe

// Customizes which terminal to run on Windows.
"terminal.external.windowsExec": "%COMSPEC%",

// Customizes which terminal application to run on OS X.
"terminal.external.osxExec": "Terminal.app",

// Customizes which terminal to run on Linux.
"terminal.external.linuxExec": "xterm",

// Terminal Intégré

// The path of the shell that the terminal uses on Linux.
"terminal.integrated.shell.linux": "sh",

// The command line arguments to use when on the Linux terminal.
"terminal.integrated.shellArgs.linux": [],

// The path of the shell that the terminal uses on OS X.
"terminal.integrated.shell.osx": "sh",

// The command line arguments to use when on the OS X terminal.
"terminal.integrated.shellArgs.osx": [],

// The path of the shell that the terminal uses on Windows. When using shells shipped with Windows (cmd, PowerShell or Bash on Ubuntu), prefer C:Windowssysnative over C:WindowsSystem32 to use the 64-bit versions.
"terminal.integrated.shell.windows": "C:Windowssystem32cmd.exe",

// The command line arguments to use when on the Windows terminal.
"terminal.integrated.shellArgs.windows": [],

// Controls the font family of the terminal, this defaults to editor.fontFamily's value.
"terminal.integrated.fontFamily": "",

// Controls whether font ligatures are enabled in the terminal.
"terminal.integrated.fontLigatures": false,

// Controls the font size in pixels of the terminal, this defaults to editor.fontSize's value.
"terminal.integrated.fontSize": 0,

// Controls the line height of the terminal, this number is multipled by the terminal font size to get the actual line-height in pixels.
"terminal.integrated.lineHeight": 1.2,

// Controls whether the terminal cursor blinks.
"terminal.integrated.cursorBlinking": false,

// Controls whether locale variables are set at startup of the terminal, this defaults to true on OS X, false on other platforms.
"terminal.integrated.setLocaleVariables": false,

// A set of command IDs whose keybindings will not be sent to the shell and instead always be handled by Code. This allows the use of keybindings that would normally be consumed by the shell to act the same as when the terminal is not focused, for example ctrl+p to launch Quick Open.
"terminal.integrated.commandsToSkipShell": [
    "editor.action.toggleTabFocusMode",
    "workbench.action.debug.continue",
    "workbench.action.debug.restart",
    "workbench.action.debug.run",
    "workbench.action.debug.start",
    "workbench.action.debug.stop",
    "workbench.action.quickOpen",
    "workbench.action.showCommands",
    "workbench.action.terminal.clear",
    "workbench.action.terminal.copySelection",
    "workbench.action.terminal.focus",
    "workbench.action.terminal.focusNext",
    "workbench.action.terminal.focusPrevious",
    "workbench.action.terminal.kill",
    "workbench.action.terminal.new",
    "workbench.action.terminal.paste",
    "workbench.action.terminal.runSelectedText",
    "workbench.action.terminal.scrollDown",
    "workbench.action.terminal.scrollDownPage",
    "workbench.action.terminal.scrollToBottom",
    "workbench.action.terminal.scrollToTop",
    "workbench.action.terminal.scrollUp",
    "workbench.action.terminal.scrollUpPage",
    "workbench.action.terminal.toggleTerminal"
],
32
demandé sur Gama11 2016-11-08 15:51:42

5 réponses

pour changer le terminal intégré sur Windows, vous avez juste besoin de changer le terminal.integrated.shell.windows ligne:

  1. ouvrir VS Paramètres utilisateur (Préférences > Paramètres utilisateur). Cela ouvrira deux documents côte à côte.
  2. Ajouter un nouveau "terminal.integrated.shell.windows": "C:\Bin\Cmder\Cmder.exe" paramétrage du document User Settings sur la droite s'il n'est pas déjà là. C'est pourquoi vous ne modifiez pas le paramètre par défaut directement, mais plutôt en y ajoutant.
  3. Enregistrer le fichier des paramètres de L'utilisateur.

Vous pouvez accéder ensuite avec les touches Ctrl+backtick par défaut.

31
répondu mbernardeau 2016-11-08 14:46:17

il est possible d'obtenir ce fonctionnement dans le code VS et avoir le terminal Cmder intégré (Pas pop up).

Pour le faire:

  1. créer une variable d'environnement "CMDER_ROOT" pointant vers votre Cmder répertoire.
  2. Dans (Préférences > Paramètres de l'Utilisateur) VS Code ajouter les paramètres suivants:

"terminal.integrated.shell.windows": "cmd.exe"

"terminal.integrated.shellArgs.windows": ["/k", "%CMDER_ROOT%\vendor\init.bat"]

30
répondu khernand 2017-10-13 18:49:24

je sais, c'est tard, mais vous pouvez rapidement effectuer que par, juste en tapant Ctrl + Maj + p, puis le type par défaut, il affiche une option qui dit

Terminal: Sélectionnez Le Shell Par Défaut

, il affichera alors tous les terminaux à votre disposition.

9
répondu etp23 2018-05-15 20:47:14

Documents Officiels

configurer correctement votre shell sur Windows est une question de localisation le bon exécutable et la mise à jour du paramètre. Ci-dessous est une liste de les exécutables communs shell et leurs emplacements par défaut.

il y a aussi la commande convenience Sélectionner Le Shell Par Défaut qui peut être accessible via la palette de commandes qui permet de détecter et de configurer ceci pour vous.

vous pouvez Donc ouvrir un commande de la palette en utilisant ctrl+shift+p, utilisez la commande Sélectionner Le Shell Par Défaut, puis il affiche toutes les interfaces de ligne de commande disponibles, sélectionnez ce que vous voulez, VS Code définit que par défaut terminal intégré pour vous automatiquement.

Si vous souhaitez définir manuellement trouver l'emplacement de l'exécutable de votre cli et ouvrez les paramètres de l'utilisateur de vscode(ctrl+,),

"terminal.integrated.shell.windows":"path/to/executable.exe"

exemple de gitbash sur windows7:

"terminal.integrated.shell.windows":"C:\Users\stldev03\AppData\Local\Programs\Git\bin\bash.exe",
2
répondu Mohana Naga Venkat Sayempu 2018-08-24 07:15:45

La voie officielle est décrit dans le code VS docs , qui est similaire à khernands réponse.

Si vous ne souhaitez pas définir CMDER_ROOT en tant que variable d'environnement globale, vous pouvez le faire dans ce fichier batch. En outre, le cd dans le dir de travail en cours à la fin résolu un problème de chemin pour moi.

Cependant, j'ai rencontré une limitation CMDER comme terminal intégré par défaut: Il ne fonctionne pas si vous voulez exécuter des tâches via la Commande Palette -> Commande" Run task " de VS Code UI (comme "Run Build Task"). En savoir plus sur ce ici et ici.

dans ce cas, mettez juste le shell pour la tâche spécifique:

"tasks": [
    {
        "type": "typescript",
        "tsconfig": "tsconfig.json",
        "problemMatcher": [
            "$tsc"
        ],
        "options": {
            "shell": {
                "executable": "cmd.exe",
                "args": [
                    "/d", "/c"
                ]
            }
        }
    }
]
-1
répondu ford04 2018-08-03 18:19:15