cygwin setting

ls/grep/dir输出彩色显示

调整 ${HOME}/.bashrc文件(安装位置:\cygwin64\home\你的用户名\.bashrc),把注释掉别名打开:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 第98行左右开始
# Default to human readable figures
alias df='df -h'
alias du='du -h'
#
# Misc :)
# alias less='less -r' # raw control characters
alias whence='type -a' # where, of a sort
alias grep='grep --color' # show differences in colour
alias egrep='egrep --color=auto' # show differences in colour
alias fgrep='fgrep --color=auto' # show differences in colour
#
# Some shortcuts for different directory listings
alias ls='ls -hF --color=tty' # classify files in colour
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias ll='ls -l' # long list
alias la='ls -A' # all but . and ..
alias l='ls -CF' #

git输出(比如log、status)彩色显示

1
git config --global color.ui auto

配置盘符的链接

1
2
3
ln -s /cygdrive/c /c
ln -s /cygdrive/d /d
ln -s /cygdrive/e /e

自动补全不区分大小写

~/.bashrc文件(安装位置:\cygwin64\home\你的用户名\.bashrc)中添加:

1
shopt -s nocaseglob

~/.inputrc文件中添加:

1
set completion-ignore-case on

在cygwin的打开指定文件或文件夹到文件浏览器

~/.bashrc文件 最后加上

1
2
3
4
5
6
7
8
9
function xpl {
if [ "$1" = "" ]; then
XPATH=. # 缺省是当前目录
else
XPATH=$1
XPATH="$(cygpath -C ANSI -w "$XPATH")";
fi
explorer $XPATH
}

使用说明

1
2
3
xpl                 # explorer打开当前目录
xpl /usr/bin/ # explorer打开指定目录
xpl video.avi # 使用 Windows 默认程序打开文件


sub 使用sublime 打开

路径 D:\cygwin64\usr\local\bin下添加 sub 文件

1
/cygdrive/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe $1 &

其他快捷命令也可以自行配置

和conMenu配合使用

当前目录打开右键菜单

  1. 首先请打开链接设置ConEmu设置当前目录打开右键菜单
  2. 设置cygwin在conEmu作为默认打开

    setting -> Startup -> Tasks

    1
    2
    3
    SET CHERE_INVOKING=1 & "D:\cygwin64\bin\bash --login -ii" -cur_console:t:"cygwin terminal"

    // 替换 D:\cygwin64\bin\bash 为你的安装路径
配置图片~~

配置图片~~

参考资料


文章若有纰漏请大家补充指正,谢谢~~

http://blog.xinshangshangxin.com SHANG殇