我在 Sublime Text 中看到了一篇关于如何设置 Cygwin 的帖子此链接,但就我而言它仍然不起作用。
[
{
"keys": ["alt+o"], "command": "toggle_terminus_panel", "args": {
"cwd": "${file_path:${folder}}"
}
},
{
"keys": ["alt+w"], "command": "terminus_close_all", "context": [{ "key": "terminus_view"}]
},
]
此键alt+o
与此参数的绑定将打开我所在文件夹的终端。它与 Cmder、Bash(我从 Git 获得的 bash)、cmd 和 Powershell 配合得很好。但当我将默认终端切换到 Cygwin 时,问题就出现了。这是我的终端设置:-
// the default config, either a single config name or a platform
// specific dict
"default_config": {
"linux": null, // login shell
"osx": null, // login shell
"windows": "Cygwin Terminal",
},
// a list of available shells to execute
"shell_configs": [
{
"name": "Bash",
"cmd": ["bash", "-i", "-l"],
"env": {},
"enable": true,
"platforms": ["linux", "osx"],
},
{
"name": "Zsh",
"cmd": ["zsh", "-i", "-l"],
"env": {},
"enable": true,
"platforms": ["linux", "osx"],
},
{
"name": "Command Prompt",
"cmd": "cmd.exe",
"env": {},
"enable": true,
"platforms": ["windows"],
},
{
"name": "PowerShell Core",
"cmd": "pwsh.exe",
"env": {},
"enable": true,
"platforms": ["windows"],
},
{
"name": "PowerShell",
"cmd": "powershell.exe",
"env": {},
"enable": true,
"platforms": ["windows"],
},
{
"name": "Cmder",
"cmd": ["cmd.exe", "/k", "D:\\ConsoleEmulators\\cmder\\vendor\\init.bat"],
"env": {},
"enable": true,
"platforms": ["windows"],
},
{
"name": "Git Bash",
"cmd": ["D:\\ConsoleEmulators\\cmder\\vendor\\git-for-windows\\bin\\bash.exe"],
"env": {},
"enable": true,
"platforms": ["windows"],
},
{
"name": "WSL Login Shell",
"cmd": "wsl.exe",
"env": {},
"enable": true,
"platforms": ["windows"],
},
{
"name": "Cygwin Terminal",
"cmd": ["D:\\ConsoleEmulators\\Cygwin\\Cygwin\\bin\\bash.exe"],
"env": {},
"enable": true,
"platforms": ["windows"]
}
],
// Note: for unix users, you will get better 256 color experience
// if you also set "unix_term" to "xterm-256color"
// 256 color is not working on Windows because of upstream winpty's issue
// https://github.com/rprichard/winpty/issues/108
"256color": false,
// the default TERM variable of unix system. Possible values are
// "linux", "xterm" and "xterm-256color".
// However, please aware that not all xterm features are supported.
"unix_term": "linux",
// the default LANG variable of unix system.
"unix_lang": "en_US.UTF-8",
// number of lines kept in scrollback history
// decreasing this value may improve performance
"scrollback_history_size": 10000,
// set a minimum or maximum terminal width in characters
"min_columns": 20,
"max_columns": 500,
// Windows and Linux only
// use ctrl+c to copy
// use ctrl+v to paste (use ctrl+alt+v to send ctrl+v instead)
// use ctrl+pagedown/pageup to change tabs
"natural_keyboard": true,
// Terminus sends all keybinds of the form `ctrl+[a-z]` to the terminal process
// directly. Windows and Linux users sometimes may want to preserve some of such
// keybinds. (only keybinds listed below are supported, open an issue for a specific
// keybind if it is not in the list)
"preserve_keys" : [
// "ctrl+k" // there are a number of shortcuts with "ctrl+k" prefix.
// "ctrl+p" // to show Go to Anything
],
// the name of the theme
// Terminus comes with a number of themes - select a predefined theme using
// `Terminus Utilities: Select Theme`.
"theme": "one-dark",
// change `theme` to "user" if you want to use customized theme
// see https://www.sublimetext.com/docs/3/color_schemes.html#colors for the
// available colors
"user_theme_colors": {
"background": "#262626",
"foreground": "#ffffff",
"caret": "white",
"block_caret": "white",
"selection": "#444444",
"selection_foreground": "#ffffff",
"00": "#000000", // black
"01": "#cd0000", // red
"02": "#00cd00", // green
"03": "#cdcd00", // brown
"04": "#0000ee", // blue
"05": "#cd00cd", // magenta
"06": "#00cdcd", // cyan
"07": "#e5e5e5", // white
"08": "#7f7f7f", // light_black
"09": "#ff0000", // light_red
"10": "#00ff00", // light_green
"11": "#ffff00", // light_brown
"12": "#5c5cff", // light_blue
"13": "#ff00ff", // light_magenta
"14": "#00ffff", // light_cyan
"15": "#ffffff", // light_white
},
"view_settings": {
// these are extra view settings which are passed to the terminus_view,
// you could change settings like "font_face", "font_size" and paddings.
},
"debug": false,
}
然后我收到错误bash: ls: command not found
,然后我在谷歌中搜索并在超级用户中找到了答案,此链接:-Sublime text 3 Terminus 使用 Cygwin 终端不会接受命令(例如 ls 或 gcc)(Windows)
但是它没有打开我所在的文件夹。它打开了 Cygwin 终端和目录/home/user
,而我实际上并不需要这个目录。那么,如何在 Sublime Text 中的当前文件目录中打开 Cygwin 终端?
顺便说一句,我使用的是 Windows 7 32 位操作系统和 Sublime text 4(但我不认为我的操作系统和 Sublime text 版本会影响这一点。):p