简体   繁体   English

Git bash(薄荷)。 如何打开最大化

[英]Git bash (mintty). How to open maximized

I updated git for windows and found that it now has mintty as the command prompt for git bash. 我更新了git for windows,发现它现在已经mintty作为git bash的命令提示符。 It is much better than previous windows command prompt based git bash. 它比以前的基于Windows命令提示符的git bash要好得多。

It would be great if I could open the git bash initially maximized. 如果我能打开最初最大化的git bash,那就太好了。 There is a command line argument for mintty to open maximized. mintty的命令行参数打开最大化。

-w, --window normal|min|max|full

But, I don't know how I can pass this argument to mintty when I open git bash from 'Open git bash here' context menu. 但是,当我从'Open git bash here'上下文菜单中打开git bash时,我不知道如何将这个参数传递给mintty。

Does anyone know how to get this done? 有谁知道怎么做到这一点?

You may put an minttyrc file into etc folder of Git install(like C:\\Program Files\\Git\\etc), with the following config: 您可以使用以下配置将minttyrc文件放入Git install的etc文件夹(如C:\\ Program Files \\ Git \\ etc)中:

Window=max

btw, base on https://github.com/mintty/mintty/blob/7d70b3cb9776de288375ffe438d35e648650c98f/wiki/Tips.md , we may have several locations: 顺便说一句,根据https://github.com/mintty/mintty/blob/7d70b3cb9776de288375ffe438d35e648650c98f/wiki/Tips.md ,我们可能有几个地点:

For its configuration file, it reads /etc/minttyrc, $APPDATA/mintty/config, ~/.config/mintty/config, ~/.minttyrc, in this order. 对于其配置文件,它按此顺序读取/ etc / minttyrc,$ APPDATA / mintty / config,〜/ .config / mintty / config,〜/ .minttyrc。

This is kind of a hack, but I got it working by replacing git-bash.exe with my own one which gives -w max additional argument. 这是一种黑客,但我通过将git-bash.exe替换为我自己的一个来实现它,它给出了-w max附加参数。

Here is the code for git-bash.exe . 这是git-bash.exe的代码。

#include "stdafx.h"
#include <stdlib.h>

int _tmain(int argc, _TCHAR* argv[])
{
    system("START /B D:\\program_files\\git\\Git\\usr\\bin\\mintty.exe -w max -o AppID=GitForWindows.Bash -o RelaunchCommand=\"D:\\program_files\\git\\Git\\git-bash.exe\" -o RelaunchDisplayName=\"Git Bash\" -i /mingw64/share/git/git-for-windows.ico /usr/bin/bash --login -i");
    return 0;
}

You have to change paths in above code to your own values if you need to build your own git-bash.exe from above code. 如果需要从上面的代码构建自己的git-bash.exe ,则必须将上面代码中的路径更改为您自己的值。

EDIT: If mintty is started with above code, it does not know the location of git binary. 编辑:如果使用上面的代码启动mintty,它不知道git二进制文件的位置。 So I had to add the git bin directory to PATH variable. 所以我不得不将git bin目录添加到PATH变量中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM