Hyper: Hyper config to use bash with mingw-w64 instead CMD.

Created on 16 Dec 2016  Â·  30Comments  Â·  Source: vercel/hyper

Question

Most helpful comment

Below works for me:

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    shell: 'C:\\Program Files\\Git\\git-cmd.exe',

    // for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
    // by default ['--login'] will be used
    shellArgs: ['--command=usr/bin/bash.exe', '-l', '-i'],

    // for environment variables
    env: {
        TERM: 'cygwin',
    },

image

All 30 comments

Below works for me:

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    shell: 'C:\\Program Files\\Git\\git-cmd.exe',

    // for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
    // by default ['--login'] will be used
    shellArgs: ['--command=usr/bin/bash.exe', '-l', '-i'],

    // for environment variables
    env: {
        TERM: 'cygwin',
    },

image

I tried with these settings. Both Hyper and MINGW64 console windows open to blank screens, there's a pause of about a minute or so, then the MINGW64 console displays the prompt while the Hyper window remains blank.

It shouldn't launch MINGW64 in a separate window. Have you tried with the latest (2.11.0) git client for windows?
https://git-scm.com/downloads

Note: git-cmd.exe is important, if you use git-bash.exe it will launch in a separate window.

Thanks for mentioning that. I had tried earlier with git-bash.exe and overlooked changing that. After I changed it to git-cmd.exe Hyper displays the bash prompt as expected.

Yea this works great. But any idea how to to supply a default startup directory for the same?

Ok just answering my own question here. You'll find a .bashrc file in your home folder, you can just add a cd command there.

Still doesn't works with .../git/git-bash.exe shell

@Faleij It works but I have some issue with the git terminal, like the command clear doesn't clear anything. Any idea ?

@fknop clear neither works properly for me, I think it's a bug with Hyper.

@fknop Setting env TERM to cygwin solves it for me.
e.g. in ~/.bashrc add the following line:
export TERM=cygwin
for reference see #1559

@Faleij shell path and args works for me. But I am unable to use 'clear' command or CTRL+L, it moves the cursor to the top of the tab but didnt clear the text. CTRL+C/CTRL+X not working too.

@t-khan-k Have you added`the environment variable TERM with the value cygwin?
I have updated my first post on how to do this in the .hyper.js config.

This may be tangentially related, but I'm running into this as well. I am trying to set Hyper to use Docker Quick Start. I'm having a hard time reasoning about the shellArgs with this. How do I do it?

I came up with shellArgs: ['--login', '-i', '--command=usr/bin/bash.exe', "C:\Program\ Files\Docker\ Toolbox\\start.sh"],

but I'm nearly sure that my pathing is wrong.

@Faleij I tried putting your new shell and shellArgs into config-default.js file. I rebuilt the application and ran, but it appears to have zero effect, regular old cmd comes up.

I have confirmed that I have a git-cmd.exe at C:\Program Files\Git which does work.

Anyone have any ideas?

@rygo6 not sure what config-default.js is but you should edit the %USERPROFILE%/.hyper.js / ~/.hyper.js config file.

in hyper.js file
put

// for environment variables
env: {
    TERM: "cygwin"
},

Anyone get this working wit Git 2.16.1?
It was working for me with Git 2.14 and I recently updated and hyper stopped working.
Hyper will close immediately and is not usable. I tried several variations above with shell and shellArgs but nothing works anymore 😞

@styfle are you sure you set the env var TERM to 'cygwin' as in the gist?

@Galilyou I must have missed that. It works now, thanks!

I'm not able to get this working with the latest version of Git. I've used this config for over a year now on two computers. Today I was setting up a new computer and downloaded the latest version of Git.

Launching Hyper with the config causes it to instantly close. No related logs in the devtools. Is there a log file I should check somewhere?

Git (doesn't work): 2.16.1.windows.4
Git (does work): 2.14.1.windows.1
Hyper (all computers): 1.4.8

(I don't have time at the moment to test all the versions in between)

Funny enough, I tried manually running the command ('C:\Program Files\Git\git-cmd.exe' --command=usr/bin/bash.exe -l -i) in Powershell, and it works! But for some reason not in Hyper.

I decided to just install the older version of Git for the time being.

I did what @Faleij says! It worked for me!

// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.

module.exports = {
  config: {
    // Choose either "stable" for receiving highly polished,
    // or "canary" for less polished but more frequent updates
    updateChannel: 'stable',

    // default font size in pixels for all tabs
    fontSize: 12,

    // font family with optional fallbacks
    fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',

    // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
    cursorColor: 'rgba(248,28,229,0.8)',

    // `BEAM` for |, `UNDERLINE` for _, `BLOCK` for â–ˆ
    cursorShape: 'BLOCK',

    // set to true for blinking cursor
    cursorBlink: false,

    // color of the text
    foregroundColor: '#fff',

    // terminal background color
    backgroundColor: '#000',

    // border color (window, tabs)
    borderColor: '#333',

    // custom css to embed in the main window
    css: '',

    // custom css to embed in the terminal window
    termCSS: '',

    // set to `true` (without backticks) if you're using a Linux setup that doesn't show native menus
    // default: `false` on Linux, `true` on Windows (ignored on macOS)
    showHamburgerMenu: '',

    // set to `false` if you want to hide the minimize, maximize and close buttons
    // additionally, set to `'left'` if you want them on the left, like in Ubuntu
    // default: `true` on windows and Linux (ignored on macOS)
    showWindowControls: '',

    // custom padding (css format, i.e.: `top right bottom left`)
    padding: '12px 14px',

    // the full list. if you're going to provide the full color palette,
    // including the 6 x 6 color cubes and the grayscale map, just provide
    // an array here instead of a color map object
    colors: {
      black: '#000000',
      red: '#ff0000',
      green: '#33ff00',
      yellow: '#ffff00',
      blue: '#0066ff',
      magenta: '#cc00ff',
      cyan: '#00ffff',
      white: '#d0d0d0',
      lightBlack: '#808080',
      lightRed: '#ff0000',
      lightGreen: '#33ff00',
      lightYellow: '#ffff00',
      lightBlue: '#0066ff',
      lightMagenta: '#cc00ff',
      lightCyan: '#00ffff',
      lightWhite: '#ffffff'
    },

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    //
    // Windows
    // - Make sure to use a full path if the binary name doesn't work
    // - Remove `--login` in shellArgs
    //
    // Bash on Windows
    // - Example: `C:\\Windows\\System32\\bash.exe`
    //
    // Powershell on Windows
    // - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
    shell: 'C:\\Program Files\\Git\\git-cmd.exe',

    // for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
    // by default ['--login'] will be used
    shellArgs: ['--command=usr/bin/bash.exe', '-l', '-i'],

    // for environment variables
    env: {},

    // set to false for no bell
    bell: 'SOUND',

    // if true, selected text will automatically be copied to the clipboard
    copyOnSelect: false

    // if true, on right click selected text will be copied or pasted if no
    // selection is present (true by default on Windows)
    // quickEdit: true

    // URL to custom bell
    // bellSoundURL: 'http://example.com/bell.mp3',

    // for advanced config flags please refer to https://hyper.is/#cfg
  },

  // a list of plugins to fetch and install from npm
  // format: [@org/]project[#version]
  // examples:
  //   `hyperpower`
  //   `@company/project`
  //   `project#1.0.1`
  plugins: [],

  // in development, you can create a directory under
  // `~/.hyper_plugins/local/` and include it here
  // to load it and avoid it being `npm install`ed
  localPlugins: [],

  keymaps: {
    // Example
    // 'window:devtools': 'cmd+alt+o',
  }
};

I wonder if this issue can be closed now. It worked fine with MSYS64 (MSYS2), albeit quite slow performance compared to mintty

    shell: 'C:\\msys64\\usr\\bin\\bash.exe', 

Note however there is other weird behaviour, e.g. when resizing the window (text reflows) and using vim (doesn't redraw the screen properly)

I have git installed on my machine which works fine with VS Code's integrated terminal.
In the hyper.js configuration file I updated the below line

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    //
    // Windows
    // - Make sure to use a full path if the binary name doesn't work
    // - Remove `--login` in shellArgs
    //
    // Bash on Windows
    // - Example: `C:\\Windows\\System32\\bash.exe`
    //
    // PowerShell on Windows
    // - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
    shell: 'C:\\Program Files\\Git\\bin\\bash.exe',

As you can see the comments provided are pretty helpful. In my case I just provided the path for Git's terminal i.e C:\\Program Files\\Git\\bin\\bash.exe

Only issue I'm seeing right now is that the _clear_ command does not play well with this.

I'm using:

shell: 'C:\\Program Files\\Git\\git-cmd.exe',
shellArgs: ['--command=usr/bin/bash.exe', '-l', '-i'],

and everything is fine, but there are some problems showing colors.

capture

As you can see in the image above, there are some ?[32m in the beginning of every line. how can this be fixed?

@behzadev What version of git are you running? Try updating.
For reference, I am on 2.19.0 and colors work.

image

@Faleij latest (v2.19.1)
So what is wrong with my config?

.hyper.js.txt

@behzadev I tried your config with all plugins and it works for me, I am not sure what is causing the color issues for you. Try forcing TERM env in hyper.js config:

    // for environment variables
    env: {
        TERM: 'cygwin',
    },

image

@Faleij When I comment this line, everything works out:

shell: 'C:\\Program Files\\Git\\git-cmd.exe',

capture

But then this is not using git shell anymore.

I have also tried changing color for terminal in git to xterm256

Issue-Hyper

I got same error... Composer and Php artisan goes ansi escape error

Found a little issue. Hyper now stores it in Roaming App Data C:\Users\user\AppData\Roaming\Hyper.hyper.js

Was this page helpful?
0 / 5 - 0 ratings

Related issues

legomushroom picture legomushroom  Â·  3Comments

yvan-sraka picture yvan-sraka  Â·  3Comments

sarneeh picture sarneeh  Â·  3Comments

anthonyettinger picture anthonyettinger  Â·  3Comments

aem picture aem  Â·  3Comments