dot_files/README.md

90 lines
18 KiB
Markdown
Raw Normal View History

2020-08-23 16:27:53 +01:00
![](./images/tmux_zsh.png)
2017-05-21 12:14:33 +03:00
# Dev environment
I use [tmux](https://github.com/tmux/tmux/wiki) with [zshell with oh-my-zsh](https://ohmyz.sh/).
On my personal machine I use [Konsole](https://konsole.kde.org/) as my terminal emulator and on my work machine I use [iTerm2](https://www.iterm2.com/).
Profiles for both are included in the repo - [Konsole profile](https://github.com/ViktorBarzin/dot_files/blob/master/konsole.profile) and [iTerm2 Profile](https://github.com/ViktorBarzin/dot_files/blob/master/iterm2.json).
2018-08-26 18:02:51 +01:00
2020-08-23 16:34:13 +01:00
My `tmux` settings are based on [`gpakosz`'s Oh-My-Tmux](https://github.com/gpakosz/.tmux) and I've added/changed some of the settings to better suite my taste.
2020-08-23 16:27:53 +01:00
# Installation
2020-08-23 16:34:13 +01:00
Download and run [`setup.sh`](https://raw.githubusercontent.com/ViktorBarzin/dot_files/master/setup.sh):
2020-08-23 16:27:53 +01:00
```bash
curl -sL https://raw.githubusercontent.com/ViktorBarzin/dot_files/master/setup.sh | bash
```
This script installs `tmux` and `zsh` if missing and `wget`s all the config files.
2020-08-23 16:27:53 +01:00
# Everyday hacks
Shortcuts I use every day.
I find all of these shortcuts improve my typing speed and hence my productivity.
2020-08-23 16:34:13 +01:00
They are focused around either 1) reduce the distance my fingers have to move or 2) shorten commonly written commands
2020-08-23 16:27:53 +01:00
## tmux
| Feature | Shortcut |
|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tmux` Prefix | `Alt-x` |
| text selection | `Prefix Enter` to enter visual mode, then vim bindings to move, `V` to enter select mode and once happy with selection `Enter` to copy to OS clipboard |
| Vertical split pane | `Prefix \` |
| Horizontal pane split | `Prefix -` |
| Pane movement | Hold `Alt` and vim movement bindings (or arrows for normies) to move in all directions |
| Pane resize | `Prefix` and vim movement |
| Maximize current pane | `Prefix z` (z for zoom) |
| Toggle synchronize panes | `Prefix s` (s for synchronize) |
| New window | `Prefix c` (c for create) |
| Go to previous window | `Prefix Tab` (similar to Alt-Tab) |
2020-08-23 16:34:13 +01:00
| Go to window number `n` | `Prefix n` where n is the window number (window numbers are in status line) |
2020-08-23 16:27:53 +01:00
| Rename window | `Prefix ,` |
| Edit a long command line | `Ctrl-x Ctrl-e` , this is more bash-y rather than tmux |
To edit the status line, edit `tmux_conf_theme_status_left` and `tmux_conf_theme_status_right` in `tmux.conf.local`.
2020-08-23 16:34:13 +01:00
## zsh aliases
2018-08-26 18:19:13 +01:00
2020-08-23 16:27:53 +01:00
A full list of all aliases can be seen in the [.bash_aliases file](https://raw.githubusercontent.com/ViktorBarzin/dot_files/master/.bash_aliases).
2018-08-26 18:19:13 +01:00
2020-08-23 16:27:53 +01:00
Here are some of the highlights I tend to use more often:
2018-08-26 16:54:45 +01:00
2020-08-23 16:27:53 +01:00
| Alias | Command | Comment |
|------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
2020-08-23 16:34:13 +01:00
| `s` | `ssh` | |
2020-08-23 16:27:53 +01:00
| `a` | `sudo atop` | `sudo` is used to get full overview |
| `h` | `sudo htop` | ^ |
2020-08-23 16:34:13 +01:00
| `myip` | `curl icanhzip.com` | Get your public/global IPv4/IPv6 address |
| `dk` | `docker` | 76.7% performance increase ;) |
| `dkon` | `sudo systemctl start docker` | |
| `dkoff` | `sudo systemctl stop docker` | |
| `kb` | `kubectl` | Massive perf increase if you are a k8s user |
2020-08-23 16:36:07 +01:00
| `kbp` | `kubectl get pods` | |
2020-08-23 16:34:13 +01:00
| `kn` | `kubens` | Switch k8s namespaces to avoid writing `-n some_namespace` all the time |
2020-08-23 16:27:53 +01:00
| `g` | `git` | 66.7% improvement ;) |
| `gs` | `git status` | |
| `ga` | `git add` | |
| `gc` | `git commit` | |
| `gp` | `git push origin master` | |
| `gpull` | `git pull --rebase origin master` | Please always rebase, don't do merge commits... |
| `gd` | `git diff` | |
| `gds` | `git diff --staged` | Changes that are `add`-ed and will be part of the commit |
| `gl` | `git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all` | A very pretty version of git log |
| `git-standup` | long function, not included for brevity | A useful git function to show commits from yesterday that's useful during standups |
2020-08-23 16:34:13 +01:00
| `xo` | `xdg-open` | Handy way to open any file type |
| `toclip` | `xclip -selection clipboard` | Usually I do pipe a command to `toclip` to get the output to clipboard |
| `pmr` | `python manage.py runserver` | Django developers know |
| `nopmr` | long line, not included for brevity | Django crashes from time to time but does not release the binded port which prevents from binding to them again |
| `python manage.py migrate` | `pmm` | |
| `python manage.py make migrations` | `pmmm` | |
2020-08-23 16:27:53 +01:00
| `omg` | `sudo systemctl restart NetworkManager` | When `NetworkManager` drives you crazy by crashing often |
| `omg1.1` | `sudo rmmod iwlmvm && sudo rmmod iwlwifi; sudo modprobe iwlwifi` | Reload wifi module |
| `root` | `sudo su -` | `sudo su` (without the `-`) keeps environment which, in a shared environ, can be dangerous |
| `aliases` | `vim ~/.bash_aliases && source ~/.bash_aliases` | Convenient way to add new aliases and source them upon exit |
| `zshrc` | `vim ~/.zshrc` | ^ |
| `f` | `free -h` | Check memory usage |
2020-08-23 16:36:07 +01:00
| `speedtest` | `curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py \|python -` | speed test without needing the package installed locally |