あなたの端末をmsys 2とzshでswagに見えさせてください


ええ、わかってるわ、あなたはWindows上でWBUを介してWindows上でBashを使用することができますが、この記事は、Windows


あなたの端末を見て、退屈な、醜いと遅いですか?さて、これを読んだ後、端末は次のようになります.


かなりクール、右?

始めましょう!


まず最初に、以下のようにします.
  • 明らかにコンピュータの基礎をよく理解してください
  • 端末( bashの推奨)をよく理解しています.
  • まともなインターネット接続.
  • インストール


    まず第一にthis website コンソールエミュレータをダウンロードしてインストールするには.あなたはミニ版をインストールすることができます.問題ありません.
    オープンCMDER、この画面を見なければなりません.


    これは異なっているかもしれません、しかし、全体的なインターフェースは同じでなければなりません.
    それをカスタマイズしましょう、それは真っ黒に見えます!
    を押してください+ Alt + pは、設定オプションをもたらす.からフォントをダウンロードhere .
    つのファイルを1つずつをクリックしますダウンロード後、4つを選択します.TTFファイル、右クリックし、インストールします.そのために管理者パスワードを提供する必要があるかもしれません.
    MeslolgsのNFフォントをインストールした後、一般的に頭を→ CMDR設定の左ペインにあるフォントで、メインコンソールフォントと別のフォントをメトログNFに変更します.プロンプトのようにフォントサイズを大きく変更します.蟻のプロンプト??)OK、冗談.設定は次のようになります.

    オプション:ヘッド機能以上→ タブをクリックし、スキームオプションを< ubuntu >に変更します.好きなものは何でも選びます.あなたがこれらのどれも好きでなかったならばpage そして、あなたが好きなテーマをインストールする手順に従ってください.そして、それがどこで言うか、ConfigPath、それはすべてのセッティングの上に記憶部の近くで書かれる経路を意味します.私のものはC :\tools\cMcR\ベンダー\conemu - maximus 5\conemuです.XML私は個人的には、いわゆるMubuntuを好む.
    その後、msys 2をインストールしましょう.

    msys 2のインストール


    まず最初にインストーラ(*. exe)からダウンロードしますthis website そして、指示に従ってください.次のように簡単になります.
    msys 2をインストールした後、もう一度CMDRの設定を開きます.起動する→ タスクをクリックし、[デフォルトのタスクを更新]をクリックし、[デフォルトのタスクを更新]をクリックします.


    リフレッシュデフォルトタスク
    その後、定義済みのタスクパネルでいくつかのタスクが表示されます.{ bash ::msys 2 - 64 }タスクをクリックし、下部のクローンをクリックします.次に、新しくクローン化されたタスクをクリックし、右の白い入力ボックスで次のペーストを行います.
    set CHERE_INVOKING=1 & set MSYSTEM=MINGW64 & set "PATH=%ConEmuDrive%\msys64\mingw64\bin;%ConEmuDrive%\msys64\usr\bin;%PATH%" & %ConEmuBaseDirShort%\conemu-msys2–64.exe -new_console:p %ConEmuDrive%\msys64\usr\bin\bash.exe -- login -ic "exec zsh" -new_console:C:"%ConEmuDrive%\msys64\msys2.ico"
    


    変更タスクのオプション.
    我々が基本的にしていることはCHERE_INVOKING env var to 1, which tells Bash to not cd ホームディレクトリに常に.また、設定しているMSYSTEM to MINGW64 使うMingw デフォルトのMSYSの代わりにMSYSシステムとして、遅いです.そして、パス変数をmsys64\usr\bin and msys64\mingw64\bin Windowsネイティブバイナリを使用するには*.exe 基本的なUNIXコマンドの目的に役立つようにclear , ls , rm , ユーティリティもcurl . パスに来て、我々はまた、ネイティブのWindows%PATH% 変数.これは、すでにインストールされているユーティリティを使用するのに役立ちますnode , kubectl , docker , npm , など、我々も起動しているconemu-msys2-64.exe , これはmsysシステムをエミュレートするのに役立ちます.その後、我々は通過している-new_console:p , 新しいCMDER/CONMEUコンソールセッションを開始します.その後、我々は我々のヒーローを呼び出している.bash , ログインシェルとして設定します.The -c "exec zsh" パートは将来のために保たれなければなりません.ジャストキープ....exe --login -i . その後、再びいくつかのネイティブのCMDRコマンド.

    マイク・ドロップ.


    したがって、その後、起動セクション(親のいずれか、タスクも環境も)に移動し、指定した名前付きタスクを選択した名前を選択します.

    ユーティリティのインストール


    いくつかの基本的なユーティリティをインストールしましょう
    pacman -S man vim nano tar
    pacman -S openssh rsync make
    pacman -S zip unzip
    pacman -S mingw64/mingw-w64-x86_64-jq
    
    どのように簡単に物事をインストールすることに注意してください.たとえば、WindowsにRsyncを追加することは歴史的には簡単ではありません.

    sudoに関する注意:msys 2はそれを提供しません。この質問やiMachug /ウィンsudoを参照してください。


    gitのインストール


    あなたが以前にインストールされたWindowsのためにgitを持っていたならば、それをアンインストールするか、ちょっと取ってくださいC:\Program Files\Git\... , またはどこにインストールGit , から$PATH .

    リファレンス

  • エディット/etc/pacman.conf 直前[mingw32] , 追加するgit-for-windows パッケージリポジトリ
  • [git-for-windows]
    Server = https://wingit.blob.core.windows.net/x86-64 
    
  • 署名キーを認証します.
  • curl -L https://raw.githubusercontent.com/git-for-windows/build-extra/HEAD/git-for-windows-keyring/git-for-windows.gpg |
    pacman-key --add - &&
    pacman-key --lsign-key 3B6D86A1BA7701CD0F23AED888138B9E1A9F3986
    
  • 次に、リポジトリを更新/同期します.
  • pacman -Syyuu
    
    この更新msys2-runtime したがって、ウィンドウを閉じるように依頼します.パニックにならないでください、単に現在開いているMSYS 2シェルとMSYS 2プログラムを閉じてください.ダブルチェックタスクマネージャとキルpacman.exe ウィンドウが閉じられた後にまだ走っているならば、それが残ることができるので.一旦すべてが閉じられるならば、再び新しい端末を始めてください.
  • そして再び同期します(パッケージの非コア部分の更新).
  • pacman -Syuu
    
  • その後、gitと必要なものをインストールします.
  • pacman -S git git-extras
    pacman -S mingw-w64-x86_64-git-credential-manager mingw-w64-x86_64-git-lfs mingw-w64-x86_64-git-doc-man mingw-w64-x86_64-git-doc-html
    
  • すべてが動作することをチェックするgit --version そして、それは何かを出力するべきですgit version 2.14.1.windows.1 (あるいは新しい).


  • 出力git --version .

    インストール


    最後に、ヒロイン、ZSH!インストールするには以下のようにします.
    pacman -S zsh
    
    その後、実行clear すべてをクリアする
    上に覚えておく-c "exec zsh" 将来のために?現在、時間は来ます.追加する-c "exec zsh" 必要な場所に.さて、CMXを終了して、もう一度開きますzsh ! ああ!
    それはこの点で涼しく見えます、しかし、それはまだその支持俳優を必要とします.

    私のzshをインストールすること


    応援しています.Oh-My-Zsh , これは、我々がトップで見たものに我々のZSHをテーマにするのを助けます!
    まず、実行します.
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    
    これは私のzshをインストールします.完了.

    ああ私のZSHのテーマ


    上記の結果を達成するには、テーマをインストールする必要がありますPowerlevel10k . 実行:
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
    
    次に、型nano ~/.zshrc . これで開くnano , テキストエディタ.それが言う線を編集してください.ZSH_THEME="robbyrussell" to ZSH_THEME="powerlevel10k/powerlevel10k" . CMDRの再起動
    その後、自動的に実行p10k configure . これは、画面上で何を言っているかに従ってください.上記の結果を達成するためには、レインボープロンプトスタイルを使用します.私はインスタントプロンプトをオンにお勧めします.あなたはそれについてもっと読むことができますhere . また、一時的なプロンプトをオンにすることができます.あなたはそれについてもっと読むことができますhere .
    この時点で、私の~/.zshrc 以下のようになります.
    # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
    # Initialization code that may require console input (password prompts, [y/n]
    # confirmations, etc.) must go above this block; everything else may go below.
    if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
      source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
    fi
    # If you come from bash you might have to change your $PATH.
    # export PATH=$HOME/bin:/usr/local/bin:$PATH
    # Path to your oh-my-zsh installation.
    export ZSH="/c/Users/AnotherUser.APPLE.000/.oh-my-zsh"
    # Set name of the theme to load --- if set to "random", it will
    # load a random theme each time oh-my-zsh is loaded, in which case,
    # to know which specific one was loaded, run: echo $RANDOM_THEME
    # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
    ZSH_THEME="powerlevel10k/powerlevel10k"
    # Set list of themes to pick from when loading at random
    # Setting this variable when ZSH_THEME=random will cause zsh to load
    # a theme from this variable instead of looking in $ZSH/themes/
    # If set to an empty array, this variable will have no effect.
    # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
    # Uncomment the following line to use case-sensitive completion.
    # CASE_SENSITIVE="true"
    # Uncomment the following line to use hyphen-insensitive completion.
    # Case-sensitive completion must be off. _ and - will be interchangeable.
    # HYPHEN_INSENSITIVE="true"
    # Uncomment the following line to disable bi-weekly auto-update checks.
    # DISABLE_AUTO_UPDATE="true"
    # Uncomment the following line to automatically update without prompting.
    # DISABLE_UPDATE_PROMPT="true"
    # Uncomment the following line to change how often to auto-update (in days).
    # export UPDATE_ZSH_DAYS=13
    # Uncomment the following line if pasting URLs and other text is messed up.
    # DISABLE_MAGIC_FUNCTIONS="true"
    # Uncomment the following line to disable colors in ls.
    # DISABLE_LS_COLORS="true"
    # Uncomment the following line to disable auto-setting terminal title.
    # DISABLE_AUTO_TITLE="true"
    # Uncomment the following line to enable command auto-correction.
    # ENABLE_CORRECTION="true"
    # Uncomment the following line to display red dots whilst waiting for completion.
    # COMPLETION_WAITING_DOTS="true"
    # Uncomment the following line if you want to disable marking untracked files
    # under VCS as dirty. This makes repository status check for large repositories
    # much, much faster.
    # DISABLE_UNTRACKED_FILES_DIRTY="true"
    # Uncomment the following line if you want to change the command execution time
    # stamp shown in the history command output.
    # You can set one of the optional three formats:
    # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
    # or set a custom format using the strftime function format specifications,
    # see 'man strftime' for details.
    # HIST_STAMPS="mm/dd/yyyy"
    # Would you like to use another custom folder than $ZSH/custom?
    # ZSH_CUSTOM=/path/to/new-custom-folder
    # Which plugins would you like to load?
    # Standard plugins can be found in $ZSH/plugins/
    # Custom plugins may be added to $ZSH_CUSTOM/plugins/
    # Example format: plugins=(rails git textmate ruby lighthouse)
    # Add wisely, as too many plugins slow down shell startup.
    plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
    source $ZSH/oh-my-zsh.sh
    # User configuration
    # export MANPATH="/usr/local/man:$MANPATH"
    # You may need to manually set your language environment
    # export LANG=en_US.UTF-8
    # Preferred editor for local and remote sessions
    # if [[ -n $SSH_CONNECTION ]]; then
    #   export EDITOR='vim'
    # else
    #   export EDITOR='mvim'
    # fi
    # Compilation flags
    # export ARCHFLAGS="-arch x86_64"
    # Set personal aliases, overriding those provided by oh-my-zsh libs,
    # plugins, and themes. Aliases can be placed here, though oh-my-zsh
    # users are encouraged to define aliases within the ZSH_CUSTOM folder.
    # For a full list of active aliases, run `alias`.
    #
    # Example aliases
    # alias zshconfig="mate ~/.zshrc"
    # alias ohmyzsh="mate ~/.oh-my-zsh"
    #source /usr/share/git/completion/git-completion.sh
    #ZSH_THEME="powerlevel10k/powerlevel10k"
    #parse_git_branch() {
     #git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
    #}
    #PROMPT_USER="\[\033[32m\]\u@\h\[\033[00m\]"
    #PROMPT_DIR="\[\033[33m\]\w\[\033[00m\]"
    #PROMPT_BRANCH="\[\033[35m\]\$(parse_git_branch)\[\033[00m\]"
    #export PS1="$PROMPT_USER $PROMPT_DIR$PROMPT_BRANCH"$'\n$ '
    # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
    [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
    
    私は2つの余分なプラグインを追加しましたplugins= ... ZSHの自動補完とZSHの自動補完.これをコピーして、ナノエディターに貼り付けます.ZSHRCしかし、インストールする必要があります.これを実行するには、次の手順に従います.
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    
    あなたは彼らについてもっと学ぶことができますhere and here
    その後、端末を再起動します.

    結論


    したがって、私は、WindowsユーザーもLinux - Y環境、最も強力なことができると結論!
    ご質問/提案がある場合は、下に書いてください.もし間違いを犯したら、教えてください.できるだけ早く修正します.
    ハッピーハッキング!