Last active
October 18, 2020 02:29
-
-
Save corvofeng/f16a1fab54757f32879ae4d326c27518 to your computer and use it in GitHub Desktop.
快速配置自己的工作环境
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 使用方式: | |
# curl https://gist.githubusercontent.com/corvofeng/f16a1fab54757f32879ae4d326c27518/raw/prod.sh | bash - | |
# curl -sL https://corvo.myseu.cn/xyz/prod.sh | bash - | |
sudo apt install -y git htop tmux zsh cscope ranger | |
function save_env() { | |
# 必须有两个参数, key, value | |
[ $# != 2 ] && return | |
# echo "Parameter #1 is $1" | |
# echo "Parameter #2 is $2" | |
key=$1 | |
value=$2 | |
str="export $key=$value" | |
grep -q "$str" ~/.zshrc || echo "$str" >> ~/.zshrc | |
} | |
# tmux config. | |
[ -e ~/.tmux.conf ] || \ | |
curl https://gist.githubusercontent.com/corvofeng/d9bf8ab11bd64111d313c474d0f7d0bb/raw/tmux.conf > ~/.tmux.conf | |
# Don't Install my vim. | |
# curl -sL https://corvo.myseu.cn/xyz/install.sh | bash - | |
# 优雅的使用 `git lg` | |
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" | |
ZSH=~/.oh-my-zsh | |
[ -d $ZSH ] || git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" --depth=1 | |
[ -e ~/.zshrc ] || cp "$ZSH"/templates/zshrc.zsh-template ~/.zshrc | |
# 为zsh更换主题 | |
sed -i 's/^ZSH_THEME=.*$/ZSH_THEME="alanpeabody"/g' ~/.zshrc | |
# 添加对fzf的支持 | |
[ -d ~/.fzf ] || git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf | |
[ -e ~/.fzf/install ] && ~/.fzf/install --bin && ~/.fzf/install --completion --update-rc --key-bindings --no-bash --no-fish | |
grep -q 'fzf.zsh' ~/.zshrc || echo '[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh' >> ~/.zshrc | |
# 设置zshrc环境 | |
save_env LC_ALL en_US.UTF-8 | |
save_env EDITOR vim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
公司的机器是debian系的, 默认环境中什么都没有. 导致我ssh连上去的时候十分不适应,
手打许多命令真是太恐怖了, 而且vim也没有配置好.
所以我写了这个脚本, 基本上是将一些初级使用环境搭建好了, 包括:
ranger: 一个文件浏览工具, 快速的跳转打开, vim键位, 来自Max, Qi.
git lg: 原始的
git log
只能看到当前分支, 所以就换一个优雅的使用方式啦.如果你没用过原始的
git log
, 你根本不会知道下面的图片有多好看:不接受
pull request
, 想改改成自己喜欢的样式请直接fork出来改.安装之后自行选择是不是要
vim +PlugInstall
来安装插件.