最近在自己的X1上捣鼓Django框架的编程,windows环境使用起来确实让人痛苦,因此决定还是在Linux系统下进行Django框架的编程,跟朋友交流了一下,最终敲定了以下方案并把中间使用的一些插件记录下来。
思路:WSL环境 + vscodeIDE + windows terminal
部分插件:zsh(很好用的shell工具)、Remote-WSL(vscode的远程插件,默认识别本机的WSL)
WSL使用了WSL2版本,因为WSL2具有完整的linux内核,因而系统更加完善并且可使用docker容器等等。
安装步骤:https://docs.microsoft.com/zh-cn/windows/wsl/install
查看WSL版本命令
wsl -l -v
使用管理员身份打开powershell,在powershell窗口键入:
start-process PowerShell -verb runas
WSL还可以通过安装nautilus使用GUI操作。
在安装zsh的时候,github一直连接不上去,检查发现跟dns的host信息污染有关,所以在WSL上加上了github的一些主机信息
打开 /etc/hosts/,在末尾添加:
#*********************github 2021-11-20 update******************** #******* get latest hosts: http://blog.yoqi.me/lyq/16489.html 151.101.65.194 github.global.ssl.fastly.net 2606:50c0:8001::153 assets-cdn.github.com 185.199.109.153 documentcloud.github.com 192.30.255.112 gist.github.com 185.199.110.133 gist.githubusercontent.com 185.199.111.154 github.githubassets.com 185.199.109.154 help.github.com 192.30.255.121 nodeload.github.com 185.199.110.133 raw.github.com 140.82.113.17 status.github.com 2606:50c0:8002::153 training.github.com 185.199.108.133 avatars.githubusercontent.com 185.199.109.133 avatars0.githubusercontent.com 185.199.108.133 avatars1.githubusercontent.com 185.199.110.133 avatars2.githubusercontent.com 185.199.108.133 avatars3.githubusercontent.com 185.199.110.133 avatars4.githubusercontent.com 185.199.108.133 avatars5.githubusercontent.com 185.199.110.133 avatars6.githubusercontent.com 185.199.111.133 avatars7.githubusercontent.com 185.199.108.133 avatars8.githubusercontent.com 185.199.111.133 favicons.githubusercontent.com 192.30.255.120 codeload.github.com 52.216.226.160 github-cloud.s3.amazonaws.com 52.217.72.92 github-com.s3.amazonaws.com 52.216.130.3 github-production-release-asset-2e65be.s3.amazonaws.com 52.216.242.172 github-production-user-asset-6210df.s3.amazonaws.com 54.231.133.41 github-production-repository-file-5c1aeb.s3.amazonaws.com 185.199.110.153 githubstatus.com 64.71.144.202 github.community 185.199.109.133 media.githubusercontent.com 185.199.111.133 camo.githubusercontent.com 185.199.111.133 raw.githubusercontent.com 185.199.111.133 cloud.githubusercontent.com 185.199.110.133 user-images.githubusercontent.com 2606:50c0:8001::153 customer-stories-feed.github.com 2606:50c0:8002::153 pages.github.com 192.30.255.116 api.github.com 140.82.113.26 live.github.com 140.82.114.29 githubapp.com 52.151.41.89 github.dev 192.30.255.112 github.com
然后执行命令
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
还有一个自定义同义词的alias命令。
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
效果:输入git lg