0

I saw a post about how to set up Cygwin in Sublime Text in this link, but it's still not working in my case.

[
    { 
        "keys": ["alt+o"], "command": "toggle_terminus_panel", "args": {
            "cwd": "${file_path:${folder}}"
        }
    },
    { 
       "keys": ["alt+w"], "command": "terminus_close_all", "context": [{ "key": "terminus_view"}]

    },
]

This key binding alt+o with this args would open terminus with the folder I am in. And it worked fine with Cmder, Bash (the bash that I got from Git), cmd, and Powershell. But the problem occurred when I switched the default terminal to Cygwin. Here is my terminus settings:-


    // 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,
}

And then I got the error bash: ls: command not found and then I searched in google and I found the answer in superuser, this link:- Sublime text 3 Terminus using Cygwin terminal wont accept commands (e.g ls or gcc) (Windows) But it doesn't open the folder where I'm in. It opens the Cygwin terminal with the /home/user directory, which I literally don't want. So, how to open the Cygwin terminal at the current file directory in Sublime Text?

Btw I'm using Windows 7 32 bit operating system and Sublime text 4 (but I don't think that my operating system and sublime text version effect this.) :p

5
  • run bash as login shell
    – matzeri
    Commented Jun 13, 2021 at 15:50
  • How to do so? I'm new to cygwin. So, I don't know how to do so. So, can you tell me? Commented Jun 13, 2021 at 16:12
  • see example for bash on first example. add ,"-i", "-l" to cmd
    – matzeri
    Commented Jun 13, 2021 at 16:38
  • As I said, it always opens the /home/user directory. But, in sublime text, the arguments I used in key bindings say, "open terminus at current directory". But for some reason, it can't open the Cygwin terminal in the current directory. And if I omit the "-i" and "-l", it says ls is not a command. Commented Jun 13, 2021 at 16:58
  • 1
    @rajin100000 : The error obviously comes from an ill-defined PATH. I would (1) first make up your mind, whether or not want a login shell, configure this appropriately, and then (2) fiddle with the startup files of bash, to get PATH right and (3) take care that bash initially does a cd to whatever directory you want. Commented Jul 7, 2021 at 11:41

0

You must log in to answer this question.

Browse other questions tagged .