cygwin下zsh安装

相关文章
ConEmu设置当前目录打开右键菜单
cygwin配置记录

安装 apt-cyg(类似linux的 apt-get)

1
2
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

安装zsh

mac/linux 有 oh-my-zsh, 在cygwin有oh-my-cygwin;安装oh-my-cygwin命令:

1
wget --no-check-certificate https://raw.github.com/haithembelhaj/oh-my-cygwin/master/oh-my-cygwin.sh -O - | sh

安装过程中出现 apt-cyg 安装失败(可能是脚本里面地址写错了);但是上面已经安装过了 apt-cyg, 故注释安装 apt-cyg的代码,修改脚本,文件名为 oh-my-cygwin.sh, 内容为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e

# cd home
cd ~

SIMPLE_BACKUP_SUFFIX=".orig"
APT_CYG="$(mktemp /tmp/apt-cyg.XXXXXXXX)"

# # install apt-cyg
# wget --no-check-certificate "https://github.com/john-peterson/apt-cyg/raw/path/apt-cyg" -O "${APT_CYG}"
# chmod +x "${APT_CYG}"

# install some stuff like vim and git
apt-cyg install zsh mintty vim curl git openssh


# install OH MY ZSH
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

# Create initial /etc/zshenv
[[ ! -e /etc/zshenv ]] && echo export PATH=/usr/bin:\$PATH > /etc/zshenv

install --backup ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

#setting up vim
VIMRC_EXAMPLE=`find /usr/share/vim -type f -name vimrc_example.vim | head -n 1`
if [ ! -f ~/.vimrc ] && [ -n "${VIMRC_EXAMPLE}" ]
then
install "${VIMRC_EXAMPLE}" ~/.vimrc
fi

# install apt-cyg
install --backup "${APT_CYG}" /bin/apt-cyg

# setting up zsh as default
sed -i "s/$USER\:\/bin\/bash/$USER\:\/bin\/zsh/g" /etc/passwd

# et voila just start it
/usr/bin/env zsh

然后执行 ./oh-my-cygwin.sh后成功安装

ConEmu 下设置窗口默认打开 zsh

SET CHERE_INVOKING=1 & "你的cygwin安装目录\bin\zsh -l -i" -cur_console:t:"cygwin terminal"

设置 ConEmu下设置窗口默认打开zsh

ConEmu 下设置右键当前目录打开 zsh

SET CHERE_INVOKING=1 & "你的cygwin安装目录\bin\zsh -l -i" -cur_console:t:"cygwin terminal"

在ConEmu下设置右键当前目录打开zsh

在ConEmu下设置右键当前目录打开zsh

ConEmu 下设置 只打开一个窗口, 全部以标签形式打开

在 ConEmu下设置 只打开一个窗口