Skip to content

Instantly share code, notes, and snippets.

@corvofeng
Last active October 18, 2020 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corvofeng/f16a1fab54757f32879ae4d326c27518 to your computer and use it in GitHub Desktop.
Save corvofeng/f16a1fab54757f32879ae4d326c27518 to your computer and use it in GitHub Desktop.
快速配置自己的工作环境
#!/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
@corvofeng
Copy link
Author

corvofeng commented Oct 31, 2018

公司的机器是debian系的, 默认环境中什么都没有. 导致我ssh连上去的时候十分不适应,
手打许多命令真是太恐怖了, 而且vim也没有配置好.
所以我写了这个脚本, 基本上是将一些初级使用环境搭建好了, 包括:

  1. tmux: vim键位, 基础的主题;
  2. vim: 来自我的vim配置https://github.com/corvofeng/MyVimConfig, 仿照SpaceVim写了安装脚本;
  3. oh-my-zsh: 机器众多, 顺便换了一个能看到机器名的主题;
  4. htop: 真的比top好用多了, 对于好色的程序员来说真的很舒服;

image

  1. ranger: 一个文件浏览工具, 快速的跳转打开, vim键位, 来自Max, Qi.
    image

  2. git lg: 原始的git log只能看到当前分支, 所以就换一个优雅的使用方式啦.

如果你没用过原始的git log, 你根本不会知道下面的图片有多好看:
image

不接受pull request, 想改改成自己喜欢的样式请直接fork出来改.

安装之后自行选择是不是要vim +PlugInstall来安装插件.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment