Ubuntu开发环境

字数 994 · 2020-03-20

#linux

Zsh

Install

1
2
3
4
5
sudo apt install zsh
zsh --version
chsh -s $(which zsh)
# Log out and login back
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH

built-in

1
2
3
4
# mkdir -p && cd
take
# extract
x

alias

1
2
3
4
# cd ..
..
# cd -
1

Plugins

.zshrc

1
plugins=(git autojump colored-man-pages colorize common-aliases copybuffer copydir copyfile encode64)

zsh-syntax-highlighting

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

must be the last plugin!

1
plugins=(zsh-syntax-highlighting)

https://github.com/zsh-users/zsh-syntax-highlighting

autosuggestions

1
2
cd ~/.oh-my-zsh/plugins
git clone https://github.com/zsh-users/zsh-autosuggestions.git
1
plugins=(zsh-autosuggestions)

https://github.com/zsh-users/zsh-autosuggestions

git

Alias Command
gst git status
gco git checkout
gcb git checkout -b
gaa git add –all
gc git commit
gc! git commit –amend
gcam git commit -a -m
gcm git checokout master
gl git pull
gp git push
glum git pull upstream master
ggl git pull origin [current_branch]
ggp git push origin [current_branch]
glg git log –stat
grbm git rebase master
grbc git rebase –continue

https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git

autojump

1
2
3
4
5
sudo apt install python
https://github.com/wting/autojump
cd autojump
./install.py or ./uninstall.py
j --help

https://github.com/wting/autojump

alternative: z
alternative: zoxide

colored-man-pages

https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/colored-man-pages

colorize

1
sudo apt install python-pygments
1
cless [less-options] <file> [files]

https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/colorize

common-aliases

https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/common-aliases

copybuffer

Ctrl + O to copy the text currently typed.

https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copybuffer

copydir

1
2
# copy the $PWD to the system clipboard
copydir

https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copydir

copyfile

1
2
# Puts the contents of a file in your system clipboard
copyfile filename

https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copyfile

encode64

Function Alias Description
encode64 e64 Encodes given data to base64
decode64 d64 Decodes given data from base64

https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/encode64

zsh-syntax-highlight

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

.zshrc

1
plugins=( [plugins...] zsh-syntax-highlighting)

prof

1
2
# first line of .zshrc
zmodload zsh/zprof
1
zprof | bat
1
time (zsh -i -c exit)

Python

1
sudo apt install python python3

pyenv

pyenv - Simple Python Version Management

1
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

Edit .zshrc

1
2
3
export PATH="/home/uwsl/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
1
2
3
4
5
# Suggested build environment
sudo apt install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

pyenv install 3.8.2
pyenv global 3.8.2

pyenv global - can be overridden by local shell
pyenv local - can be overridden by shell

1
2
cd ~/.pyenv/plugins
git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git

.zshrc

1
2
3
export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"
export WORKON_HOME=$HOME/.virtualenvs
pyenv virtualenvwrapper_lazy

https://github.com/pyenv/pyenv
https://github.com/pyenv/pyenv-installer
https://github.com/pyenv/pyenv-virtualenvwrapper

1
pip install ipython

Node

nvm

https://github.com/nvm-sh/nvm#install–update-script

1
2
# "node" is an alias for the latest version
nvm install node 

Rust

cargo

https://doc.rust-lang.org/cargo/getting-started/installation.html

1
2
3
4
5
cargo install ripgrep
cargo install exa
cargo install fd
cargo install du-dust
cargo install bat

Fun

pipes.sh

Animated pipes terminal screensaver.

https://github.com/pipeseroni/pipes.sh

CMatrix

https://github.com/abishekvashok/cmatrix