Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ajsb85 opened this issue Dec 16, 2016 · 30 comments
Closed

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

ajsb85 opened this issue Dec 16, 2016 · 30 comments
Labels
❔ Type: Question Issue is a question relating to Hyper (please use zeit.chat or https://spectrum.chat/hyper for this)

Comments

@ajsb85
Copy link

ajsb85 commented Dec 16, 2016

No description provided.

@Faleij
Copy link

Faleij commented Dec 18, 2016

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

@corydeppen
Copy link

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.

@Faleij
Copy link

Faleij commented Dec 18, 2016

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.

@corydeppen
Copy link

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.

@subodhpareek18
Copy link

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

@subodhpareek18
Copy link

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.

@albinekb albinekb added the ❔ Type: Question Issue is a question relating to Hyper (please use zeit.chat or https://spectrum.chat/hyper for this) label Jan 4, 2017
@hinell
Copy link

hinell commented Jan 17, 2017

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

@fknop
Copy link

fknop commented Feb 25, 2017

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

@Faleij
Copy link

Faleij commented Feb 26, 2017

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

@Faleij
Copy link

Faleij commented Feb 26, 2017

@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

@t-khan-k
Copy link

t-khan-k commented Mar 8, 2017

@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.

@Faleij
Copy link

Faleij commented Mar 8, 2017

@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.

@412andrewmortimer
Copy link

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.

@rygo6
Copy link

rygo6 commented Apr 10, 2017

@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?

@Faleij
Copy link

Faleij commented Apr 10, 2017

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

@meoknu
Copy link

meoknu commented Jan 24, 2018

in hyper.js file
put

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

@styfle
Copy link
Member

styfle commented Feb 8, 2018

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 😞

@Galilyou
Copy link

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

@styfle
Copy link
Member

styfle commented Feb 15, 2018

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

@SidneyNemzer
Copy link

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.

@EstebanBorai
Copy link

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',
  }
};

@roblogic
Copy link

roblogic commented Apr 26, 2018

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)

@akshay-rathod
Copy link

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.

@behzadev
Copy link

behzadev commented Nov 6, 2018

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?

@Faleij
Copy link

Faleij commented Nov 6, 2018

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

image

@behzadev
Copy link

behzadev commented Nov 6, 2018

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

.hyper.js.txt

@Faleij
Copy link

Faleij commented Nov 6, 2018

@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

@behzadev
Copy link

behzadev commented Nov 6, 2018

@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

@alLi1n
Copy link

alLi1n commented Jun 9, 2019

Issue-Hyper

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

@ghost
Copy link

ghost commented Dec 17, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔ Type: Question Issue is a question relating to Hyper (please use zeit.chat or https://spectrum.chat/hyper for this)
Projects
None yet
Development

No branches or pull requests