-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsys2.txt
More file actions
120 lines (104 loc) · 5.91 KB
/
msys2.txt
File metadata and controls
120 lines (104 loc) · 5.91 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
一、Cmder安装和配置
1、下载cmder_mini.zip:http://cmder.net/
2、解压并把 cmder 加到环境变量
3、添加 cmder 到右键菜单
Cmder.exe /REGISTER ALL
4、标签栏上置:
打开并解锁Cmder的限制
修改 D:\worktool\Cmder\vendor\conemu-maximus5\ConEmu.xml
TabsLocation 00
5、设置cmder默认启动项为:{bash::mintty as Admin}
二、安装git for windows
1、下载:https://npm.taobao.org/mirrors/git-for-windows
2、安装 git 到 D:\worktool\Cmder\vendor\git-for-windows
3、git config --global http.sslVerify false
4、使用外部对比工具KDiff3 用作 diff 和 merge 工具,装好后配置 Git:
下载地址:https://sourceforge.net/projects/kdiff3/files/kdiff3
git config --global diff.tool bcomp
git config --global difftool.bcomp.cmd '"C:/Program Files/Beyond Compare 4/BCompare.exe" "$LOCAL" "$REMOTE"'
git config --global merge.tool bcomp
git config --global mergetool.bcomp.cmd '"C:/Program Files/Beyond Compare 4/BCompare.exe" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"'
可以试一下 git mergetool 和 git difftool 看看是否配置正确了。
为避免每次用 git difftool 时都提示确认,下面两行也可以设一下:
git config --global mergetool.prompt false
git config --global difftool.prompt false
git config --global http.sslVerify false
三、msys2安装和配置
1、安装 msys2
在浏览器中打开 http://repo.msys2.org/distrib/x86_64/,下载安装
2、移动 pacman相关文件到git对应目录
修改以下脚本对应的安装目录,输出到文件并执行:
#!/bin/bash
msys_dir=/d/msys64
git_dir=/d/worktool/Cmder/vendor/git-for-windows
for item in `find ${msys_dir} -name "pacman*" | grep -v "share\|cache"`; do
desfile=`echo ${item} | sed 's#'"${msys_dir}"'#'"${git_dir}"'#g'`
desdir=${desfile}
if [ ! -d ${desdir} ]; then
desdir=${desdir%/*}
fi
if [ ! -e ${desdir} ]; then
mkdir -p ${desdir}
fi
mv ${item} ${desfile}
done
3、卸载msys2
四、cmder中使用pacman
打开cmder, 运行{bash::mintty as Admin}选项
1、修改/etc/pacman.d/源文件
2、如有需要,设置代理
proxy_url="http://100.101.190.114:9953"
export http_proxy=${proxy_url} https_proxy=${proxy_url}
2、更新
pacman-key --init
pacman -S pacman pacman-mirrors
pacman -Syu git_for_window更新 filesystem 会变乱
3、常用命令:
pacman -S pkgname1 pkgname2 ... 安装指定的包
pacman -S extra/package_name 多版本选择安装(例:extra和testing)
pacman -S plasma-{desktop,mediacenter,nm} 安装含有相似名称的软件包(例:plasma开头)
pacman -S gnome 安装指定的包组,会提醒用户选择 gnome 内需要安装的包
Enter a selection (default=all): 1-10 15 将选中序号 1 至 10 和 15 的软件包
Enter a selection (default=all): ^5-8 ^2 将会选中除了序号 5 至 8 和 2 之外的所有软件包
pacman -Sg gnome 查看 gnome 组所辖包
pacman -Sg gnome --force 强制安装
pacman -R package_name 仅删除单个软件包
pacman -Rs package_name 删除指定软件包,及其所有没有被其他已安装软件包使用的依赖关系
pacman -Rsc package_name 删除软件包和所有依赖这个软件包的程序
pacman -Rdd package_name 删除软件包,但是不删除依赖这个软件包的其他程序
pacman -Rn package_name 删除某些软件会生成重要文件备份,-n 可以避免生成
pacman -Syu 升级软件包
pacman -Qs string1 string2 ... 查询已安装的软件包
pacman -Ss string1 string2 ... 查询可以安装的软件包
-g 查看软件组 -l 查询软件包的内容 -s 查询软件所在的包
pactree package_name 显示软件包的依赖树
whoneeds package_name 检查一个安装的软件包被那些包依赖
pacman -Sc 清除未安装软件包的缓存
pacman -Scc 可以清理所有缓存,但重装时需重新下载
缓存目录/var/cache/pacman/pkg/
4、查看工具帮助
pacman -h ;pacman -S -h
5、安装基本编译套件
pacman -S gcc base-devel
6、clion 开发环境
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-extra-cmake-modules
pacman -S mingw-w64-x86_64-make
pacman -S mingw-w64-x86_64-gdb
pacman -S mingw-w64-x86_64-toolchain
7、中文乱码
a、 vim /usr/bin/win
#!/bin/bash
$@ |iconv -f gbk -t utf-8
b、 vim /etc/profile.d/alias.sh
alias ls="/bin/ls --color=tty --show-control-chars"
alias grep="/bin/grep --color"
alias ll="/bin/ls --color=tty --show-control-chars -l"
alias ping="/bin/win ping"
alias netstat="/bin/win netstat"
alias nslookup="/bin/win nslookup"
alias ipconfig="/bin/win ipconfig"
export LANG="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8"
8、常用目录挂载
vim .bash_profile
mount -fo binary,noacl,posix=0,user D:/docs ~/docs