├── devices ├── ipad.md ├── iphone.md ├── windows.md ├── ubuntu.md └── mac.md ├── gitignore_global.conf ├── vscode ├── locale.json ├── keybindings.json └── settings.json ├── git └── gitconfig ├── README.md ├── LICENSE ├── iterm2 ├── key-binding.md ├── keys.itermkeymap ├── changkun.itermcolors └── changkun-dev.json ├── vim ├── go.md ├── ycm_extra_conf.py ├── vimrc.config └── colors │ └── jellybeans.vim ├── mac-install.sh ├── ubuntu-install.sh ├── zsh ├── changkun.zsh-theme ├── zshrc-linux.conf └── zshrc-mac.conf └── tmux ├── tmux.local.conf └── tmux.conf /devices/ipad.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /devices/iphone.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gitignore_global.conf: -------------------------------------------------------------------------------- 1 | *~ 2 | .DS_Store 3 | Desktop.ini 4 | ._* 5 | Thumbs.db 6 | .Sptlight-V100 7 | .Trashes 8 | 9 | *.pyc 10 | *.out 11 | .env/** 12 | venv/** 13 | node_modules/** -------------------------------------------------------------------------------- /vscode/locale.json: -------------------------------------------------------------------------------- 1 | { 2 | // Defines VSCode's display language. 3 | // See https://go.microsoft.com/fwlink/?LinkId=761051 for a list of supported languages. 4 | // Changing the value requires to restart VSCode. 5 | "locale":"en" 6 | } -------------------------------------------------------------------------------- /git/gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Changkun Ou 3 | email = hi@changkun.de 4 | [push] 5 | default = current 6 | [color] 7 | ui = true 8 | [branch] 9 | autosetupmerge = always 10 | [url "git@github.com:"] 11 | insteadOf = https://github.com/ 12 | [http] 13 | cookiefile = /Users/changkun/.gitcookies 14 | [filter "lfs"] 15 | clean = git-lfs clean -- %f 16 | smudge = git-lfs smudge -- %f 17 | process = git-lfs filter-process 18 | required = true -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dotfiles 2 | 3 | My personal **macOS** and **Linux** (Ubuntu distribution) system dotfiles and settings. 4 | 5 | _Use it at your own risk._ 6 | 7 | - [macOS](./devices/mac.md) 8 | - [Linux Ubuntu](./devices/ubuntu.md) 9 | - [iPadOS](./devices/ipad.md) 10 | - [iOS](./devices/iphone.md) 11 | 12 | ## Folder Policy 13 | 14 | All code projects are managed in `~/dev`, common folders: 15 | 16 | ```sh 17 | ~/dev/changkun.de 18 | ~/dev/golang.design 19 | ~/dev/godev # golang.org repositories 20 | ~/dev/wild # code for temporary use 21 | ``` 22 | 23 | Managing multiple go versions: 24 | 25 | ```sh 26 | ~/goes/go # just an alias to an inused go version 27 | ~/goes/go1.17.1 # a specific version 28 | ``` 29 | 30 | 31 | ## License 32 | 33 | MIT | Copyright © 2016-2021 [Changkun Ou](https://changkun.de) 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016-2020 Changkun 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /iterm2/key-binding.md: -------------------------------------------------------------------------------- 1 | # Key bindings 2 | 3 | To jump between words and start/end of lines in iTerm2 follow these steps: 4 | 5 | - iTerm2 -> Preferences (⌘ + ,) 6 | - Open the “Keys” tab 7 | - Add the following Global Shortcut Keys 8 | 9 | ## Move cursor one word left 10 | 11 | - Keyboard Combination: ⌥ + ← 12 | - Action: Send Hex Code 13 | - Code: 0x1b 0x62 14 | 15 | ## Move cursor one word right 16 | 17 | - Keyboard Combination: ⌥ + → 18 | - Action: Send Hex Code 19 | - Code: 0x1b 0x66 20 | 21 | ## Move cursor to beginning of line 22 | 23 | - Keyboard Combination: ⌘ + ← 24 | - Action: Send Hex Code 25 | - Code: 0x01 26 | 27 | ## Move cursor to end of line 28 | 29 | - Keyboard Combination: ⌘ + → 30 | - Action: Send Hex Code 31 | - Code: 0x05 32 | 33 | ## Delete word 34 | 35 | - Keyboard Combination: ⌥ + ←Delete 36 | - Action: Send Hex Code 37 | - Code: 0x1b 0x08 38 | 39 | ## Delete line 40 | 41 | - Keyboard Combination: ⌘ + ←Delete 42 | - Action: Send Hex Code 43 | - Code: 0x15 44 | 45 | ## Undo 46 | 47 | - Keyboard Combination: ⌘ + z 48 | - Action: Send Hex Code 49 | - Code: 0x1f 50 | 51 | ## Don't forget to remove the previous bindings: 52 | 53 | - Open the “Profiles” tab 54 | - Click the sub-tab ”Keys” 55 | - Remove the mappings for key combinations ⌥ + ← and ⌥ + → -------------------------------------------------------------------------------- /vim/go.md: -------------------------------------------------------------------------------- 1 | ## vim-go cheatsheet 2 | 3 | ``` 4 | :GoRun :GoBuild :GoInstall 5 | 6 | :GoDef # goto definition of object under cursor 7 | gd # also has the same effect 8 | Ctrl-O / Ctrl-I # hop back to your source file/return to definition 9 | 10 | :GoDoc # opens up a side window for quick documentationn 11 | K # also has the same effect 12 | 13 | 14 | :GoTest # run every *_test.go file and report results 15 | :GoTestFunc # or just test the function under your cursor 16 | :GoCoverage # check your test coverage 17 | :GoAlternate # switch bewteen your test case and implementation 18 | 19 | :GoImport # manage and name your imports 20 | :GoImportAs 21 | :GoDrop 22 | 23 | :GoRename # precise renaming of identifiers 24 | 25 | :GoLint # lint your code 26 | :GoVer 27 | :GoErrCheck 28 | 29 | :GoAddTags # manage your tags 30 | :GoRemoveTags 31 | ``` 32 | 33 | ## vim-fugitive 34 | 35 | ``` 36 | :Gstatus # run `git status` 37 | :Gdiff # diff the working tree vs staged version 38 | :Gcommit % # commit the current file 39 | ``` 40 | 41 | ## optional vim plugins 42 | 43 | I don't have time for these fancy stuff and they are useless for me. 44 | 45 | https://github.com/ryanoasis/nerd-fonts 46 | https://github.com/ryanoasis/vim-devicons 47 | https://github.com/tiagofumo/vim-nerdtree-syntax-highlight -------------------------------------------------------------------------------- /vscode/keybindings.json: -------------------------------------------------------------------------------- 1 | // Place your key bindings in this file to overwrite the defaults 2 | [ 3 | { "key": "cmd+backspace", "command": "workbench.action.terminal.clear", 4 | "when": "terminalFocus" }, 5 | { "key": "ctrl+1", "command": "workbench.action.focusFirstEditorGroup" }, 6 | { "key": "ctrl+2", "command": "workbench.action.focusSecondEditorGroup" }, 7 | { "key": "ctrl+3", "command": "workbench.action.focusThirdEditorGroup" }, 8 | { "key": "cmd+1", "command": "workbench.action.openEditorAtIndex1" }, 9 | { "key": "cmd+2", "command": "workbench.action.openEditorAtIndex2" }, 10 | { "key": "cmd+3", "command": "workbench.action.openEditorAtIndex3" }, 11 | { "key": "cmd+4", "command": "workbench.action.openEditorAtIndex4" }, 12 | { "key": "cmd+5", "command": "workbench.action.openEditorAtIndex5" }, 13 | { "key": "cmd+6", "command": "workbench.action.openEditorAtIndex6" }, 14 | { "key": "cmd+7", "command": "workbench.action.openEditorAtIndex7" }, 15 | { "key": "cmd+8", "command": "workbench.action.openEditorAtIndex8" }, 16 | { 17 | "key": "cmd+shift+[", 18 | "command": "workbench.action.previousEditor" 19 | }, 20 | { 21 | "key": "cmd+shift+]", 22 | "command": "workbench.action.nextEditor" 23 | }, 24 | { 25 | "key": "alt+1", 26 | "command": "workbench.action.terminal.focusAtIndex1" 27 | }, 28 | { 29 | "key": "alt+2", 30 | "command": "workbench.action.terminal.focusAtIndex2" 31 | }, 32 | { 33 | "key": "alt+3", 34 | "command": "workbench.action.terminal.focusAtIndex3" 35 | }, 36 | { 37 | "key": "alt+4", 38 | "command": "workbench.action.terminal.focusAtIndex4" 39 | } 40 | ] -------------------------------------------------------------------------------- /iterm2/keys.itermkeymap: -------------------------------------------------------------------------------- 1 | {"Touch Bar Items":[],"Key Mappings":{"0xf700-0x260000":{"Text":"[1;6A","Action":10},"0x37-0x40000":{"Text":"0x1f","Action":11},"0x32-0x40000":{"Text":"0x00","Action":11},"0xf709-0x20000":{"Text":"[17;2~","Action":10},"0xf70c-0x20000":{"Text":"[20;2~","Action":10},"0xf729-0x20000":{"Text":"[1;2H","Action":10},"0xf72b-0x40000":{"Text":"[1;5F","Action":10},"0xf705-0x20000":{"Text":"[1;2Q","Action":10},"0xf703-0x260000":{"Text":"[1;6C","Action":10},"0xf700-0x220000":{"Text":"[1;2A","Action":10},"0xf703-0x300000":{"Action":11,"Text":"0x05"},"0x38-0x40000":{"Text":"0x7f","Action":11},"0x33-0x40000":{"Text":"0x1b","Action":11},"0xf703-0x220000":{"Text":"[1;2C","Action":10},"0xf701-0x240000":{"Text":"[1;5B","Action":10},"0xf70d-0x20000":{"Text":"[21;2~","Action":10},"0xf702-0x260000":{"Text":"[1;6D","Action":10},"0xf729-0x40000":{"Text":"[1;5H","Action":10},"0xf702-0x300000":{"Action":11,"Text":"0x01"},"0xf706-0x20000":{"Text":"[1;2R","Action":10},"0x34-0x40000":{"Text":"0x1c","Action":11},"0x2d-0x40000":{"Text":"0x1f","Action":11},"0xf70e-0x20000":{"Text":"[23;2~","Action":10},"0xf702-0x220000":{"Text":"[1;2D","Action":10},"0x7f-0x100000":{"Action":11,"Text":"0x15"},"0xf703-0x280000":{"Action":11,"Text":"0x1b 0x66"},"0xf707-0x20000":{"Text":"[1;2S","Action":10},"0xf700-0x240000":{"Text":"[1;5A","Action":10},"0xf70a-0x20000":{"Text":"[18;2~","Action":10},"0x35-0x40000":{"Text":"0x1d","Action":11},"0xf70f-0x20000":{"Text":"[24;2~","Action":10},"0xf703-0x240000":{"Text":"[1;5C","Action":10},"0x7f-0x80000":{"Action":11,"Text":"0x1b 0x08"},"0xf701-0x260000":{"Text":"[1;6B","Action":10},"0xf702-0x280000":{"Action":11,"Text":"0x1b 0x62"},"0xf72b-0x20000":{"Text":"[1;2F","Action":10},"0x36-0x40000":{"Text":"0x1e","Action":11},"0xf708-0x20000":{"Text":"[15;2~","Action":10},"0x7a-0x100000":{"Action":11,"Text":"0x1f"},"0xf701-0x220000":{"Text":"[1;2B","Action":10},"0xf70b-0x20000":{"Text":"[19;2~","Action":10},"0xf702-0x240000":{"Text":"[1;5D","Action":10},"0xf704-0x20000":{"Text":"[1;2P","Action":10}}} -------------------------------------------------------------------------------- /mac-install.sh: -------------------------------------------------------------------------------- 1 | # WARNING: PLEASE DO NOT USE THIS SCRIPT, JUST MANUALLY FOLLOW THE STEPS 2 | 3 | # basic development environment 4 | xcode-select --install 5 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 6 | 7 | # brew install 8 | brew tap mongodb/brew 9 | brew install wget python3 uv tree macvim node youtube-dl tmux pandoc cmake cmake-docs reattach-to-user-namespace mongodb-community redis httpie vegeta awscli pgweb kubectl 10 | # nodejs install 11 | npm install -g typescript 12 | # python install 13 | pip3 install virtualenv scipy numpy pandas jupyter tensorflow scikit-learn matplotlib seaborn pillow 14 | 15 | # install autojump 16 | git clone https://github.com/wting/autojump 17 | cd autojump && ./install.py && cd .. && rm -rf autojump 18 | 19 | # install oh-my-zsh 20 | sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" 21 | mv ~/.zshrc ~/.zshrc_old 22 | ln zsh/zshrc-mac.conf ~/.zshrc 23 | ln zsh/changkun.zsh-theme ~/.oh-my-zsh/themes/ 24 | git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions 25 | source ~/.zshrc 26 | 27 | # install golang 28 | mkdir -p ~/goes 29 | cd ~/goes 30 | GOVERSION=$(curl -s 'https://go.dev/dl/?mode=json' | grep '"version"' | sed 1q | awk '{print $2}' | tr -d ',"') # get latest go version 31 | GOARCH=$(if [[ $(uname -m) == "x86_64" ]] ; then echo amd64; else echo $(uname -m); fi) # get either amd64 or arm64 (darwin/m1) 32 | wget https://dl.google.com/go/$GOVERSION.darwin-$GOARCH.tar.gz 33 | tar xvf $GOVERSION.darwin-$GOARCH.tar.gz && rm $GOVERSION.darwin-$GOARCH.tar.gz 34 | mv ~/goes/go ~/goes/$GOVERSION 35 | ln -s ~/goes/$GOVERSION ~/goes/go 36 | source ~/.zshrc 37 | go install changkun.de/x/rmtrash@latest 38 | 39 | # install vim config 40 | ln vim/vimrc.config ~/.vimrc 41 | mkdir -p ~/.vim/colors/ 42 | ln vim/colors/jellybeans.vim ~/.vim/colors/jellybeans.vim 43 | curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 44 | vim +PlugInstall +qall 45 | ~/.vim/plugged/YouCompleteMe/install.py --go-completer 46 | 47 | # install tmux config 48 | ln tmux/tmux.conf ~/.tmux.conf 49 | ln tmux/tmux.local.conf ~/.tmux.conf.local 50 | 51 | # fonts 52 | git clone https://github.com/powerline/fonts.git --depth=1 53 | cd fonts && ./install.sh && cd .. && rm -rf fonts 54 | 55 | -------------------------------------------------------------------------------- /ubuntu-install.sh: -------------------------------------------------------------------------------- 1 | # this script setup my personal ubuntu setup 2 | # the setup workflow has been used for the following purpose: 3 | # - digital ocean 4 | # - personal desktop 5 | # - perf work desktop 6 | 7 | ## install basic tools, grouped line by line 8 | sudo apt update && sudo apt upgrade -y 9 | sudo apt install -y ssh git vim zsh tmux docker.io 10 | sudo apt install -y build-essential clang cmake libboost-dev libssl-dev 11 | sudo apt install -y linux-tools-$(uname -r) linux-tools-generic graphviz 12 | sudo apt install -y redis wine64 13 | sudo apt install -y texlive-full pandoc nodejs npm 14 | sudo apt install -y httpie vegeta kubectl doctl hugo 15 | sudo apt install -y xbindkeys xbindkeys-config xclip 16 | sudo apt install -y tree youtube-dl 17 | 18 | ## install `oh-my-zsh` 19 | cd ~/dev/dotfiles 20 | sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" 21 | mv ~/.zshrc ~/.zshrc_old 22 | ln -s zsh/zshrc-linux.conf ~/.zshrc 23 | ln zsh/changkun.zsh-theme ~/.oh-my-zsh/themes/ 24 | git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions 25 | source ~/.zshrc 26 | 27 | ## install python 28 | apt install -y python3-pip 29 | pip3 install virtualenv scipy numpy pandas jupyter tensorflow scikit-learn matplotlib seaborn pillow pyyaml requests 30 | 31 | # install golang 32 | GOVERSION=$(curl -s 'https://golang.org/dl/?mode=json' | grep '"version"' | sed 1q | awk '{print $2}' | tr -d ',"') # get latest go version 33 | GOARCH=$(if [[ $(uname -m) == "x86_64" ]] ; then echo amd64; else echo $(uname -m); fi) # get either amd64 or arm64 (darwin/m1) 34 | wget https://dl.google.com/go/$GOVERSION.linux-$GOARCH.tar.gz 35 | tar xvf $GOVERSION.linux-$GOARCH.tar.gz && rm $GOVERSION.linux-$GOARCH.tar.gz 36 | mv ~/goes/go ~/goes/$GOVERSION 37 | ln -s ~/goes/$GOVERSION ~/goes/go 38 | source ~/.zshrc 39 | 40 | # install vim config 41 | cd ~/dev/dotfiles 42 | ln vim/vimrc.config ~/.vimrc 43 | mkdir -p ~/.vim/colors/ 44 | ln vim/colors/jellybeans.vim ~/.vim/colors/jellybeans.vim 45 | curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 46 | vim +PlugInstall +qall 47 | ~/.vim/plugged/YouCompleteMe/install.py --go-completer 48 | 49 | # install tmux config 50 | ln tmux/tmux.conf ~/.tmux.conf 51 | ln tmux/tmux.local.conf ~/.tmux.conf.local 52 | 53 | # fonts 54 | git clone https://github.com/powerline/fonts.git --depth=1 55 | cd fonts && ./install.sh && cd .. && rm -rf fonts 56 | -------------------------------------------------------------------------------- /zsh/changkun.zsh-theme: -------------------------------------------------------------------------------- 1 | # CHANGKUN ZSH THEME 2 | # hi@changkun.de 3 | # Based on the great ys theme (http://ysmood.org/wp/2013/03/my-ys-terminal-theme/) 4 | 5 | # Machine name. 6 | function box_name { 7 | [ -f ~/.box-name ] && cat ~/.box-name || echo $HOST 8 | } 9 | 10 | # Directory info. 11 | local current_dir='${PWD/#$HOME/~}' 12 | 13 | # VCS 14 | CHANGKUN_PROMPT_PREFIX1="%{$fg[white]%}%{$fg[cyan]%}\uE0A0%{$reset_color%} " 15 | CHANGKUN_PROMPT_PREFIX2="%{$fg[cyan]%}" 16 | CHANGKUN_PROMPT_SUFFIX="%{$reset_color%}" 17 | CHANGKUN_PROMPT_DIRTY=" %{$fg[red]%}✖︎" 18 | CHANGKUN_PROMPT_CLEAN=" %{$fg[green]%}●" 19 | 20 | # Git info. 21 | local git_info='$(git_prompt_info)' 22 | ZSH_THEME_GIT_PROMPT_PREFIX="${CHANGKUN_PROMPT_PREFIX1}${CHANGKUN_PROMPT_PREFIX2}" 23 | ZSH_THEME_GIT_PROMPT_SUFFIX="$CHANGKUN_PROMPT_SUFFIX" 24 | ZSH_THEME_GIT_PROMPT_DIRTY="$CHANGKUN_PROMPT_DIRTY" 25 | ZSH_THEME_GIT_PROMPT_CLEAN="$CHANGKUN_PROMPT_CLEAN" 26 | 27 | # HG info 28 | local hg_info='$(changkun_hg_prompt_info)' 29 | changkun_hg_prompt_info() { 30 | # make sure this is a hg dir 31 | if [ -d '.hg' ]; then 32 | echo -n "${CHANGKUN_PROMPT_PREFIX1}hg${CHANGKUN_PROMPT_PREFIX2}" 33 | echo -n $(hg branch 2>/dev/null) 34 | if [ -n "$(hg status 2>/dev/null)" ]; then 35 | echo -n "$CHANGKUN_PROMPT_DIRTY" 36 | else 37 | echo -n "$CHANGKUN_PROMPT_CLEAN" 38 | fi 39 | echo -n "$CHANGKUN_PROMPT_SUFFIX" 40 | fi 41 | } 42 | 43 | # virtualenv info 44 | local venv_info='$(virtualenv_info)' 45 | virtualenv_info() { 46 | if [ $VIRTUAL_ENV ]; then 47 | echo "%{${fg_bold[white]}%}(env: %{${fg[green]}%}`basename \"$VIRTUAL_ENV\"`%{${fg_bold[white]}%})%{${reset_color}%}" 48 | fi 49 | } 50 | 51 | # Prompt format: 52 | # (venv: ...) 53 | # # USER at MACHINE in DIRECTORY 54 | # → BRANCH STATE [TIME] 55 | PROMPT="${venv_info} 56 | %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ 57 | %{$fg[cyan]%}%n \ 58 | %{$fg[white]%}at \ 59 | %{$fg[green]%}$(box_name) $reset_color%}in \ 60 | %{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ 61 | ${hg_info} 62 | %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" 63 | RPROMPT="${git_info} %{$fg[white]%}[%*]" 64 | 65 | if [[ "$USER" == "root" ]]; then 66 | PROMPT="${venv_info} 67 | %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ 68 | %{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \ 69 | %{$fg[white]%}at \ 70 | %{$fg[green]%}$(box_name) $reset_color%}in \ 71 | %{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ 72 | ${hg_info} 73 | %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" 74 | RPROMPT="${git_info} %{$fg[white]%}[%*]" 75 | fi 76 | -------------------------------------------------------------------------------- /zsh/zshrc-linux.conf: -------------------------------------------------------------------------------- 1 | # If you come from bash you might have to change your $PATH. 2 | export PATH=$HOME/bin:/usr/local/bin:$PATH 3 | 4 | # Golang paths 5 | export GOPATH=$HOME/go 6 | export PATH=$PATH:$HOME/goes/go/bin:$GOPATH/bin 7 | 8 | # Path to your oh-my-zsh installation. 9 | export ZSH=~/.oh-my-zsh 10 | 11 | # Set name of the theme to load. Optionally, if you set this to "random" 12 | # it'll load a random theme each time that oh-my-zsh is loaded. 13 | # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 14 | ZSH_THEME="changkun" 15 | TERM=xterm-256color 16 | 17 | # Uncomment the following line to use case-sensitive completion. 18 | # CASE_SENSITIVE="true" 19 | 20 | # Uncomment the following line to use hyphen-insensitive completion. Case 21 | # sensitive completion must be off. _ and - will be interchangeable. 22 | # HYPHEN_INSENSITIVE="true" 23 | 24 | # Uncomment the following line to disable bi-weekly auto-update checks. 25 | # DISABLE_AUTO_UPDATE="true" 26 | 27 | # Uncomment the following line to change how often to auto-update (in days). 28 | export UPDATE_ZSH_DAYS=13 29 | 30 | # Uncomment the following line to disable auto-setting terminal title. 31 | # DISABLE_AUTO_TITLE="true" 32 | 33 | # Uncomment the following line to enable command auto-correction. 34 | # ENABLE_CORRECTION="true" 35 | 36 | # Uncomment the following line to display red dots whilst waiting for completion. 37 | # COMPLETION_WAITING_DOTS="true" 38 | 39 | # Uncomment the following line if you want to disable marking untracked files 40 | # under VCS as dirty. This makes repository status check for large repositories 41 | # much, much faster. 42 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 43 | 44 | # Uncomment the following line if you want to change the command execution time 45 | # stamp shown in the history command output. 46 | # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 47 | # HIST_STAMPS="mm/dd/yyyy" 48 | 49 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 50 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 51 | # Example format: plugins=(rails git textmate ruby lighthouse) 52 | # Add wisely, as too many plugins slow down shell startup. 53 | plugins=(git brew node npm docker encode64 github pip python virtualenv extract colored-man-pages screen web-search zsh-autosuggestions) 54 | 55 | source $ZSH/oh-my-zsh.sh 56 | 57 | # User configuration 58 | export LANG=en_US.UTF-8 59 | export EDITOR=vim 60 | alias zshconfig="mate ~/.zshrc" 61 | alias ohmyzsh="mate ~/.oh-my-zsh" 62 | alias grep='grep --color=auto' 63 | 64 | # Compilation flags 65 | # export ARCHFLAGS="-arch x86_64" 66 | -------------------------------------------------------------------------------- /zsh/zshrc-mac.conf: -------------------------------------------------------------------------------- 1 | # If you come from bash you might have to change your $PATH. 2 | export PATH=$HOME/bin:/usr/local/bin:$PATH 3 | 4 | # homebrew 5 | path=('/opt/homebrew/bin' $path) 6 | export PATH 7 | 8 | # Golang paths 9 | export GOPATH=$HOME/go 10 | export PATH=$PATH:$HOME/goes/go/bin:$GOPATH/bin 11 | 12 | # Path to your oh-my-zsh installation. 13 | export ZSH=~/.oh-my-zsh 14 | 15 | # Set name of the theme to load. Optionally, if you set this to "random" 16 | # it'll load a random theme each time that oh-my-zsh is loaded. 17 | # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 18 | ZSH_THEME="changkun" 19 | TERM=xterm-256color 20 | 21 | # Uncomment the following line to use case-sensitive completion. 22 | # CASE_SENSITIVE="true" 23 | 24 | # Uncomment the following line to use hyphen-insensitive completion. Case 25 | # sensitive completion must be off. _ and - will be interchangeable. 26 | # HYPHEN_INSENSITIVE="true" 27 | 28 | # Uncomment the following line to disable bi-weekly auto-update checks. 29 | # DISABLE_AUTO_UPDATE="true" 30 | 31 | # Uncomment the following line to change how often to auto-update (in days). 32 | export UPDATE_ZSH_DAYS=13 33 | 34 | # Uncomment the following line to disable auto-setting terminal title. 35 | # DISABLE_AUTO_TITLE="true" 36 | 37 | # Uncomment the following line to enable command auto-correction. 38 | # ENABLE_CORRECTION="true" 39 | 40 | # Uncomment the following line to display red dots whilst waiting for completion. 41 | # COMPLETION_WAITING_DOTS="true" 42 | 43 | # Uncomment the following line if you want to disable marking untracked files 44 | # under VCS as dirty. This makes repository status check for large repositories 45 | # much, much faster. 46 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 47 | 48 | # Uncomment the following line if you want to change the command execution time 49 | # stamp shown in the history command output. 50 | # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 51 | # HIST_STAMPS="mm/dd/yyyy" 52 | 53 | # autojump 54 | [[ -s $HOME/.autojump/etc/profile.d/autojump.sh ]] && source $HOME/.autojump/etc/profile.d/autojump.sh 55 | autoload -U compinit && compinit -u 56 | 57 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 58 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 59 | # Example format: plugins=(rails git textmate ruby lighthouse) 60 | # Add wisely, as too many plugins slow down shell startup. 61 | plugins=(git brew node npm docker encode64 github pip python virtualenv extract colored-man-pages screen web-search zsh-autosuggestions autojump) 62 | 63 | source $ZSH/oh-my-zsh.sh 64 | 65 | # User configuration 66 | export LANG=en_US.UTF-8 67 | export EDITOR=vim 68 | export SSH_KEY_PATH="~/.ssh/id_rsa" 69 | # bindkey -v # use vim key bindings 70 | 71 | # Command aliases 72 | alias zshconfig="mate ~/.zshrc" 73 | alias ohmyzsh="mate ~/.oh-my-zsh" 74 | alias grep='grep --color=auto' 75 | alias vi='mvim -v' 76 | alias vim='mvim -v' 77 | alias rm='rmtrash' 78 | 79 | # Compilation flags 80 | # export ARCHFLAGS="-arch x86_64" 81 | -------------------------------------------------------------------------------- /vim/ycm_extra_conf.py: -------------------------------------------------------------------------------- 1 | import os 2 | import ycm_core 3 | 4 | # These are the compilation flags that will be used in case there's no 5 | # compilation database set (by default, one is not set). 6 | # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. 7 | flags = [ 8 | '-Wall', 9 | '-Wextra', 10 | '-Werror', 11 | '-Wno-long-long', 12 | '-Wno-variadic-macros', 13 | '-fexceptions', 14 | # THIS IS IMPORTANT! Without a "-std=" flag, clang won't know which 15 | # language to use when compiling headers. So it will guess. Badly. So C++ 16 | # headers will be compiled as C headers. You don't want that so ALWAYS specify 17 | # a "-std=". 18 | # For a C project, you would set this to something like 'c99' instead of 19 | # 'c++11'. 20 | '-std=c++14', 21 | # ...and the same thing goes for the magic -x option which specifies the 22 | # language that the files to be compiled are written in. This is mostly 23 | # relevant for c++ headers. 24 | # For a C project, you would set this to 'c' instead of 'c++'. 25 | '-x', 'c++', 26 | # This path will only work on OS X, but extra paths that don't exist are not 27 | # harmful 28 | '-isystem', '/System/Library/Frameworks/Python.framework/Headers', 29 | '-isystem', '/usr/local/include', 30 | '-isystem', '/usr/local/include/eigen3', 31 | '-I', 'include', 32 | '-I.', 33 | ] 34 | 35 | # Set this to the absolute path to the folder (NOT the file!) containing the 36 | # compile_commands.json file to use that instead of 'flags'. See here for 37 | # more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html 38 | # 39 | # Most projects will NOT need to set this to anything; you can just change the 40 | # 'flags' list of compilation flags. Notice that YCM itself uses that approach. 41 | compilation_database_folder = '' 42 | 43 | if compilation_database_folder: 44 | database = ycm_core.CompilationDatabase( compilation_database_folder ) 45 | else: 46 | database = None 47 | 48 | 49 | def DirectoryOfThisScript(): 50 | return os.path.dirname( os.path.abspath( __file__ ) ) 51 | 52 | 53 | def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): 54 | if not working_directory: 55 | return list( flags ) 56 | new_flags = [] 57 | make_next_absolute = False 58 | path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] 59 | for flag in flags: 60 | new_flag = flag 61 | 62 | if make_next_absolute: 63 | make_next_absolute = False 64 | if not flag.startswith( '/' ): 65 | new_flag = os.path.join( working_directory, flag ) 66 | 67 | for path_flag in path_flags: 68 | if flag == path_flag: 69 | make_next_absolute = True 70 | break 71 | 72 | if flag.startswith( path_flag ): 73 | path = flag[ len( path_flag ): ] 74 | new_flag = path_flag + os.path.join( working_directory, path ) 75 | break 76 | 77 | if new_flag: 78 | new_flags.append( new_flag ) 79 | return new_flags 80 | 81 | 82 | def FlagsForFile( filename ): 83 | if database: 84 | # Bear in mind that compilation_info.compiler_flags_ does NOT return a 85 | # python list, but a "list-like" StringVec object 86 | compilation_info = database.GetCompilationInfoForFile( filename ) 87 | final_flags = MakeRelativePathsInFlagsAbsolute( 88 | compilation_info.compiler_flags_, 89 | compilation_info.compiler_working_dir_ ) 90 | else: 91 | # relative_to = DirectoryOfThisScript() 92 | relative_to = os.path.dirname(os.path.abspath(filename)) 93 | final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) 94 | 95 | return { 96 | 'flags': final_flags, 97 | 'do_cache': True 98 | } 99 | -------------------------------------------------------------------------------- /devices/windows.md: -------------------------------------------------------------------------------- 1 | # Required Dev Softwares 2 | 3 | *If otherwise specified, all software should install the latested version at installation time.* 4 | 5 | This setup is for the following dev environments: 6 | 7 | - C/C++ 8 | - Go 9 | - Python 10 | - Nodejs 11 | 12 | Disclaimer: There may be other softwares needed that are not listed here. 13 | 14 | ## Details 15 | 16 | Window Subsystem for Linux: 17 | 18 | - `wsl --install Ubuntu-20.04` https://docs.microsoft.com/en-us/windows/wsl/install-win10 19 | - `wsl --set-default-version 2` enable WSL2 20 | - Enable host file system access: 21 | 22 | ``` 23 | # see https://askubuntu.com/questions/1115564/wsl-ubuntu-distro-how-to-solve-operation-not-permitted-on-cloning-repository 24 | sudo umount /mnt/c 25 | sudo mount -t drvfs C: /mnt/c -o metadata 26 | ``` 27 | 28 | Remote Login: 29 | 30 | - OpenSSH: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse 31 | - service -> SSH server enable (in system service manager) 32 | - Tailscale: https://tailscale.com/download 33 | 34 | NVIDIA driver & SDKs: 35 | 36 | - NVIDIA driver: https://www.nvidia.com/Download/index.aspx 37 | - CUDA https://developer.nvidia.com/cuda-downloads 38 | - cuDNN: https://developer.nvidia.com/cudnn 39 | - cuBLAS, cuSOLVER, cuFFT...: https://developer.nvidia.com/hpc-sdk 40 | - DALI: https://github.com/NVIDIA/dali 41 | - Nsight: https://developer.nvidia.com/nsight-visual-studio-edition 42 | - CUDA WSL2 support (Need Windows Insider Program): 43 | + This looks to risky, maybe not (?). 44 | + https://developer.nvidia.com/cuda/wsl/download 45 | + https://docs.nvidia.com/cuda/wsl-user-guide/index.html 46 | 47 | Essentials: 48 | 49 | - Go: https://golang.org/dl/ 50 | - NodeJS: https://nodejs.org/en/download/ 51 | - Python3: https://www.python.org/downloads/ 52 | - Python3-pip: 53 | - Docker: https://docs.docker.com/desktop/windows/install/ 54 | - Docker Compose: https://docs.docker.com/compose/install/ 55 | - Chromium (nightly, with webgpu support): https://www.google.com/intl/en/chrome/canary/ 56 | + check success: https://webgpureport.org/ 57 | - Houdini: https://www.sidefx.com/download/ 58 | - Visual Studio Code: https://code.visualstudio.com/ 59 | - Blender: https://www.blender.org/download/ 60 | - Visual Studio Community: https://visualstudio.microsoft.com/vs/community/ 61 | - workloads: 62 | + web & cloud: 63 | * python development 64 | * nodejs development 65 | + desktop & mobile 66 | * .NET desktop development 67 | * desktop development with C++ 68 | * mobile development with .NET 69 | * mobile development with C++ 70 | + Gaming 71 | * game development with unity 72 | * game development with C++ 73 | + Other toolsets 74 | * Data science analytical applications 75 | * Linux development with C++ 76 | - Unity 77 | - 2020.3.18f1 for LTS 78 | - 2021.1.20f1 for Visual Scripting 79 | - Unreal Engine 80 | - 4.26.x for LTS 81 | - 5.0.x for Nanite and Lumen system 82 | 83 | Good to have: 84 | 85 | - klatexformula: https://klatexformula.sourceforge.io/downloads 86 | - typora: https://typora.io/ 87 | 88 | Other Dev tool(chain): 89 | 90 | - choco: https://docs.chocolatey.org/en-us/choco/setup 91 | - git 92 | - make 93 | - cmake 94 | - mingw: for gcc 95 | - llvm: for clang 96 | - vim: good to have 97 | - graphviz: https://graphviz.org/ 98 | - JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 99 | - Android Studio: https://developer.android.com/studio 100 | - Postman: https://www.getpostman.com/apps, good to have 101 | - SourceTree: https://www.sourcetreeapp.com, good to have 102 | - httpie: good to have 103 | - vegeta: good to have 104 | - mongodb-community: good to have 105 | - redis: good to have 106 | 107 | ## Fonts 108 | 109 | ``` 110 | # fonts 111 | git clone https://github.com/powerline/fonts.git --depth=1 112 | cd fonts && ./install.sh && cd .. && rm -rf fonts 113 | ``` 114 | -------------------------------------------------------------------------------- /devices/ubuntu.md: -------------------------------------------------------------------------------- 1 | 2 | # Linux (Ubuntu Distribution) 3 | 4 | ## System Preference 5 | 6 | - English system language 7 | - Dark Theme 8 | 9 | ## Software List 10 | 11 | - NVIDIA driver 12 | - CUDA https://developer.nvidia.com/cuda-downloads 13 | - Chromium 14 | - Visual Studio Code https://code.visualstudio.com/ 15 | - Telegram 16 | - Blender https://www.blender.org/download/ 17 | - Zoom https://zoom.us/download 18 | - MeshLab https://www.meshlab.net/#download 19 | - Maya 20 | - Houdini 21 | - Terminus https://github.com/Eugeny/terminus 22 | - iCALDAV Calendar: https://p12-caldav.icloud.com 23 | - 1Password X https://support.1password.com/explore/linux/ 24 | - Mendeley https://www.mendeley.com/download-desktop/ 25 | - Typora https://typora.io/#linux 26 | - sudo apt install fcitx-googlepinyin 27 | - Remmnia: VNC access to macOS 28 | - Email: Thunderbird Mail 29 | - Dropbox: https://www.dropbox.com/install 30 | - klatexformula: https://klatexformula.sourceforge.io/downloads 31 | - perflock: https://github.com/aclements/perflock 32 | - benchstat: https://pkg.go.dev/golang.org/x/perf/cmd/benchstat 33 | - Docker: https://docs.docker.com/engine/install/ubuntu/ 34 | - Docker-compose: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04 35 | - LRZ VPN: https://www.lrz.de/services/netz/mobil/vpnpda/ 36 | - LRZ VPN: https://www.lrz.de/services/netz/mobil/vpnclient/ 37 | - Chinese font setting: https://www.synscope.com/1015/ubuntu%E4%BF%AE%E5%A4%8D%E4%B8%AD%E6%96%87%E5%AD%97%E4%BD%93%E6%B8%B2%E6%9F%93%E9%97%AE%E9%A2%98/ 38 | - k3s: https://k3s.io/ 39 | 40 | # Security Settings 41 | 42 | Firewall: 43 | 44 | ``` 45 | sudo ufw default deny incoming 46 | sudo ufw default allow outgoing 47 | sudo ufw allow 22022 48 | sudo ufw allow 80/tcp 49 | sudo ufw allow 443/tcp 50 | sudo ufw allow 60000:61000/udp 51 | sudo ufw enable 52 | sudo ufw status verbose 53 | 54 | Status: active 55 | Logging: on (low) 56 | Default: deny (incoming), allow (outgoing), deny (routed) 57 | New profiles: skip 58 | 59 | To Action From 60 | -- ------ ---- 61 | 22022 ALLOW IN Anywhere 62 | 60000:61000/udp ALLOW IN Anywhere 63 | 80/tcp ALLOW IN Anywhere 64 | 443/tcp ALLOW IN Anywhere 65 | 22022 (v6) ALLOW IN Anywhere (v6) 66 | 60000:61000/udp (v6) ALLOW IN Anywhere (v6) 67 | 80/tcp (v6) ALLOW IN Anywhere (v6) 68 | 443/tcp (v6) ALLOW IN Anywhere (v6) 69 | ``` 70 | 71 | SSH: 72 | 73 | ``` 74 | # /etc/ssh/sshd_config 75 | Port 22022 76 | PubkeyAuthentication yes 77 | PasswordAuthentication no 78 | PermitEmptyPasswords no 79 | ``` 80 | 81 | Note that docker containers change iptables that are not reflected in ufw. 82 | See https://askubuntu.com/questions/652556/uncomplicated-firewall-ufw-is-not-blocking-anything-when-using-docker. 83 | 84 | Modify the UFW configuration file /etc/ufw/after.rules and add the following rules at the end of the file: 85 | 86 | ``` 87 | # BEGIN UFW AND DOCKER 88 | *filter 89 | :ufw-user-forward - [0:0] 90 | :ufw-docker-logging-deny - [0:0] 91 | :DOCKER-USER - [0:0] 92 | -A DOCKER-USER -j ufw-user-forward 93 | 94 | -A DOCKER-USER -j RETURN -s 10.0.0.0/8 95 | -A DOCKER-USER -j RETURN -s 172.16.0.0/12 96 | -A DOCKER-USER -j RETURN -s 192.168.0.0/16 97 | 98 | -A DOCKER-USER -p udp -m udp --sport 53 --dport 1024:65535 -j RETURN 99 | 100 | -A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 192.168.0.0/16 101 | -A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 10.0.0.0/8 102 | -A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 172.16.0.0/12 103 | -A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 192.168.0.0/16 104 | -A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 10.0.0.0/8 105 | -A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 172.16.0.0/12 106 | 107 | -A DOCKER-USER -j RETURN 108 | 109 | -A ufw-docker-logging-deny -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW DOCKER BLOCK] " 110 | -A ufw-docker-logging-deny -j DROP 111 | 112 | COMMIT 113 | # END UFW AND DOCKER 114 | ``` 115 | 116 | Go Modules under private domain: 117 | 118 | ``` 119 | export GOPRIVATE=my.domain.com/x 120 | git config --global url."git@github.com:".insteadOf "https://github.com/" 121 | ``` -------------------------------------------------------------------------------- /vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | // general editor settings 3 | "terminal.external.osxExec": "iTerm.app", 4 | "editor.lineNumbers": "on", 5 | "editor.fontSize": 12, 6 | "editor.rulers": [72, 120], 7 | "editor.wordWrap": "bounded", 8 | "editor.wordWrapColumn": 100, 9 | "editor.minimap.enabled": true, 10 | "window.nativeTabs": false, 11 | "editor.renderWhitespace":"boundary", 12 | 13 | // languages 14 | "[python]": { 15 | "editor.tabSize": 4, 16 | "editor.formatOnSave": false 17 | }, 18 | "[vue]": { 19 | "editor.tabSize": 2 20 | }, 21 | "[c]": { 22 | "editor.tabSize": 4 23 | }, 24 | "[cpp]": { 25 | "editor.tabSize": 4 26 | }, 27 | "[dockerfile]": { 28 | "editor.tabSize": 2 29 | }, 30 | "[javascript]": { 31 | "editor.tabSize": 2 32 | }, 33 | "[javascriptreact]": { 34 | "editor.tabSize": 2 35 | }, 36 | "[typescriptreact]": { 37 | "editor.tabSize": 2 38 | }, 39 | "[latex]": { 40 | "editor.wordWrapColumn": 100, 41 | "editor.tabSize": 4 42 | }, 43 | "[shellscript]": { 44 | }, 45 | "[makefile]": { 46 | }, 47 | "[yaml]": { 48 | "editor.tabSize": 2, 49 | }, 50 | "[json]": { 51 | "editor.wordWrapColumn": 5000, 52 | }, 53 | "[markdown]": { 54 | "editor.tabSize": 4, 55 | "editor.wordWrap": "bounded", 56 | "editor.wordWrapColumn": 100, 57 | }, 58 | 59 | // linting style, provider: pylint, pep8, flake8, mypy, pylama 60 | "python.linting.enabled": true, 61 | "python.linting.lintOnSave": true, 62 | "python.linting.maxNumberOfProblems": 50, 63 | "python.linting.pylintArgs": ["--errors-only"], 64 | "python.linting.pycodestyleEnabled": false, 65 | "python.linting.flake8Enabled": false, 66 | "python.linting.mypyEnabled": false, 67 | "python.linting.pylamaEnabled": false, 68 | 69 | // virtual env 70 | // "python.venvPath": "venv/bin/python", 71 | 72 | // auto-formatting, provider: autopep8 or yapf, install use pip 73 | 74 | // auto-complete 75 | "python.autoComplete.extraPaths": [ 76 | "/usr/local/lib/python3.6/site-packages", 77 | "/usr/local/lib/python3.7/site-packages" 78 | ], 79 | 80 | // jupyter settings 81 | "python.jupyter.defaultKernel": "Python 3", 82 | "python.jupyter.startupCode": [ 83 | "%matplotlib inline" 84 | ], 85 | "python.jupyter.appendResults": true, 86 | "jupyter.appendResults": true, 87 | "jupyter.notebook.startupArgs": [ 88 | "--no-browser", 89 | "--port=8888", 90 | "--NotebookApp.allow_origin=\"*\"" 91 | ], 92 | 93 | // pandoc 94 | "pandoc.pdfOptString": "--latex-engine=xelatex --listings", 95 | "terminal.integrated.commandsToSkipShell": [ 96 | "editor.action.toggleTabFocusMode", 97 | "workbench.action.debug.continue", 98 | "workbench.action.debug.pause", 99 | "workbench.action.debug.restart", 100 | "workbench.action.debug.run", 101 | "workbench.action.debug.start", 102 | "workbench.action.debug.stop", 103 | "workbench.action.focusActiveEditorGroup", 104 | "workbench.action.focusFirstEditorGroup", 105 | "workbench.action.focusSecondEditorGroup", 106 | "workbench.action.focusThirdEditorGroup", 107 | "workbench.action.openNextRecentlyUsedEditorInGroup", 108 | "workbench.action.openPreviousRecentlyUsedEditorInGroup", 109 | "workbench.action.quickOpen", 110 | "workbench.action.showCommands", 111 | "workbench.action.terminal.clear", 112 | "workbench.action.terminal.copySelection", 113 | "workbench.action.terminal.focus", 114 | "workbench.action.terminal.focusAtIndex1", 115 | "workbench.action.terminal.focusAtIndex2", 116 | "workbench.action.terminal.focusAtIndex3", 117 | "workbench.action.terminal.focusAtIndex4", 118 | "workbench.action.terminal.focusAtIndex5", 119 | "workbench.action.terminal.focusAtIndex6", 120 | "workbench.action.terminal.focusAtIndex7", 121 | "workbench.action.terminal.focusAtIndex8", 122 | "workbench.action.terminal.focusAtIndex9", 123 | "workbench.action.terminal.focusNext", 124 | "workbench.action.terminal.focusPrevious", 125 | "workbench.action.terminal.kill", 126 | "workbench.action.terminal.new", 127 | "workbench.action.terminal.paste", 128 | "workbench.action.terminal.runActiveFile", 129 | "workbench.action.terminal.runSelectedText", 130 | "workbench.action.terminal.scrollDown", 131 | "workbench.action.terminal.scrollDownPage", 132 | "workbench.action.terminal.scrollToBottom", 133 | "workbench.action.terminal.scrollToTop", 134 | "workbench.action.terminal.scrollUp", 135 | "workbench.action.terminal.scrollUpPage", 136 | "workbench.action.terminal.toggleTerminal" 137 | ], 138 | "terminal.integrated.scrollback": 100000, 139 | "window.zoomLevel": 1, 140 | "latex-workshop.chktex.enabled": false, 141 | "explorer.confirmDragAndDrop": false, 142 | "problems.decorations.enabled": true, 143 | "material-icon-theme.folders.theme": "specific", 144 | "extensions.ignoreRecommendations": true, 145 | "go.buildOnSave": "off", 146 | "go.testTimeout": "60m", 147 | "go.testFlags": [ 148 | "-v", 149 | "-race" 150 | ], 151 | "breadcrumbs.enabled": true, 152 | "files.autoSave": "off", 153 | "explorer.confirmDelete": false, 154 | "git.autofetch": true, 155 | "javascript.updateImportsOnFileMove.enabled": "always", 156 | "latex-workshop.latex.autoBuild.run": "never", 157 | "latex-workshop.latex.autoClean.run": "onBuilt", 158 | "C_Cpp.updateChannel": "Insiders", 159 | "vsicons.dontShowNewVersionMessage": true, 160 | "go.formatTool": "goimports", 161 | "editor.fontFamily": "'Source Code Pro for Powerline', Menlo, Monaco, 'Courier New', monospace", 162 | "diffEditor.ignoreTrimWhitespace": false, 163 | "workbench.iconTheme": "vscode-icons", 164 | "go.gopath": "~/go", 165 | "go.goroot": "~/goes/go", 166 | "files.associations": { 167 | "*.go2": "go" 168 | }, 169 | "workbench.editor.scrollToSwitchTabs": true, 170 | "latex-workshop.view.pdf.viewer": "tab", 171 | "glsl-linter.validatorPath": "/usr/local/bin/glslangValidator", 172 | "glsl-linter.fileExtensions": { 173 | ".fs.glsl": "frag", 174 | ".vs.glsl": "vert", 175 | ".tes.glsl": "tese", 176 | ".tcs.glsl": "tesc", 177 | ".gs.glsl": "geom" 178 | }, 179 | "editor.codeActionsOnSave": { 180 | "source.fixAll.eslint": true 181 | }, 182 | "window.autoDetectColorScheme": true, 183 | "grammarly.userWords": [ 184 | "Changkun", 185 | "GothamGo", 186 | "funcdata", 187 | "gccgo", 188 | "golang", 189 | "mcache", 190 | "mcentral", 191 | "percpu", 192 | "pprof", 193 | "redir", 194 | "redis", 195 | "tcmalloc", 196 | "url" 197 | ], 198 | "grammarly.autoActivate": false, 199 | } -------------------------------------------------------------------------------- /devices/mac.md: -------------------------------------------------------------------------------- 1 | # macOS 2 | 3 | - For dotfiles, simplely run [mac-install.sh](../mac-install.sh) to install all dotfiles, it will setup zsh+tmux+vim environment for Python/JS/C/C++; 4 | - For system settings, perform all the following checklist item. 5 | 6 | ### System Preference 7 | 8 | - **English** as Default language 9 | - **Dark** Theme 10 | - **Dock** Size Small/Disable Magnification/Left Position/Genie effect/Double-click title bar to minimize 11 | - **Finder** enable TabBar+StatusBar+PathBar (View -> Show [TabBar|StatusBar|PathBar]) 12 | - **.ssh_config** 13 | - **Global Keyboard Shortcuts** 14 | - control + space: Spotlight 15 | - option + space: Eudict 16 | - shift + space: Dehelper 17 | - command + space: Input Method 18 | - ABC - Extended 19 | - option+s: ß 20 | - option+u, with a/u/o: ä/ü/ö 21 | - **Trackpad Gestures** 22 | - Tap click 23 | - Secondary click 24 | - Three fingers drag 25 | - Three fingers tap 26 | - **Additional System Fonts** 27 | - Powerline Font: https://github.com/changkun/fonts 28 | 29 | ### General 30 | 31 | - Dropbox: https://www.dropbox.com/install 32 | - Chrome: https://www.google.com/chrome/index.html 33 | - **Eudict**: http://www.eudic.net/eudic/mac_dictionary.aspx 34 | - **Dehelper**: http://www.francochinois.com/Dehelper/mac.aspx 35 | - **Grammarly**: https://www.grammarly.com/native/mac 36 | - **IINA**: https://github.com/lhc70000/iina 37 | - **1Password**: AppStore 38 | - **WeChat**: AppStore 39 | - **Telegram**: AppStore 40 | - **Photoshop** (**Affinity Photo**): AppStore 41 | 42 | ### Development 43 | 44 | - **iTerm2**: https://www.iterm2.com 45 | - Color Presets: [changkun.itermcolors](../iterm2/changkun.itermcolors) 46 | - Profile: [com.googlecode.iterm2.plist](../iterm2/com.googlecode.iterm2.plist) 47 | - Key-binding: [keys.itermkeymap](../iterm2/keys.itermkeymap) 48 | - **send text at start** tmux attach -d -t dev || tmux new -s dev 49 | - **Cusor** Underline 50 | - **Font** 16pt Ubuntu Mono derivative Powerline 51 | - **Text Rendering** Disable Draw bold in bold font 52 | - **Text Rendering** Disable Draw bold in bright colors 53 | - **Text Rendering** Enable Draw anti-aliased text with thin strokes 54 | - **Window appearence** Transparency to 15% 55 | - **Window appearence** Blur to 40% 56 | - **Terminal Emulation** Unicode (UTF-8), xterm-256color 57 | - VSCode: https://code.visualstudio.com 58 | - Xcode: AppStore 59 | - Docker for Mac: https://docs.docker.com/docker-for-mac/ 60 | 61 | ### Environment 62 | 63 | - **Bash**: 64 | - oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh 65 | - brew: https://brew.sh 66 | - VIM: 67 | - [.vimrc](../.vimrc) 68 | - TMUX: 69 | - [tmux.conf](../tmux.conf) 70 | - [tmux.conf.local](../tmux.conf.local) 71 | - VSCode: code --list-extensions | xargs -L 1 echo code --install-extension 72 | ``` 73 | code --install-extension bungcip.better-toml 74 | code --install-extension circledev.glsl-canvas 75 | code --install-extension dbaeumer.vscode-eslint 76 | code --install-extension donjayamanne.jupyter 77 | code --install-extension eamodio.gitlens 78 | code --install-extension Equinusocio.vsc-community-material-theme 79 | code --install-extension Equinusocio.vsc-material-theme 80 | code --install-extension equinusocio.vsc-material-theme-icons 81 | code --install-extension eriklynd.json-tools 82 | code --install-extension felipe-mendes.slack-theme 83 | code --install-extension felixfbecker.php-intellisense 84 | code --install-extension formulahendry.vscode-mysql 85 | code --install-extension golang.go 86 | code --install-extension James-Yu.latex-workshop 87 | code --install-extension janisdd.vscode-edit-csv 88 | code --install-extension johnstoncode.svn-scm 89 | code --install-extension maelvalais.autoconf 90 | code --install-extension mechatroner.rainbow-csv 91 | code --install-extension mrjjot.vscode-glsl-linter 92 | code --install-extension ms-azuretools.vscode-docker 93 | code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools 94 | code --install-extension ms-python.python 95 | code --install-extension ms-toolsai.jupyter 96 | code --install-extension ms-vscode-remote.remote-ssh 97 | code --install-extension ms-vscode-remote.remote-ssh-edit 98 | code --install-extension ms-vscode.cpptools 99 | code --install-extension njpwerner.autodocstring 100 | code --install-extension octref.vetur 101 | code --install-extension PKief.material-icon-theme 102 | code --install-extension PsykoSoldi3r.itunes-vscode 103 | code --install-extension quillaja.goasm 104 | code --install-extension redhat.vscode-yaml 105 | code --install-extension rust-lang.rust 106 | code --install-extension slevesque.shader 107 | code --install-extension tomoki1207.pdf 108 | code --install-extension vscode-icons-team.vscode-icons 109 | code --install-extension vscodevim.vim 110 | code --install-extension WakaTime.vscode-wakatime 111 | code --install-extension wayou.vscode-todo-highlight 112 | code --install-extension yzhang.markdown-all-in-one 113 | code --install-extension zhouronghui.propertylist 114 | code --install-extension znck.grammarly 115 | code --install-extension zxh404.vscode-proto3 116 | ``` 117 | 118 | ### Writing 119 | 120 | - Typora: https://typora.io 121 | - MacTeX: http://www.tug.org/mactex/mactex-download.html 122 | - Klatexformula: https://klatexformula.sourceforge.io/downloads 123 | - MindNode: AppStore 124 | - OmniGraffle: AppStore 125 | - PDF Expert: AppStore 126 | - Mendeley: https://www.mendeley.com/download-mendeley-desktop/ 127 | - Zotero: https://www.zotero.org/download/ 128 | + Plugin Zotfile: http://zotfile.com/ 129 | + Config: base directory to dropbox, zotfile source folder from download, and location of files to dropbox (automatic move). 130 | + Use subfolders: `/%c` on macOS/Linux, `\\%c` on windows 131 | + Rename rules: `{%y-}{%a-}{%t}` 132 | + Delimiter between multiple lines `-` 133 | + Change to lower case 134 | + Replace blanks 135 | + Truncate title after `.` or `:` or `?` 136 | + Maximum length of title 80 137 | + Maximum number of authors 2 138 | + Add suffix when authors are omitted `etal` 139 | 140 | ### Utils 141 | 142 | - ShadowsocksX-NG: https://github.com/shadowsocks/ShadowsocksX-NG 143 | - The Unarchiver: AppStore 144 | - Things 3: AppStore 145 | - iStatu Menu: https://bjango.com/mac/istatmenus/ 146 | - Bartender: https://www.macbartender.com 147 | - Alfred: https://www.alfredapp.com 148 | - Zoom: https://zoom.us/ 149 | 150 | ### Optional 151 | 152 | - Blender: https://www.blender.org/download/ 153 | - MeshLab: http://www.meshlab.net/#download 154 | - CUDA: https://developer.nvidia.com/cuda-downloads 155 | - cuDNN: https://developer.nvidia.com/cudnn 156 | - JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 157 | - Xcode: AppStore 158 | - OBS: https://obsproject.com/download 159 | - Medis: https://github.com/luin/medis/releases/tag/v0.5.0 160 | - Sequel Pro: https://sequelpro.com/download 161 | - HandBrake: https://handbrake.fr/downloads.php 162 | - Adobe Acrobat Reader (for special purpose) 163 | - Office: https://stores.office.com/myaccount/home.aspx#install 164 | - Postman: https://www.getpostman.com/apps 165 | - Dash: https://kapeli.com/dash 166 | - Robo 3T: https://robomongo.org/ 167 | - SourceTree: https://www.sourcetreeapp.com 168 | - Discord: https://discord.com/download 169 | - Gifski: AppStore 170 | 171 | ### Entertainment 172 | 173 | - Minecraft: https://minecraft.net 174 | - Steam: http://steampowered.com 175 | - YYets: http://app.rrys.tv/ 176 | -------------------------------------------------------------------------------- /iterm2/changkun.itermcolors: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansi 0 Color 6 | 7 | Alpha Component 8 | 1 9 | Blue Component 10 | 0.0 11 | Color Space 12 | Calibrated 13 | Green Component 14 | 0.0 15 | Red Component 16 | 0.0 17 | 18 | Ansi 1 Color 19 | 20 | Alpha Component 21 | 1 22 | Blue Component 23 | 0.18665386736392975 24 | Color Space 25 | Calibrated 26 | Green Component 27 | 0.31231138110160828 28 | Red Component 29 | 0.86485648155212402 30 | 31 | Ansi 10 Color 32 | 33 | Alpha Component 34 | 1 35 | Blue Component 36 | 0.35121414065361023 37 | Color Space 38 | Calibrated 39 | Green Component 40 | 0.72937816381454468 41 | Red Component 42 | 0.49721947312355042 43 | 44 | Ansi 11 Color 45 | 46 | Alpha Component 47 | 1 48 | Blue Component 49 | 0.3333333432674408 50 | Color Space 51 | Calibrated 52 | Green Component 53 | 1 54 | Red Component 55 | 1 56 | 57 | Ansi 12 Color 58 | 59 | Alpha Component 60 | 1 61 | Blue Component 62 | 0.95373213291168213 63 | Color Space 64 | Calibrated 65 | Green Component 66 | 0.5604100227355957 67 | Red Component 68 | 0.36309865117073059 69 | 70 | Ansi 13 Color 71 | 72 | Alpha Component 73 | 1 74 | Blue Component 75 | 0.75484597682952881 76 | Color Space 77 | Calibrated 78 | Green Component 79 | 0.51216816902160645 80 | Red Component 81 | 0.97994524240493774 82 | 83 | Ansi 14 Color 84 | 85 | Alpha Component 86 | 1 87 | Blue Component 88 | 0.90565776824951172 89 | Color Space 90 | Calibrated 91 | Green Component 92 | 0.80690312385559082 93 | Red Component 94 | 0.47083443403244019 95 | 96 | Ansi 15 Color 97 | 98 | Alpha Component 99 | 1 100 | Blue Component 101 | 1 102 | Color Space 103 | Calibrated 104 | Green Component 105 | 1 106 | Red Component 107 | 1 108 | 109 | Ansi 2 Color 110 | 111 | Alpha Component 112 | 1 113 | Blue Component 114 | 0.22786164283752441 115 | Color Space 116 | Calibrated 117 | Green Component 118 | 0.74287182092666626 119 | Red Component 120 | 0.42205339670181274 121 | 122 | Ansi 3 Color 123 | 124 | Alpha Component 125 | 1 126 | Blue Component 127 | 0.17459605634212494 128 | Color Space 129 | Calibrated 130 | Green Component 131 | 0.84299170970916748 132 | Red Component 133 | 0.90120565891265869 134 | 135 | Ansi 4 Color 136 | 137 | Alpha Component 138 | 1 139 | Blue Component 140 | 0.98870241641998291 141 | Color Space 142 | Calibrated 143 | Green Component 144 | 0.43747854232788086 145 | Red Component 146 | 0.14751617610454559 147 | 148 | Ansi 5 Color 149 | 150 | Alpha Component 151 | 1 152 | Blue Component 153 | 0.7253117561340332 154 | Color Space 155 | Calibrated 156 | Green Component 157 | 0.34603607654571533 158 | Red Component 159 | 0.95038461685180664 160 | 161 | Ansi 6 Color 162 | 163 | Alpha Component 164 | 1 165 | Blue Component 166 | 0.85335952043533325 167 | Color Space 168 | Calibrated 169 | Green Component 170 | 0.69620096683502197 171 | Red Component 172 | 0.22087787091732025 173 | 174 | Ansi 7 Color 175 | 176 | Alpha Component 177 | 1 178 | Blue Component 179 | 0.73333334922790527 180 | Color Space 181 | Calibrated 182 | Green Component 183 | 0.73333334922790527 184 | Red Component 185 | 0.73333334922790527 186 | 187 | Ansi 8 Color 188 | 189 | Alpha Component 190 | 1 191 | Blue Component 192 | 0.33333333333333331 193 | Color Space 194 | Calibrated 195 | Green Component 196 | 0.33333333333333331 197 | Red Component 198 | 0.33333333333333331 199 | 200 | Ansi 9 Color 201 | 202 | Alpha Component 203 | 1 204 | Blue Component 205 | 0.3913804292678833 206 | Color Space 207 | Calibrated 208 | Green Component 209 | 0.4961114227771759 210 | Red Component 211 | 0.88426637649536133 212 | 213 | Background Color 214 | 215 | Alpha Component 216 | 1 217 | Blue Component 218 | 0.14622637629508972 219 | Color Space 220 | Calibrated 221 | Green Component 222 | 0.087520182132720947 223 | Red Component 224 | 0.066731743514537811 225 | 226 | Badge Color 227 | 228 | Alpha Component 229 | 0.457366943359375 230 | Blue Component 231 | 0.37474671006202698 232 | Color Space 233 | Calibrated 234 | Green Component 235 | 0.98996305465698242 236 | Red Component 237 | 1 238 | 239 | Bold Color 240 | 241 | Alpha Component 242 | 1 243 | Blue Component 244 | 1 245 | Color Space 246 | Calibrated 247 | Green Component 248 | 1 249 | Red Component 250 | 1 251 | 252 | Cursor Color 253 | 254 | Alpha Component 255 | 1 256 | Blue Component 257 | 0.99999129772186279 258 | Color Space 259 | Calibrated 260 | Green Component 261 | 0.99997437000274658 262 | Red Component 263 | 1 264 | 265 | Cursor Guide Color 266 | 267 | Alpha Component 268 | 0.4178466796875 269 | Blue Component 270 | 0.088845238089561462 271 | Color Space 272 | Calibrated 273 | Green Component 274 | 0.060530975461006165 275 | Red Component 276 | 0.01609235443174839 277 | 278 | Cursor Text Color 279 | 280 | Alpha Component 281 | 1 282 | Blue Component 283 | 0.43402600288391113 284 | Color Space 285 | Calibrated 286 | Green Component 287 | 1 288 | Red Component 289 | 0.98654043674468994 290 | 291 | Foreground Color 292 | 293 | Alpha Component 294 | 1 295 | Blue Component 296 | 0.78452938795089722 297 | Color Space 298 | Calibrated 299 | Green Component 300 | 0.73697686195373535 301 | Red Component 302 | 0.73122179508209229 303 | 304 | Link Color 305 | 306 | Alpha Component 307 | 1 308 | Blue Component 309 | 0.67799997329711914 310 | Color Space 311 | Calibrated 312 | Green Component 313 | 0.27000001072883606 314 | Red Component 315 | 0.023000000044703484 316 | 317 | Selected Text Color 318 | 319 | Alpha Component 320 | 1 321 | Blue Component 322 | 0.99999129772186279 323 | Color Space 324 | Calibrated 325 | Green Component 326 | 0.99997437000274658 327 | Red Component 328 | 1 329 | 330 | Selection Color 331 | 332 | Alpha Component 333 | 1 334 | Blue Component 335 | 0.34405481815338135 336 | Color Space 337 | Calibrated 338 | Green Component 339 | 0.21591489017009735 340 | Red Component 341 | 0.1812402755022049 342 | 343 | 344 | 345 | -------------------------------------------------------------------------------- /tmux/tmux.local.conf: -------------------------------------------------------------------------------- 1 | # https://github.com/gpakosz/.tmux 2 | # (‑●‑●)> released under the WTFPL v2 license, by Gregory Pakosz (@gpakosz) 3 | 4 | 5 | # -- navigation ---------------------------------------------------------------- 6 | 7 | # if you're running tmux within iTerm2 8 | # - and tmux is 1.9 or 1.9a 9 | # - and iTerm2 is configured to let option key act as +Esc 10 | # - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys 11 | # then uncomment the following line to make Meta + arrow keys mapping work 12 | #set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D" 13 | 14 | 15 | # -- windows & pane creation --------------------------------------------------- 16 | 17 | # new window retains current path, possible values are: 18 | # - true 19 | # - false (default) 20 | tmux_conf_new_window_retain_current_path=false 21 | 22 | # new pane retains current path, possible values are: 23 | # - true (default) 24 | # - false 25 | tmux_conf_new_pane_retain_current_path=true 26 | 27 | # new pane tries to reconnect ssh sessions (experimental), possible values are: 28 | # - true 29 | # - false (default) 30 | tmux_conf_new_pane_reconnect_ssh=false 31 | 32 | # prompt for session name when creating a new session, possible values are: 33 | # - true 34 | # - false (default) 35 | tmux_conf_new_session_prompt=false 36 | 37 | 38 | # -- display ------------------------------------------------------------------- 39 | 40 | # RGB 24-bit colour support (tmux >= 2.2), possible values are: 41 | # - true 42 | # - false (default) 43 | tmux_conf_theme_24b_colour=false 44 | 45 | # window style 46 | tmux_conf_theme_window_fg='default' 47 | tmux_conf_theme_window_bg='default' 48 | 49 | # highlight focused pane (tmux >= 2.1), possible values are: 50 | # - true 51 | # - false (default) 52 | tmux_conf_theme_highlight_focused_pane=false 53 | 54 | # focused pane colours: 55 | tmux_conf_theme_focused_pane_fg='default' 56 | tmux_conf_theme_focused_pane_bg='#0087d7' # light blue 57 | 58 | # pane border style, possible values are: 59 | # - thin (default) 60 | # - fat 61 | tmux_conf_theme_pane_border_style=thin 62 | 63 | # pane borders colours: 64 | tmux_conf_theme_pane_border='#444444' # gray 65 | tmux_conf_theme_pane_active_border='#00afff' # light blue 66 | 67 | # pane indicator colours 68 | tmux_conf_theme_pane_indicator='#00afff' # light blue 69 | tmux_conf_theme_pane_active_indicator='#00afff' # light blue 70 | 71 | # status line style 72 | tmux_conf_theme_message_fg='#000000' # black 73 | tmux_conf_theme_message_bg='#ffff00' # yellow 74 | tmux_conf_theme_message_attr='bold' 75 | 76 | # status line command style ( : Escape) 77 | tmux_conf_theme_message_command_fg='#ffff00' # yellow 78 | tmux_conf_theme_message_command_bg='#000000' # black 79 | tmux_conf_theme_message_command_attr='bold' 80 | 81 | # window modes style 82 | tmux_conf_theme_mode_fg='#000000' # black 83 | tmux_conf_theme_mode_bg='#ffff00' # yellow 84 | tmux_conf_theme_mode_attr='bold' 85 | 86 | # status line style 87 | tmux_conf_theme_status_fg='#8a8a8a' # light gray 88 | tmux_conf_theme_status_bg='#080808' # dark gray 89 | tmux_conf_theme_status_attr='none' 90 | 91 | # window status style 92 | # - built-in variables are: 93 | # - #{circled_window_index} 94 | tmux_conf_theme_window_status_fg='#8a8a8a' # light gray 95 | tmux_conf_theme_window_status_bg='#080808' # dark gray 96 | tmux_conf_theme_window_status_attr='none' 97 | tmux_conf_theme_window_status_format='#I #W' 98 | #tmux_conf_theme_window_status_format='#{circled_window_index} #W' 99 | #tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}' 100 | 101 | # window current status style 102 | # - built-in variables are: 103 | # - #{circled_window_index} 104 | tmux_conf_theme_window_status_current_fg='#000000' # black 105 | tmux_conf_theme_window_status_current_bg='#00afff' # light blue 106 | tmux_conf_theme_window_status_current_attr='bold' 107 | tmux_conf_theme_window_status_current_format='#I #W' 108 | #tmux_conf_theme_window_status_current_format='#{circled_window_index} #W' 109 | #tmux_conf_theme_window_status_current_format='#I #W#{?window_zoomed_flag,🔍,}' 110 | 111 | # window activity status style 112 | tmux_conf_theme_window_status_activity_fg='default' 113 | tmux_conf_theme_window_status_activity_bg='default' 114 | tmux_conf_theme_window_status_activity_attr='underscore' 115 | 116 | # window bell status style 117 | tmux_conf_theme_window_status_bell_fg='#ffff00' # yellow 118 | tmux_conf_theme_window_status_bell_bg='default' 119 | tmux_conf_theme_window_status_bell_attr='blink,bold' 120 | 121 | # window last status style 122 | tmux_conf_theme_window_status_last_fg='#00afff' # light blue 123 | tmux_conf_theme_window_status_last_bg='default' 124 | tmux_conf_theme_window_status_last_attr='none' 125 | 126 | # status left/right sections separators 127 | tmux_conf_theme_left_separator_main='' 128 | tmux_conf_theme_left_separator_sub='|' 129 | tmux_conf_theme_right_separator_main='' 130 | tmux_conf_theme_right_separator_sub='|' 131 | #tmux_conf_theme_left_separator_main='' # /!\ you don't need to install Powerline 132 | #tmux_conf_theme_left_separator_sub='' # you only need fonts patched with 133 | #tmux_conf_theme_right_separator_main='' # Powerline symbols or the standalone 134 | #tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font 135 | 136 | # status left/right content: 137 | # - separate main sections with '|' 138 | # - separate subsections with ',' 139 | # - built-in variables are: 140 | # - #{battery_bar} 141 | # - #{battery_hbar} 142 | # - #{battery_percentage} 143 | # - #{battery_status} 144 | # - #{battery_vbar} 145 | # - #{circled_session_name} 146 | # - #{hostname_ssh} 147 | # - #{hostname} 148 | # - #{loadavg} 149 | # - #{pairing} 150 | # - #{prefix} 151 | # - #{root} 152 | # - #{uptime_d} 153 | # - #{uptime_h} 154 | # - #{uptime_m} 155 | # - #{uptime_s} 156 | # - #{username} 157 | # - #{username_ssh} 158 | tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} ' 159 | tmux_conf_theme_status_right='#{prefix}#{pairing} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} ' 160 | 161 | # status left style 162 | tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' # black, white , white 163 | tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' # yellow, pink, white blue 164 | tmux_conf_theme_status_left_attr='bold,none,none' 165 | 166 | # status right style 167 | tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' # light gray, white, black 168 | tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # dark gray, red, white 169 | tmux_conf_theme_status_right_attr='none,none,bold' 170 | 171 | # pairing indicator 172 | tmux_conf_theme_pairing='👓' # U+1F453 173 | tmux_conf_theme_pairing_fg='none' 174 | tmux_conf_theme_pairing_bg='none' 175 | tmux_conf_theme_pairing_attr='none' 176 | 177 | # prefix indicator 178 | tmux_conf_theme_prefix='⌨' # U+2328 179 | tmux_conf_theme_prefix_fg='none' 180 | tmux_conf_theme_prefix_bg='none' 181 | tmux_conf_theme_prefix_attr='none' 182 | 183 | # root indicator 184 | tmux_conf_theme_root='!' 185 | tmux_conf_theme_root_fg='none' 186 | tmux_conf_theme_root_bg='none' 187 | tmux_conf_theme_root_attr='bold,blink' 188 | 189 | # battery bar symbols 190 | tmux_conf_battery_bar_symbol_full='◼' 191 | tmux_conf_battery_bar_symbol_empty='◻' 192 | #tmux_conf_battery_bar_symbol_full='♥' 193 | #tmux_conf_battery_bar_symbol_empty='·' 194 | 195 | # battery bar length (in number of symbols), possible values are: 196 | # - auto 197 | # - a number, e.g. 5 198 | tmux_conf_battery_bar_length='auto' 199 | 200 | # battery bar palette, possible values are: 201 | # - gradient (default) 202 | # - heat 203 | # - 'colour_full_fg,colour_empty_fg,colour_bg' 204 | tmux_conf_battery_bar_palette='gradient' 205 | #tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' # red, white, black 206 | 207 | # battery hbar palette, possible values are: 208 | # - gradient (default) 209 | # - heat 210 | # - 'colour_low,colour_half,colour_full' 211 | tmux_conf_battery_hbar_palette='gradient' 212 | #tmux_conf_battery_hbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green 213 | 214 | # battery vbar palette, possible values are: 215 | # - gradient (default) 216 | # - heat 217 | # - 'colour_low,colour_half,colour_full' 218 | tmux_conf_battery_vbar_palette='gradient' 219 | #tmux_conf_battery_vbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green 220 | 221 | # symbols used to indicate whether battery is charging or discharging 222 | tmux_conf_battery_status_charging='↑' # U+2191 223 | tmux_conf_battery_status_discharging='↓' # U+2193 224 | #tmux_conf_battery_status_charging='⚡ ' # U+26A1 225 | #tmux_conf_battery_status_charging='🔌 ' # U+1F50C 226 | #tmux_conf_battery_status_discharging='🔋 ' # U+1F50B 227 | 228 | # clock style 229 | tmux_conf_theme_clock_colour='#00afff' # light blue 230 | tmux_conf_theme_clock_style='24' 231 | 232 | 233 | # -- clipboard ----------------------------------------------------------------- 234 | 235 | # in copy mode, copying selection also copies to the OS clipboard 236 | # - true 237 | # - false (default) 238 | # on macOS, this requires installing reattach-to-user-namespace, see README.md 239 | # on Linux, this requires xsel or xclip 240 | tmux_conf_copy_to_os_clipboard=true 241 | 242 | 243 | # -- user customizations ------------------------------------------------------- 244 | # this is the place to override or undo settings 245 | 246 | # increase history size 247 | set -g history-limit 100000 248 | 249 | # start with mouse mode enabled 250 | #set -g mouse on 251 | 252 | # force Vi mode 253 | # really you should export VISUAL or EDITOR environment variable, see manual 254 | #set -g status-keys vi 255 | #set -g mode-keys vi 256 | 257 | # replace C-b by C-a instead of using both prefixes 258 | # set -gu prefix2 259 | # unbind C-a 260 | # unbind C-b 261 | # set -g prefix C-a 262 | # bind C-a send-prefix 263 | 264 | # move status line to top 265 | #set -g status-position top 266 | 267 | # split windows 268 | bind \\ split-window -h 269 | bind - split-window -v 270 | 271 | # remapping arrow keys 272 | bind h select-pane -L 273 | bind j select-pane -D 274 | bind k select-pane -U 275 | bind l select-pane -R 276 | 277 | # jump between windows 278 | bind -r C-h select-window -t :- 279 | bind -r C-l select-window -t :+ 280 | 281 | 282 | # resizing windows 283 | bind -r H resize-pane -L 5 284 | bind -r J resize-pane -D 5 285 | bind -r K resize-pane -U 5 286 | bind -r L resize-pane -R 5 287 | 288 | # copy mode search settings 289 | bind-key -T copy-mode C-w send-keys -X copy-selection 290 | bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-selection 291 | bind-key -T copy-mode M-w send-keys -X copy-selection 292 | bind-key -T copy-mode-vi C-j send-keys -X copy-selection 293 | bind-key -T copy-mode-vi Enter send-keys -X copy-selection 294 | bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection 295 | -------------------------------------------------------------------------------- /iterm2/changkun-dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "Use Non-ASCII Font" : false, 3 | "Tags" : [ 4 | 5 | ], 6 | "Ansi 12 Color" : { 7 | "Red Component" : 0.36309865117073059, 8 | "Color Space" : "Calibrated", 9 | "Blue Component" : 0.95373213291168213, 10 | "Alpha Component" : 1, 11 | "Green Component" : 0.5604100227355957 12 | }, 13 | "Ansi 7 Color" : { 14 | "Red Component" : 0.73333334922790527, 15 | "Color Space" : "Calibrated", 16 | "Blue Component" : 0.73333334922790527, 17 | "Alpha Component" : 1, 18 | "Green Component" : 0.73333334922790527 19 | }, 20 | "Ansi 8 Color" : { 21 | "Red Component" : 0.33333333333333331, 22 | "Color Space" : "Calibrated", 23 | "Blue Component" : 0.33333333333333331, 24 | "Alpha Component" : 1, 25 | "Green Component" : 0.33333333333333331 26 | }, 27 | "Bold Color" : { 28 | "Red Component" : 1, 29 | "Color Space" : "Calibrated", 30 | "Blue Component" : 1, 31 | "Alpha Component" : 1, 32 | "Green Component" : 1 33 | }, 34 | "Ansi 9 Color" : { 35 | "Red Component" : 0.88426637649536133, 36 | "Color Space" : "Calibrated", 37 | "Blue Component" : 0.3913804292678833, 38 | "Alpha Component" : 1, 39 | "Green Component" : 0.4961114227771759 40 | }, 41 | "Guid" : "18BE855E-36E6-48F4-91E7-523FEDF16F2A", 42 | "Ansi 2 Color" : { 43 | "Red Component" : 0.42205339670181274, 44 | "Color Space" : "Calibrated", 45 | "Blue Component" : 0.22786164283752441, 46 | "Alpha Component" : 1, 47 | "Green Component" : 0.74287182092666626 48 | }, 49 | "Rows" : 25, 50 | "Default Bookmark" : "No", 51 | "Cursor Guide Color" : { 52 | "Red Component" : 0.01609235443174839, 53 | "Color Space" : "Calibrated", 54 | "Blue Component" : 0.088845238089561462, 55 | "Alpha Component" : 0.4178466796875, 56 | "Green Component" : 0.060530975461006165 57 | }, 58 | "Non-ASCII Anti Aliased" : true, 59 | "Use Bright Bold" : true, 60 | "Ansi 10 Color" : { 61 | "Red Component" : 0.49721947312355042, 62 | "Color Space" : "Calibrated", 63 | "Blue Component" : 0.35121414065361023, 64 | "Alpha Component" : 1, 65 | "Green Component" : 0.72937816381454468 66 | }, 67 | "Ambiguous Double Width" : false, 68 | "Jobs to Ignore" : [ 69 | "rlogin", 70 | "ssh", 71 | "slogin", 72 | "telnet" 73 | ], 74 | "Ansi 15 Color" : { 75 | "Red Component" : 1, 76 | "Color Space" : "Calibrated", 77 | "Blue Component" : 1, 78 | "Alpha Component" : 1, 79 | "Green Component" : 1 80 | }, 81 | "Foreground Color" : { 82 | "Red Component" : 0.73122179508209229, 83 | "Color Space" : "Calibrated", 84 | "Blue Component" : 0.78452938795089722, 85 | "Alpha Component" : 1, 86 | "Green Component" : 0.73697686195373535 87 | }, 88 | "Working Directory" : "\/Users\/changkun", 89 | "Blinking Cursor" : false, 90 | "Disable Window Resizing" : true, 91 | "Sync Title" : false, 92 | "Prompt Before Closing 2" : false, 93 | "BM Growl" : true, 94 | "Command" : "", 95 | "Description" : "Default", 96 | "Mouse Reporting" : true, 97 | "Screen" : -1, 98 | "Selection Color" : { 99 | "Red Component" : 0.1812402755022049, 100 | "Color Space" : "Calibrated", 101 | "Blue Component" : 0.34405481815338135, 102 | "Alpha Component" : 1, 103 | "Green Component" : 0.21591489017009735 104 | }, 105 | "Columns" : 80, 106 | "Idle Code" : 0, 107 | "Ansi 13 Color" : { 108 | "Red Component" : 0.97994524240493774, 109 | "Color Space" : "Calibrated", 110 | "Blue Component" : 0.75484597682952881, 111 | "Alpha Component" : 1, 112 | "Green Component" : 0.51216816902160645 113 | }, 114 | "Custom Command" : "No", 115 | "ASCII Anti Aliased" : true, 116 | "Non Ascii Font" : "Monaco 12", 117 | "Vertical Spacing" : 1, 118 | "Use Bold Font" : true, 119 | "Option Key Sends" : 0, 120 | "Selected Text Color" : { 121 | "Red Component" : 1, 122 | "Color Space" : "Calibrated", 123 | "Blue Component" : 0.99999129772186279, 124 | "Alpha Component" : 1, 125 | "Green Component" : 0.99997437000274658 126 | }, 127 | "Background Color" : { 128 | "Red Component" : 0.066731743514537811, 129 | "Color Space" : "Calibrated", 130 | "Blue Component" : 0.14622637629508972, 131 | "Alpha Component" : 1, 132 | "Green Component" : 0.087520182132720947 133 | }, 134 | "Character Encoding" : 4, 135 | "Ansi 11 Color" : { 136 | "Red Component" : 1, 137 | "Color Space" : "Calibrated", 138 | "Blue Component" : 0.3333333432674408, 139 | "Alpha Component" : 1, 140 | "Green Component" : 1 141 | }, 142 | "Use Italic Font" : true, 143 | "Unlimited Scrollback" : false, 144 | "Keyboard Map" : { 145 | "0xf700-0x260000" : { 146 | "Action" : 10, 147 | "Text" : "[1;6A" 148 | }, 149 | "0x37-0x40000" : { 150 | "Action" : 11, 151 | "Text" : "0x1f" 152 | }, 153 | "0x32-0x40000" : { 154 | "Action" : 11, 155 | "Text" : "0x00" 156 | }, 157 | "0xf709-0x20000" : { 158 | "Action" : 10, 159 | "Text" : "[17;2~" 160 | }, 161 | "0xf70c-0x20000" : { 162 | "Action" : 10, 163 | "Text" : "[20;2~" 164 | }, 165 | "0xf729-0x20000" : { 166 | "Action" : 10, 167 | "Text" : "[1;2H" 168 | }, 169 | "0xf72b-0x40000" : { 170 | "Action" : 10, 171 | "Text" : "[1;5F" 172 | }, 173 | "0xf705-0x20000" : { 174 | "Action" : 10, 175 | "Text" : "[1;2Q" 176 | }, 177 | "0xf703-0x260000" : { 178 | "Action" : 10, 179 | "Text" : "[1;6C" 180 | }, 181 | "0xf700-0x220000" : { 182 | "Action" : 10, 183 | "Text" : "[1;2A" 184 | }, 185 | "0xf703-0x300000" : { 186 | "Action" : 11, 187 | "Text" : "0x05" 188 | }, 189 | "0xf701-0x280000" : { 190 | "Action" : 11, 191 | "Text" : "0x1b 0x1b 0x5b 0x42" 192 | }, 193 | "0x38-0x40000" : { 194 | "Action" : 11, 195 | "Text" : "0x7f" 196 | }, 197 | "0x33-0x40000" : { 198 | "Action" : 11, 199 | "Text" : "0x1b" 200 | }, 201 | "0xf703-0x220000" : { 202 | "Action" : 10, 203 | "Text" : "[1;2C" 204 | }, 205 | "0xf701-0x240000" : { 206 | "Action" : 10, 207 | "Text" : "[1;5B" 208 | }, 209 | "0xf70d-0x20000" : { 210 | "Action" : 10, 211 | "Text" : "[21;2~" 212 | }, 213 | "0xf702-0x260000" : { 214 | "Action" : 10, 215 | "Text" : "[1;6D" 216 | }, 217 | "0xf729-0x40000" : { 218 | "Action" : 10, 219 | "Text" : "[1;5H" 220 | }, 221 | "0xf702-0x300000" : { 222 | "Action" : 11, 223 | "Text" : "0x01" 224 | }, 225 | "0xf706-0x20000" : { 226 | "Action" : 10, 227 | "Text" : "[1;2R" 228 | }, 229 | "0x34-0x40000" : { 230 | "Action" : 11, 231 | "Text" : "0x1c" 232 | }, 233 | "0xf700-0x280000" : { 234 | "Action" : 11, 235 | "Text" : "0x1b 0x1b 0x5b 0x41" 236 | }, 237 | "0x2d-0x40000" : { 238 | "Action" : 11, 239 | "Text" : "0x1f" 240 | }, 241 | "0xf70e-0x20000" : { 242 | "Action" : 10, 243 | "Text" : "[23;2~" 244 | }, 245 | "0xf702-0x220000" : { 246 | "Action" : 10, 247 | "Text" : "[1;2D" 248 | }, 249 | "0x7f-0x100000" : { 250 | "Action" : 11, 251 | "Text" : "0x15" 252 | }, 253 | "0xf703-0x280000" : { 254 | "Action" : 11, 255 | "Text" : "0x1b 0x66" 256 | }, 257 | "0xf700-0x240000" : { 258 | "Action" : 10, 259 | "Text" : "[1;5A" 260 | }, 261 | "0xf707-0x20000" : { 262 | "Action" : 10, 263 | "Text" : "[1;2S" 264 | }, 265 | "0xf70a-0x20000" : { 266 | "Action" : 10, 267 | "Text" : "[18;2~" 268 | }, 269 | "0x35-0x40000" : { 270 | "Action" : 11, 271 | "Text" : "0x1d" 272 | }, 273 | "0xf70f-0x20000" : { 274 | "Action" : 10, 275 | "Text" : "[24;2~" 276 | }, 277 | "0xf703-0x240000" : { 278 | "Action" : 10, 279 | "Text" : "[1;5C" 280 | }, 281 | "0x7f-0x80000" : { 282 | "Action" : 11, 283 | "Text" : "0x1b 0x08" 284 | }, 285 | "0xf701-0x260000" : { 286 | "Action" : 10, 287 | "Text" : "[1;6B" 288 | }, 289 | "0xf702-0x280000" : { 290 | "Action" : 11, 291 | "Text" : "0x1b 0x62" 292 | }, 293 | "0xf72b-0x20000" : { 294 | "Action" : 10, 295 | "Text" : "[1;2F" 296 | }, 297 | "0x36-0x40000" : { 298 | "Action" : 11, 299 | "Text" : "0x1e" 300 | }, 301 | "0xf708-0x20000" : { 302 | "Action" : 10, 303 | "Text" : "[15;2~" 304 | }, 305 | "0x7a-0x100000" : { 306 | "Action" : 11, 307 | "Text" : "0x1f" 308 | }, 309 | "0xf701-0x220000" : { 310 | "Action" : 10, 311 | "Text" : "[1;2B" 312 | }, 313 | "0xf70b-0x20000" : { 314 | "Action" : 10, 315 | "Text" : "[19;2~" 316 | }, 317 | "0xf702-0x240000" : { 318 | "Action" : 10, 319 | "Text" : "[1;5D" 320 | }, 321 | "0xf704-0x20000" : { 322 | "Action" : 10, 323 | "Text" : "[1;2P" 324 | } 325 | }, 326 | "Window Type" : 0, 327 | "Blur Radius" : 3.1460322810913706, 328 | "Cursor Type" : 0, 329 | "Initial Text" : "tmux attach -d -t dev || tmux new -s dev", 330 | "Background Image Location" : "", 331 | "Blur" : true, 332 | "Badge Color" : { 333 | "Red Component" : 1, 334 | "Color Space" : "Calibrated", 335 | "Blue Component" : 0.37474671006202698, 336 | "Alpha Component" : 0.457366943359375, 337 | "Green Component" : 0.98996305465698242 338 | }, 339 | "Scrollback Lines" : 1000, 340 | "Send Code When Idle" : false, 341 | "Close Sessions On End" : true, 342 | "Terminal Type" : "xterm-256color", 343 | "Visual Bell" : true, 344 | "Flashing Bell" : false, 345 | "Silence Bell" : false, 346 | "Ansi 14 Color" : { 347 | "Red Component" : 0.47083443403244019, 348 | "Color Space" : "Calibrated", 349 | "Blue Component" : 0.90565776824951172, 350 | "Alpha Component" : 1, 351 | "Green Component" : 0.80690312385559082 352 | }, 353 | "Name" : "changkun-dev", 354 | "Cursor Text Color" : { 355 | "Red Component" : 0.98654043674468994, 356 | "Color Space" : "Calibrated", 357 | "Blue Component" : 0.43402600288391113, 358 | "Alpha Component" : 1, 359 | "Green Component" : 1 360 | }, 361 | "Shortcut" : "", 362 | "Cursor Color" : { 363 | "Red Component" : 1, 364 | "Color Space" : "Calibrated", 365 | "Blue Component" : 0.99999129772186279, 366 | "Alpha Component" : 1, 367 | "Green Component" : 0.99997437000274658 368 | }, 369 | "Ansi 0 Color" : { 370 | "Red Component" : 0, 371 | "Color Space" : "Calibrated", 372 | "Blue Component" : 0, 373 | "Alpha Component" : 1, 374 | "Green Component" : 0 375 | }, 376 | "Ansi 1 Color" : { 377 | "Red Component" : 0.86485648155212402, 378 | "Color Space" : "Calibrated", 379 | "Blue Component" : 0.18665386736392975, 380 | "Alpha Component" : 1, 381 | "Green Component" : 0.31231138110160828 382 | }, 383 | "Custom Directory" : "No", 384 | "Link Color" : { 385 | "Red Component" : 0.023000000044703484, 386 | "Color Space" : "Calibrated", 387 | "Blue Component" : 0.67799997329711914, 388 | "Alpha Component" : 1, 389 | "Green Component" : 0.27000001072883606 390 | }, 391 | "Ansi 4 Color" : { 392 | "Red Component" : 0.14751617610454559, 393 | "Color Space" : "Calibrated", 394 | "Blue Component" : 0.98870241641998291, 395 | "Alpha Component" : 1, 396 | "Green Component" : 0.43747854232788086 397 | }, 398 | "Right Option Key Sends" : 0, 399 | "Ansi 6 Color" : { 400 | "Red Component" : 0.22087787091732025, 401 | "Color Space" : "Calibrated", 402 | "Blue Component" : 0.85335952043533325, 403 | "Alpha Component" : 1, 404 | "Green Component" : 0.69620096683502197 405 | }, 406 | "Horizontal Spacing" : 1, 407 | "Normal Font" : "SourceCodeProForPowerline-Medium 16", 408 | "Ansi 3 Color" : { 409 | "Red Component" : 0.90120565891265869, 410 | "Color Space" : "Calibrated", 411 | "Blue Component" : 0.17459605634212494, 412 | "Alpha Component" : 1, 413 | "Green Component" : 0.84299170970916748 414 | }, 415 | "Transparency" : 0.11385628172588834, 416 | "Ansi 5 Color" : { 417 | "Red Component" : 0.95038461685180664, 418 | "Color Space" : "Calibrated", 419 | "Blue Component" : 0.7253117561340332, 420 | "Alpha Component" : 1, 421 | "Green Component" : 0.34603607654571533 422 | } 423 | } -------------------------------------------------------------------------------- /vim/vimrc.config: -------------------------------------------------------------------------------- 1 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 2 | " => General 3 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 4 | 5 | " Sets how many lines of history VIM has to remember 6 | set history=500 7 | 8 | " Set relative number 9 | set relativenumber 10 | set number 11 | 12 | " Enable filetype plugins 13 | filetype plugin on 14 | filetype indent on 15 | 16 | " Set to auto read when a file is changed from the outside 17 | set autoread 18 | 19 | " With a map leader it's possible to do extra key combinations 20 | " like w saves the current file 21 | let mapleader = "," 22 | let g:mapleader = "," 23 | 24 | " Fast saving 25 | nmap w :w! 26 | 27 | " :W sudo saves the file 28 | " (useful for handling the permission-denied error) 29 | command W w !sudo tee % > /dev/null 30 | 31 | 32 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 33 | " => VIM user interface 34 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 35 | " Set 7 lines to the cursor - when moving vertically using j/k 36 | set so=7 37 | 38 | " Avoid garbled characters in Chinese language windows OS 39 | let $LANG='en' 40 | set langmenu=en 41 | source $VIMRUNTIME/delmenu.vim 42 | source $VIMRUNTIME/menu.vim 43 | 44 | " Turn on the WiLd menu 45 | set wildmenu 46 | 47 | " Ignore compiled files 48 | set wildignore=*.o,*~,*.pyc 49 | if has("win16") || has("win32") 50 | set wildignore+=.git\*,.hg\*,.svn\* 51 | else 52 | set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store 53 | endif 54 | 55 | "Always show current position 56 | set ruler 57 | 58 | " Height of the command bar 59 | set cmdheight=2 60 | 61 | " A buffer becomes hidden when it is abandoned 62 | set hid 63 | 64 | " Configure backspace so it acts as it should act 65 | set backspace=eol,start,indent 66 | set whichwrap+=<,>,h,l 67 | 68 | " Ignore case when searching 69 | set ignorecase 70 | 71 | " When searching try to be smart about cases 72 | set smartcase 73 | 74 | " Highlight search results 75 | set hlsearch 76 | 77 | " Makes search act like search in modern browsers 78 | set incsearch 79 | 80 | " Don't redraw while executing macros (good performance config) 81 | set lazyredraw 82 | 83 | " For regular expressions turn magic on 84 | set magic 85 | 86 | " Show matching brackets when text indicator is over them 87 | set showmatch 88 | " How many tenths of a second to blink when matching brackets 89 | set mat=2 90 | 91 | " No annoying sound on errors 92 | set noerrorbells 93 | set novisualbell 94 | set t_vb= 95 | set tm=500 96 | 97 | " Properly disable sound on errors on MacVim 98 | if has("gui_macvim") 99 | autocmd GUIEnter * set vb t_vb= 100 | endif 101 | 102 | 103 | " Add a bit extra margin to the left 104 | set foldcolumn=1 105 | 106 | 107 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 108 | " => Colors and Fonts 109 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 110 | " Enable syntax highlighting 111 | syntax enable 112 | 113 | " Enable 256 colors palette in Gnome Terminal 114 | if $COLORTERM == 'gnome-terminal' 115 | set t_Co=256 116 | endif 117 | 118 | try 119 | colorscheme desert 120 | catch 121 | endtry 122 | 123 | set background=dark 124 | 125 | " Set extra options when running in GUI mode 126 | if has("gui_running") 127 | set guioptions-=T 128 | set guioptions-=e 129 | set t_Co=256 130 | set guitablabel=%M\ %t 131 | endif 132 | 133 | " Set utf8 as standard encoding and en_US as the standard language 134 | set encoding=utf8 135 | 136 | " Use Unix as the standard file type 137 | set ffs=unix,dos,mac 138 | 139 | 140 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 141 | " => Files, backups and undo 142 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 143 | " Turn backup off, since most stuff is in SVN, git et.c anyway... 144 | set nobackup 145 | set nowb 146 | set noswapfile 147 | 148 | 149 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 150 | " => Text, tab and indent related 151 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 152 | " Use spaces instead of tabs 153 | set expandtab 154 | 155 | " Be smart when using tabs ;) 156 | set smarttab 157 | 158 | " 1 tab == 4 spaces 159 | set shiftwidth=4 160 | set tabstop=4 161 | 162 | " Linebreak on 500 characters 163 | set lbr 164 | set tw=500 165 | 166 | set ai "Auto indent 167 | set si "Smart indent 168 | set wrap "Wrap lines 169 | 170 | " Display differences of tabs and spaces " didn't use: eol:↲, 171 | set list 172 | set listchars=tab:→\ ,nbsp:␣,trail:•,extends:⟩,precedes:⟨ 173 | 174 | """""""""""""""""""""""""""""" 175 | " => Visual mode related 176 | """""""""""""""""""""""""""""" 177 | " Visual mode pressing * or # searches for the current selection 178 | " Super useful! From an idea by Michael Naumann 179 | vnoremap * :call VisualSelection('', '')/=@/ 180 | vnoremap # :call VisualSelection('', '')?=@/ 181 | 182 | 183 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 184 | " => Moving around, tabs, windows and buffers 185 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 186 | " Map to / (search) and Ctrl- to ? (backwards search) 187 | map / 188 | map ? 189 | 190 | " Disable highlight when is pressed 191 | map :noh 192 | 193 | " Smart way to move between windows 194 | map j 195 | map k 196 | map h 197 | map l 198 | 199 | " Close the current buffer 200 | map bd :Bclose:tabclosegT 201 | 202 | " Close all the buffers 203 | map ba :bufdo bd 204 | 205 | map l :bnext 206 | map h :bprevious 207 | 208 | " Useful mappings for managing tabs 209 | map tn :tabnew 210 | map to :tabonly 211 | map tc :tabclose 212 | map tm :tabmove 213 | map t :tabnext 214 | 215 | " Let 'tl' toggle between this and the last accessed tab 216 | let g:lasttab = 1 217 | nmap tl :exe "tabn ".g:lasttab 218 | au TabLeave * let g:lasttab = tabpagenr() 219 | 220 | 221 | " Opens a new tab with the current buffer's path 222 | " Super useful when editing files in the same directory 223 | map te :tabedit =expand("%:p:h")/ 224 | 225 | " Switch CWD to the directory of the open buffer 226 | map cd :cd %:p:h:pwd 227 | 228 | " Specify the behavior when switching between buffers 229 | try 230 | set switchbuf=useopen,usetab,newtab 231 | set stal=2 232 | catch 233 | endtry 234 | 235 | " Return to last edit position when opening files (You want this!) 236 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 237 | 238 | 239 | """""""""""""""""""""""""""""" 240 | " => Status line 241 | """""""""""""""""""""""""""""" 242 | " Always show the status line 243 | set laststatus=2 244 | 245 | " Format the status line 246 | set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c 247 | 248 | "set guifont=Inconsolata\ for\ Powerline:h15 249 | "let g:Powerline_symbols = 'fancy' 250 | "set encoding=utf-8 251 | "set t_Co=256 252 | "set fillchars+=stl:\ ,stlnc:\ 253 | "set term=xterm-256color 254 | "qet termencoding=utf-8 255 | set mouse=a 256 | 257 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 258 | " => Editing mappings 259 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 260 | " Remap VIM 0 to first non-blank character 261 | map 0 ^ 262 | 263 | " Move a line of text using ALT+[jk] or Command+[jk] on mac 264 | nmap mz:m+`z 265 | nmap mz:m-2`z 266 | vmap :m'>+`mzgv`yo`z 267 | vmap :m'<-2`>my` 271 | nmap 272 | vmap 273 | vmap 274 | endif 275 | 276 | " Delete trailing white space on save, useful for Python and CoffeeScript ;) 277 | func! DeleteTrailingWS() 278 | exe "normal mz" 279 | %s/\s\+$//ge 280 | exe "normal `z" 281 | endfunc 282 | autocmd BufWrite *.py :call DeleteTrailingWS() 283 | autocmd BufWrite *.coffee :call DeleteTrailingWS() 284 | 285 | 286 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 287 | " => Ag searching and cope displaying 288 | " requires ag.vim - it's much better than vimgrep/grep 289 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 290 | " When you press gv you Ag after the selected text 291 | vnoremap gv :call VisualSelection('gv', '') 292 | 293 | " Open Ag and put the cursor in the right position 294 | map g :Ag 295 | 296 | " When you press r you can search and replace the selected text 297 | vnoremap r :call VisualSelection('replace', '') 298 | 299 | " Do :help cope if you are unsure what cope is. It's super useful! 300 | " 301 | " When you search with Ag, display your results in cope by doing: 302 | " cc 303 | " 304 | " To go to the next search result do: 305 | " n 306 | " 307 | " To go to the previous search results do: 308 | " p 309 | " 310 | map cc :botright cope 311 | map co ggVGy:tabnew:set syntax=qfpgg 312 | map n :cn 313 | map p :cp 314 | 315 | 316 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 317 | " => Spell checking 318 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 319 | " Pressing ,ss will toggle and untoggle spell checking 320 | map ss :setlocal spell! 321 | 322 | " Shortcuts using 323 | map sn ]s 324 | map sp [s 325 | map sa zg 326 | map s? z= 327 | 328 | 329 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 330 | " => Misc 331 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 332 | " Remove the Windows ^M - when the encodings gets messed up 333 | noremap m mmHmt:%s///ge'tzt'm 334 | 335 | " Quickly open a buffer for scribble 336 | map q :e ~/buffer 337 | 338 | " Quickly open a markdown buffer for scribble 339 | map x :e ~/buffer.md 340 | 341 | " Toggle paste mode on and off 342 | map pp :setlocal paste! 343 | 344 | 345 | 346 | 347 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 348 | " => Helper functions 349 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 350 | function! CmdLine(str) 351 | exe "menu Foo.Bar :" . a:str 352 | emenu Foo.Bar 353 | unmenu Foo 354 | endfunction 355 | 356 | function! VisualSelection(direction, extra_filter) range 357 | let l:saved_reg = @" 358 | execute "normal! vgvy" 359 | 360 | let l:pattern = escape(@", "\\/.*'$^~[]") 361 | let l:pattern = substitute(l:pattern, "\n$", "", "") 362 | 363 | if a:direction == 'gv' 364 | call CmdLine("Ag '" . l:pattern . "' " ) 365 | elseif a:direction == 'replace' 366 | call CmdLine("%s" . '/'. l:pattern . '/') 367 | endif 368 | 369 | let @/ = l:pattern 370 | let @" = l:saved_reg 371 | endfunction 372 | 373 | 374 | " Returns true if paste mode is enabled 375 | function! HasPaste() 376 | if &paste 377 | return 'PASTE MODE ' 378 | endif 379 | return '' 380 | endfunction 381 | 382 | " Don't close window, when deleting a buffer 383 | command! Bclose call BufcloseCloseIt() 384 | function! BufcloseCloseIt() 385 | let l:currentBufNum = bufnr("%") 386 | let l:alternateBufNum = bufnr("#") 387 | 388 | if buflisted(l:alternateBufNum) 389 | buffer # 390 | else 391 | bnext 392 | endif 393 | 394 | if bufnr("%") == l:currentBufNum 395 | new 396 | endif 397 | 398 | if buflisted(l:currentBufNum) 399 | execute("bdelete! ".l:currentBufNum) 400 | endif 401 | endfunction 402 | 403 | " Make VIM remember position in file after reopen 404 | " if has("autocmd") 405 | " au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 406 | "endif 407 | 408 | " Toggle vertical and horizontal line 409 | set cursorline 410 | set cursorcolumn 411 | set cc=72,120 412 | 413 | " Vim-go 414 | let g:go_fmt_command = "goimports" 415 | let g:go_auto_type_info = 1 " Automatically get signature/type info for object under cursor 416 | 417 | " NerdTree 418 | autocmd vimenter * NERDTree 419 | autocmd StdinReadPre * let s:std_in=1 420 | autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif 421 | autocmd StdinReadPre * let s:std_in=1 422 | autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif 423 | autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif 424 | 425 | " YouCompleteMe 426 | let g:ycm_python_binary_path = '/usr/local/bin/python' 427 | let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py" 428 | 429 | " Color Scheme 430 | colorscheme jellybeans 431 | " colorscheme codedark, https://github.com/tomasiser/vim-code-dark 432 | 433 | call plug#begin('~/.vim/plugged') 434 | 435 | Plug 'Valloric/YouCompleteMe' 436 | Plug 'whatyouhide/vim-gotham' 437 | Plug 'fatih/vim-go' 438 | Plug 'preservim/nerdtree' 439 | Plug 'itchyny/lightline.vim' 440 | Plug 'Yggdroot/indentLine' 441 | Plug 'airblade/vim-gitgutter' 442 | Plug 'itchyny/vim-cursorword' 443 | 444 | call plug#end() 445 | -------------------------------------------------------------------------------- /vim/colors/jellybeans.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " 3 | " " __ _ _ _ " 4 | " " \ \ ___| | |_ _| |__ ___ __ _ _ __ ___ " 5 | " " \ \/ _ \ | | | | | _ \ / _ \/ _ | _ \/ __| " 6 | " " /\_/ / __/ | | |_| | |_| | __/ |_| | | | \__ \ " 7 | " " \___/ \___|_|_|\__ |____/ \___|\____|_| |_|___/ " 8 | " " \___/ " 9 | " 10 | " "A colorful, dark color scheme for Vim." 11 | " 12 | " File: jellybeans.vim 13 | " URL: github.com/nanotech/jellybeans.vim 14 | " Scripts URL: vim.org/scripts/script.php?script_id=2555 15 | " Maintainer: NanoTech (nanotech.nanotechcorp.net) 16 | " Version: 1.6 17 | " Last Change: October 18th, 2016 18 | " License: MIT 19 | " Contributors: Andrew Wong (w0ng) 20 | " Brian Marshall (bmars) 21 | " Daniel Herbert (pocketninja) 22 | " David Liang 23 | " Henry So, Jr. 24 | " Joe Doherty (docapotamus) 25 | " Karl Litterfeldt (Litterfeldt) 26 | " Keith Pitt (keithpitt) 27 | " Philipp Rustemeier (12foo) 28 | " Rafael Bicalho (rbika) 29 | " Rich Healey (richo) 30 | " Siwen Yu (yusiwen) 31 | " Tim Willis (willist) 32 | " 33 | " Copyright (c) 2009-2016 NanoTech 34 | " 35 | " Permission is hereby granted, free of charge, to any per‐ 36 | " son obtaining a copy of this software and associated doc‐ 37 | " umentation files (the “Software”), to deal in the Soft‐ 38 | " ware without restriction, including without limitation 39 | " the rights to use, copy, modify, merge, publish, distrib‐ 40 | " ute, sublicense, and/or sell copies of the Software, and 41 | " to permit persons to whom the Software is furnished to do 42 | " so, subject to the following conditions: 43 | " 44 | " The above copyright notice and this permission notice 45 | " shall be included in all copies or substantial portions 46 | " of the Software. 47 | " 48 | " THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY 49 | " KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 50 | " THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU‐ 51 | " LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 52 | " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 53 | " DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON‐ 54 | " TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐ 55 | " NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 56 | " THE SOFTWARE. 57 | 58 | set background=dark 59 | 60 | hi clear 61 | 62 | if exists("syntax_on") 63 | syntax reset 64 | endif 65 | 66 | let colors_name = "jellybeans" 67 | 68 | if has("gui_running") || (has('termguicolors') && &termguicolors) || &t_Co >= 88 69 | let s:low_color = 0 70 | else 71 | let s:low_color = 1 72 | endif 73 | 74 | " Configuration Variables: 75 | " - g:jellybeans_overrides (default = {}) 76 | " - g:jellybeans_use_lowcolor_black (default = 1) 77 | " - g:jellybeans_use_gui_italics (default = 1) 78 | " - g:jellybeans_use_term_italics (default = 0) 79 | 80 | let s:background_color = "151515" 81 | 82 | if exists("g:jellybeans_overrides") 83 | let s:overrides = g:jellybeans_overrides 84 | else 85 | let s:overrides = {} 86 | endif 87 | 88 | " Backwards compatibility 89 | if exists("g:jellybeans_background_color") 90 | \ || exists("g:jellybeans_background_color_256") 91 | \ || exists("g:jellybeans_use_term_background_color") 92 | 93 | let s:overrides = deepcopy(s:overrides) 94 | 95 | if !has_key(s:overrides, "background") 96 | let s:overrides["background"] = {} 97 | endif 98 | 99 | if exists("g:jellybeans_background_color") 100 | let s:overrides["background"]["guibg"] = g:jellybeans_background_color 101 | endif 102 | 103 | if exists("g:jellybeans_background_color_256") 104 | let s:overrides["background"]["256ctermbg"] = g:jellybeans_background_color_256 105 | endif 106 | 107 | if exists("g:jellybeans_use_term_background_color") 108 | \ && g:jellybeans_use_term_background_color 109 | let s:overrides["background"]["ctermbg"] = "NONE" 110 | let s:overrides["background"]["256ctermbg"] = "NONE" 111 | endif 112 | endif 113 | 114 | if !exists("g:jellybeans_use_lowcolor_black") || g:jellybeans_use_lowcolor_black 115 | let s:termBlack = "Black" 116 | else 117 | let s:termBlack = "Grey" 118 | endif 119 | 120 | " Color approximation functions by Henry So, Jr. and David Liang {{{ 121 | " Added to jellybeans.vim by Daniel Herbert 122 | 123 | " returns an approximate grey index for the given grey level 124 | fun! s:grey_number(x) 125 | if &t_Co == 88 126 | if a:x < 23 127 | return 0 128 | elseif a:x < 69 129 | return 1 130 | elseif a:x < 103 131 | return 2 132 | elseif a:x < 127 133 | return 3 134 | elseif a:x < 150 135 | return 4 136 | elseif a:x < 173 137 | return 5 138 | elseif a:x < 196 139 | return 6 140 | elseif a:x < 219 141 | return 7 142 | elseif a:x < 243 143 | return 8 144 | else 145 | return 9 146 | endif 147 | else 148 | if a:x < 14 149 | return 0 150 | else 151 | let l:n = (a:x - 8) / 10 152 | let l:m = (a:x - 8) % 10 153 | if l:m < 5 154 | return l:n 155 | else 156 | return l:n + 1 157 | endif 158 | endif 159 | endif 160 | endfun 161 | 162 | " returns the actual grey level represented by the grey index 163 | fun! s:grey_level(n) 164 | if &t_Co == 88 165 | if a:n == 0 166 | return 0 167 | elseif a:n == 1 168 | return 46 169 | elseif a:n == 2 170 | return 92 171 | elseif a:n == 3 172 | return 115 173 | elseif a:n == 4 174 | return 139 175 | elseif a:n == 5 176 | return 162 177 | elseif a:n == 6 178 | return 185 179 | elseif a:n == 7 180 | return 208 181 | elseif a:n == 8 182 | return 231 183 | else 184 | return 255 185 | endif 186 | else 187 | if a:n == 0 188 | return 0 189 | else 190 | return 8 + (a:n * 10) 191 | endif 192 | endif 193 | endfun 194 | 195 | " returns the palette index for the given grey index 196 | fun! s:grey_color(n) 197 | if &t_Co == 88 198 | if a:n == 0 199 | return 16 200 | elseif a:n == 9 201 | return 79 202 | else 203 | return 79 + a:n 204 | endif 205 | else 206 | if a:n == 0 207 | return 16 208 | elseif a:n == 25 209 | return 231 210 | else 211 | return 231 + a:n 212 | endif 213 | endif 214 | endfun 215 | 216 | " returns an approximate color index for the given color level 217 | fun! s:rgb_number(x) 218 | if &t_Co == 88 219 | if a:x < 69 220 | return 0 221 | elseif a:x < 172 222 | return 1 223 | elseif a:x < 230 224 | return 2 225 | else 226 | return 3 227 | endif 228 | else 229 | if a:x < 75 230 | return 0 231 | else 232 | let l:n = (a:x - 55) / 40 233 | let l:m = (a:x - 55) % 40 234 | if l:m < 20 235 | return l:n 236 | else 237 | return l:n + 1 238 | endif 239 | endif 240 | endif 241 | endfun 242 | 243 | " returns the actual color level for the given color index 244 | fun! s:rgb_level(n) 245 | if &t_Co == 88 246 | if a:n == 0 247 | return 0 248 | elseif a:n == 1 249 | return 139 250 | elseif a:n == 2 251 | return 205 252 | else 253 | return 255 254 | endif 255 | else 256 | if a:n == 0 257 | return 0 258 | else 259 | return 55 + (a:n * 40) 260 | endif 261 | endif 262 | endfun 263 | 264 | " returns the palette index for the given R/G/B color indices 265 | fun! s:rgb_color(x, y, z) 266 | if &t_Co == 88 267 | return 16 + (a:x * 16) + (a:y * 4) + a:z 268 | else 269 | return 16 + (a:x * 36) + (a:y * 6) + a:z 270 | endif 271 | endfun 272 | 273 | " returns the palette index to approximate the given R/G/B color levels 274 | fun! s:color(r, g, b) 275 | " map greys directly (see xterm's 256colres.pl) 276 | if &t_Co == 256 && a:r == a:g && a:g == a:b && a:r > 3 && a:r < 243 277 | return float2nr(round(a:r - 8) / 10.0) + 232 278 | endif 279 | 280 | " get the closest grey 281 | let l:gx = s:grey_number(a:r) 282 | let l:gy = s:grey_number(a:g) 283 | let l:gz = s:grey_number(a:b) 284 | 285 | " get the closest color 286 | let l:x = s:rgb_number(a:r) 287 | let l:y = s:rgb_number(a:g) 288 | let l:z = s:rgb_number(a:b) 289 | 290 | if l:gx == l:gy && l:gy == l:gz 291 | " there are two possibilities 292 | let l:dgr = s:grey_level(l:gx) - a:r 293 | let l:dgg = s:grey_level(l:gy) - a:g 294 | let l:dgb = s:grey_level(l:gz) - a:b 295 | let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) 296 | let l:dr = s:rgb_level(l:gx) - a:r 297 | let l:dg = s:rgb_level(l:gy) - a:g 298 | let l:db = s:rgb_level(l:gz) - a:b 299 | let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) 300 | if l:dgrey < l:drgb 301 | " use the grey 302 | return s:grey_color(l:gx) 303 | else 304 | " use the color 305 | return s:rgb_color(l:x, l:y, l:z) 306 | endif 307 | else 308 | " only one possibility 309 | return s:rgb_color(l:x, l:y, l:z) 310 | endif 311 | endfun 312 | 313 | fun! s:is_empty_or_none(str) 314 | return empty(a:str) || a:str ==? "NONE" 315 | endfun 316 | 317 | " returns the palette index to approximate the 'rrggbb' hex string 318 | fun! s:rgb(rgb) 319 | if s:is_empty_or_none(a:rgb) 320 | return "NONE" 321 | endif 322 | let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 323 | let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 324 | let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 325 | return s:color(l:r, l:g, l:b) 326 | endfun 327 | 328 | fun! s:prefix_highlight_value_with(prefix, color) 329 | if s:is_empty_or_none(a:color) 330 | return "NONE" 331 | else 332 | return a:prefix . a:color 333 | endif 334 | endfun 335 | 336 | fun! s:remove_italic_attr(attr) 337 | let l:attr = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",") 338 | if empty(l:attr) 339 | let l:attr = "NONE" 340 | endif 341 | return l:attr 342 | endfun 343 | 344 | " sets the highlighting for the given group 345 | fun! s:X(group, fg, bg, attr, lcfg, lcbg) 346 | if s:low_color 347 | exec "hi ".a:group. 348 | \ " ctermfg=".s:prefix_highlight_value_with("", a:lcfg). 349 | \ " ctermbg=".s:prefix_highlight_value_with("", a:lcbg) 350 | else 351 | exec "hi ".a:group. 352 | \ " guifg=".s:prefix_highlight_value_with("#", a:fg). 353 | \ " guibg=".s:prefix_highlight_value_with("#", a:bg). 354 | \ " ctermfg=".s:rgb(a:fg). 355 | \ " ctermbg=".s:rgb(a:bg) 356 | endif 357 | 358 | let l:attr = s:prefix_highlight_value_with("", a:attr) 359 | 360 | if exists("g:jellybeans_use_term_italics") && g:jellybeans_use_term_italics 361 | let l:cterm_attr = l:attr 362 | else 363 | let l:cterm_attr = s:remove_italic_attr(l:attr) 364 | endif 365 | 366 | if !exists("g:jellybeans_use_gui_italics") || g:jellybeans_use_gui_italics 367 | let l:gui_attr = l:attr 368 | else 369 | let l:gui_attr = s:remove_italic_attr(l:attr) 370 | endif 371 | 372 | exec "hi ".a:group." gui=".l:gui_attr." cterm=".l:cterm_attr 373 | endfun 374 | " }}} 375 | 376 | call s:X("Normal","e8e8d3",s:background_color,"","White","") 377 | set background=dark 378 | 379 | if version >= 700 380 | call s:X("CursorLine","","1c1c1c","","",s:termBlack) 381 | call s:X("CursorColumn","","1c1c1c","","",s:termBlack) 382 | call s:X("MatchParen","ffffff","556779","bold","","DarkCyan") 383 | 384 | call s:X("TabLine","000000","b0b8c0","italic","",s:termBlack) 385 | call s:X("TabLineFill","9098a0","","","",s:termBlack) 386 | call s:X("TabLineSel","000000","f0f0f0","italic,bold",s:termBlack,"White") 387 | 388 | " Auto-completion 389 | call s:X("Pmenu","ffffff","606060","","White",s:termBlack) 390 | call s:X("PmenuSel","101010","eeeeee","",s:termBlack,"White") 391 | endif 392 | 393 | call s:X("Visual","","404040","","",s:termBlack) 394 | call s:X("Cursor",s:background_color,"b0d0f0","","","") 395 | 396 | call s:X("LineNr","605958",s:background_color,"NONE",s:termBlack,"") 397 | call s:X("CursorLineNr","ccc5c4","","NONE","White","") 398 | call s:X("Comment","888888","","italic","Grey","") 399 | call s:X("Todo","c7c7c7","","bold","White",s:termBlack) 400 | 401 | call s:X("StatusLine","000000","dddddd","italic","","White") 402 | call s:X("StatusLineNC","ffffff","403c41","italic","White","Black") 403 | call s:X("VertSplit","777777","403c41","",s:termBlack,s:termBlack) 404 | call s:X("WildMenu","f0a0c0","302028","","Magenta","") 405 | 406 | call s:X("Folded","a0a8b0","384048","italic",s:termBlack,"") 407 | call s:X("FoldColumn","535D66","1f1f1f","","",s:termBlack) 408 | call s:X("SignColumn","777777","333333","","",s:termBlack) 409 | call s:X("ColorColumn","","000000","","",s:termBlack) 410 | 411 | call s:X("Title","70b950","","bold","Green","") 412 | 413 | call s:X("Constant","cf6a4c","","","Red","") 414 | call s:X("Special","799d6a","","","Green","") 415 | call s:X("Delimiter","668799","","","Grey","") 416 | 417 | call s:X("String","99ad6a","","","Green","") 418 | call s:X("StringDelimiter","556633","","","DarkGreen","") 419 | 420 | call s:X("Identifier","c6b6ee","","","LightCyan","") 421 | call s:X("Structure","8fbfdc","","","LightCyan","") 422 | call s:X("Function","fad07a","","","Yellow","") 423 | call s:X("Statement","8197bf","","","DarkBlue","") 424 | call s:X("PreProc","8fbfdc","","","LightBlue","") 425 | 426 | hi! link Operator Structure 427 | hi! link Conceal Operator 428 | 429 | call s:X("Type","ffb964","","","Yellow","") 430 | call s:X("NonText","606060",s:background_color,"",s:termBlack,"") 431 | 432 | call s:X("SpecialKey","444444","1c1c1c","",s:termBlack,"") 433 | 434 | call s:X("Search","f0a0c0","302028","underline","Magenta","") 435 | 436 | call s:X("Directory","dad085","","","Yellow","") 437 | call s:X("ErrorMsg","","902020","","","DarkRed") 438 | hi! link Error ErrorMsg 439 | hi! link MoreMsg Special 440 | call s:X("Question","65C254","","","Green","") 441 | 442 | 443 | " Spell Checking 444 | 445 | call s:X("SpellBad","","902020","underline","","DarkRed") 446 | call s:X("SpellCap","","0000df","underline","","Blue") 447 | call s:X("SpellRare","","540063","underline","","DarkMagenta") 448 | call s:X("SpellLocal","","2D7067","underline","","Green") 449 | 450 | " Diff 451 | 452 | hi! link diffRemoved Constant 453 | hi! link diffAdded String 454 | 455 | " VimDiff 456 | 457 | call s:X("DiffAdd","D2EBBE","437019","","White","DarkGreen") 458 | call s:X("DiffDelete","40000A","700009","","DarkRed","DarkRed") 459 | call s:X("DiffChange","","2B5B77","","White","DarkBlue") 460 | call s:X("DiffText","8fbfdc","000000","reverse","Yellow","") 461 | 462 | " PHP 463 | 464 | hi! link phpFunctions Function 465 | call s:X("StorageClass","c59f6f","","","Red","") 466 | hi! link phpSuperglobal Identifier 467 | hi! link phpQuoteSingle StringDelimiter 468 | hi! link phpQuoteDouble StringDelimiter 469 | hi! link phpBoolean Constant 470 | hi! link phpNull Constant 471 | hi! link phpArrayPair Operator 472 | hi! link phpOperator Normal 473 | hi! link phpRelation Normal 474 | hi! link phpVarSelector Identifier 475 | 476 | " Python 477 | 478 | hi! link pythonOperator Statement 479 | 480 | " Ruby 481 | 482 | hi! link rubySharpBang Comment 483 | call s:X("rubyClass","447799","","","DarkBlue","") 484 | call s:X("rubyIdentifier","c6b6fe","","","Cyan","") 485 | hi! link rubyConstant Type 486 | hi! link rubyFunction Function 487 | 488 | call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","") 489 | call s:X("rubySymbol","7697d6","","","Blue","") 490 | hi! link rubyGlobalVariable rubyInstanceVariable 491 | hi! link rubyModule rubyClass 492 | call s:X("rubyControl","7597c6","","","Blue","") 493 | 494 | hi! link rubyString String 495 | hi! link rubyStringDelimiter StringDelimiter 496 | hi! link rubyInterpolationDelimiter Identifier 497 | 498 | call s:X("rubyRegexpDelimiter","540063","","","Magenta","") 499 | call s:X("rubyRegexp","dd0093","","","DarkMagenta","") 500 | call s:X("rubyRegexpSpecial","a40073","","","Magenta","") 501 | 502 | call s:X("rubyPredefinedIdentifier","de5577","","","Red","") 503 | 504 | " Erlang 505 | 506 | hi! link erlangAtom rubySymbol 507 | hi! link erlangBIF rubyPredefinedIdentifier 508 | hi! link erlangFunction rubyPredefinedIdentifier 509 | hi! link erlangDirective Statement 510 | hi! link erlangNode Identifier 511 | 512 | " Elixir 513 | 514 | hi! link elixirAtom rubySymbol 515 | 516 | 517 | " JavaScript 518 | 519 | hi! link javaScriptValue Constant 520 | hi! link javaScriptRegexpString rubyRegexp 521 | hi! link javaScriptTemplateVar StringDelim 522 | hi! link javaScriptTemplateDelim Identifier 523 | hi! link javaScriptTemplateString String 524 | 525 | " CoffeeScript 526 | 527 | hi! link coffeeRegExp javaScriptRegexpString 528 | 529 | " Lua 530 | 531 | hi! link luaOperator Conditional 532 | 533 | " C 534 | 535 | hi! link cFormat Identifier 536 | hi! link cOperator Constant 537 | 538 | " Objective-C/Cocoa 539 | 540 | hi! link objcClass Type 541 | hi! link cocoaClass objcClass 542 | hi! link objcSubclass objcClass 543 | hi! link objcSuperclass objcClass 544 | hi! link objcDirective rubyClass 545 | hi! link objcStatement Constant 546 | hi! link cocoaFunction Function 547 | hi! link objcMethodName Identifier 548 | hi! link objcMethodArg Normal 549 | hi! link objcMessageName Identifier 550 | 551 | " Vimscript 552 | 553 | hi! link vimOper Normal 554 | 555 | " HTML 556 | 557 | hi! link htmlTag Statement 558 | hi! link htmlEndTag htmlTag 559 | hi! link htmlTagName htmlTag 560 | 561 | " XML 562 | 563 | hi! link xmlTag Statement 564 | hi! link xmlEndTag xmlTag 565 | hi! link xmlTagName xmlTag 566 | hi! link xmlEqual xmlTag 567 | hi! link xmlEntity Special 568 | hi! link xmlEntityPunct xmlEntity 569 | hi! link xmlDocTypeDecl PreProc 570 | hi! link xmlDocTypeKeyword PreProc 571 | hi! link xmlProcessingDelim xmlAttrib 572 | 573 | " Debugger.vim 574 | 575 | call s:X("DbgCurrent","DEEBFE","345FA8","","White","DarkBlue") 576 | call s:X("DbgBreakPt","","4F0037","","","DarkMagenta") 577 | 578 | " vim-indent-guides 579 | 580 | if !exists("g:indent_guides_auto_colors") 581 | let g:indent_guides_auto_colors = 0 582 | endif 583 | call s:X("IndentGuidesOdd","","232323","","","") 584 | call s:X("IndentGuidesEven","","1b1b1b","","","") 585 | 586 | " Plugins, etc. 587 | 588 | hi! link TagListFileName Directory 589 | call s:X("PreciseJumpTarget","B9ED67","405026","","White","Green") 590 | 591 | " Manual overrides for 256-color terminals. Dark colors auto-map badly. 592 | if !s:low_color 593 | hi StatusLineNC ctermbg=235 594 | hi Folded ctermbg=236 595 | hi DiffText ctermfg=81 596 | hi DbgBreakPt ctermbg=53 597 | hi IndentGuidesOdd ctermbg=235 598 | hi IndentGuidesEven ctermbg=234 599 | endif 600 | 601 | if !empty("s:overrides") 602 | fun! s:current_attr(group) 603 | let l:synid = synIDtrans(hlID(a:group)) 604 | let l:attrs = [] 605 | for l:attr in ["bold", "italic", "reverse", "standout", "underline", "undercurl"] 606 | if synIDattr(l:synid, l:attr, "gui") == 1 607 | call add(l:attrs, l:attr) 608 | endif 609 | endfor 610 | return join(l:attrs, ",") 611 | endfun 612 | fun! s:current_color(group, what, mode) 613 | let l:color = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode) 614 | if l:color == -1 615 | return "" 616 | else 617 | return substitute(l:color, "^#", "", "") 618 | endif 619 | endfun 620 | fun! s:load_color_def(group, def) 621 | call s:X(a:group, get(a:def, "guifg", s:current_color(a:group, "fg", "gui")), 622 | \ get(a:def, "guibg", s:current_color(a:group, "bg", "gui")), 623 | \ get(a:def, "attr", s:current_attr(a:group)), 624 | \ get(a:def, "ctermfg", s:current_color(a:group, "fg", "cterm")), 625 | \ get(a:def, "ctermbg", s:current_color(a:group, "bg", "cterm"))) 626 | if !s:low_color 627 | for l:prop in ["ctermfg", "ctermbg"] 628 | let l:override_key = "256".l:prop 629 | if has_key(a:def, l:override_key) 630 | exec "hi ".a:group." ".l:prop."=".a:def[l:override_key] 631 | endif 632 | endfor 633 | endif 634 | endfun 635 | fun! s:load_colors(defs) 636 | for [l:group, l:def] in items(a:defs) 637 | if l:group == "background" 638 | call s:load_color_def("LineNr", l:def) 639 | call s:load_color_def("NonText", l:def) 640 | call s:load_color_def("Normal", l:def) 641 | else 642 | call s:load_color_def(l:group, l:def) 643 | endif 644 | unlet l:group 645 | unlet l:def 646 | endfor 647 | endfun 648 | call s:load_colors(s:overrides) 649 | delf s:load_colors 650 | delf s:load_color_def 651 | delf s:current_color 652 | delf s:current_attr 653 | endif 654 | 655 | " delete functions {{{ 656 | delf s:X 657 | delf s:remove_italic_attr 658 | delf s:prefix_highlight_value_with 659 | delf s:rgb 660 | delf s:is_empty_or_none 661 | delf s:color 662 | delf s:rgb_color 663 | delf s:rgb_level 664 | delf s:rgb_number 665 | delf s:grey_color 666 | delf s:grey_level 667 | delf s:grey_number 668 | " }}} 669 | -------------------------------------------------------------------------------- /tmux/tmux.conf: -------------------------------------------------------------------------------- 1 | # : << EOF 2 | # https://github.com/gpakosz/.tmux 3 | # (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, 4 | # without any warranty. 5 | # Copyright 2012— Gregory Pakosz (@gpakosz). 6 | # /!\ do not edit this file 7 | # instead, override settings in ~/.tmux.conf.local, see README.md 8 | 9 | 10 | # -- general ------------------------------------------------------------------- 11 | 12 | set -g default-terminal "screen-256color" # colors! 13 | setw -g xterm-keys on 14 | set -s escape-time 10 # faster command sequences 15 | set -sg repeat-time 600 # increase repeat timeout 16 | set -s focus-events on 17 | 18 | set -g prefix2 C-a # GNU-Screen compatible prefix 19 | bind C-a send-prefix -2 20 | 21 | set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) 22 | setw -q -g utf8 on 23 | 24 | set -g history-limit 5000 # boost history 25 | 26 | # edit configuration 27 | bind e new-window -n "~/.tmux.conf.local" "EDITOR=\${EDITOR//mvim/vim} && EDITOR=\${EDITOR//gvim/vim} && \${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"" 28 | 29 | # reload configuration 30 | bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced' 31 | 32 | 33 | # -- display ------------------------------------------------------------------- 34 | 35 | set -g base-index 1 # start windows numbering at 1 36 | setw -g pane-base-index 1 # make pane numbering consistent with windows 37 | 38 | setw -g automatic-rename on # rename window to reflect current program 39 | set -g renumber-windows on # renumber windows when a window is closed 40 | 41 | set -g set-titles on # set terminal title 42 | 43 | set -g display-panes-time 800 # slightly longer pane indicators display time 44 | set -g display-time 1000 # slightly longer status messages display time 45 | 46 | set -g status-interval 10 # redraw status line every 10 seconds 47 | 48 | # clear both screen and history 49 | bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history 50 | 51 | # activity 52 | set -g monitor-activity on 53 | set -g visual-activity off 54 | 55 | 56 | # -- navigation ---------------------------------------------------------------- 57 | 58 | # create session 59 | bind C-c new-session 60 | 61 | # find session 62 | bind C-f command-prompt -p find-session 'switch-client -t %%' 63 | 64 | # split current window horizontally 65 | bind - split-window -v 66 | # split current window vertically 67 | bind _ split-window -h 68 | 69 | # pane navigation 70 | bind -r h select-pane -L # move left 71 | bind -r j select-pane -D # move down 72 | bind -r k select-pane -U # move up 73 | bind -r l select-pane -R # move right 74 | bind > swap-pane -D # swap current pane with the next one 75 | bind < swap-pane -U # swap current pane with the previous one 76 | 77 | # maximize current pane 78 | bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane "#{session_name}" #D' 79 | 80 | # pane resizing 81 | bind -r H resize-pane -L 2 82 | bind -r J resize-pane -D 2 83 | bind -r K resize-pane -U 2 84 | bind -r L resize-pane -R 2 85 | 86 | # window navigation 87 | unbind n 88 | unbind p 89 | bind -r C-h previous-window # select previous window 90 | bind -r C-l next-window # select next window 91 | bind Tab last-window # move to last active window 92 | 93 | # toggle mouse 94 | bind m run "cut -c3- ~/.tmux.conf | sh -s _toggle_mouse" 95 | 96 | 97 | # -- urlview ------------------------------------------------------------------- 98 | 99 | bind U run "cut -c3- ~/.tmux.conf | sh -s _urlview #{pane_id}" 100 | 101 | 102 | # -- facebook pathpicker ------------------------------------------------------- 103 | 104 | bind F run "cut -c3- ~/.tmux.conf | sh -s _fpp #{pane_id}" 105 | 106 | 107 | # -- list choice (tmux < 2.4) -------------------------------------------------- 108 | 109 | # vi-choice is gone in tmux >= 2.4 110 | run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true' 111 | run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true' 112 | run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true' 113 | run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true' 114 | run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true' 115 | run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true' 116 | run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true' 117 | 118 | 119 | # -- edit mode (tmux < 2.4) ---------------------------------------------------- 120 | 121 | # vi-edit is gone in tmux >= 2.4 122 | run -b 'tmux bind -ct vi-edit H start-of-line 2> /dev/null || true' 123 | run -b 'tmux bind -ct vi-edit L end-of-line 2> /dev/null || true' 124 | run -b 'tmux bind -ct vi-edit q cancel 2> /dev/null || true' 125 | run -b 'tmux bind -ct vi-edit Escape cancel 2> /dev/null || true' 126 | 127 | 128 | # -- copy mode ----------------------------------------------------------------- 129 | 130 | bind Enter copy-mode # enter copy mode 131 | 132 | run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true' 133 | run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true' 134 | run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true' 135 | run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true' 136 | run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true' 137 | run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true' 138 | run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true' 139 | run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true' 140 | run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true' 141 | run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true' 142 | run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true' 143 | run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true' 144 | 145 | # copy to macOS clipboard 146 | if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"' 147 | if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"' 148 | # copy to X11 clipboard 149 | if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"' 150 | if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' 151 | # copy to Windows clipboard 152 | if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"' 153 | if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"' 154 | 155 | 156 | # -- buffers ------------------------------------------------------------------- 157 | 158 | bind b list-buffers # list paste buffers 159 | bind p paste-buffer # paste from the top paste buffer 160 | bind P choose-buffer # choose which buffer to paste from 161 | 162 | 163 | # -- user defined overrides ---------------------------------------------------- 164 | 165 | if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' 166 | 167 | 168 | # -- 8< ------------------------------------------------------------------------ 169 | 170 | run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' 171 | run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-time 3000 \; display "This configuration will soon require tmux >= 2.4" \; set -u display-time || true' 172 | 173 | 174 | # EOF 175 | # 176 | # # exit the script if any statement returns a non-true return value 177 | # set -e 178 | # 179 | # unset GREP_OPTIONS 180 | # export LC_NUMERIC=C 181 | # 182 | # if ! printf '' | sed -E 's///' 2>/dev/null; then 183 | # if printf '' | sed -r 's///' 2>/dev/null; then 184 | # sed () { 185 | # n=$#; while [ "$n" -gt 0 ]; do arg=$1; shift; case $arg in -E*) arg=-r${arg#-E};; esac; set -- "$@" "$arg"; n=$(( n - 1 )); done 186 | # command sed "$@" 187 | # } 188 | # fi 189 | # fi 190 | # 191 | # _uname_s=$(uname -s) 192 | # 193 | # _tmux_version=$(tmux -V | tr -cd '[:digit:].' | cut -d' ' -f2 | awk -F '.' '{print $1 * 100 + $2}') 194 | # 195 | # _is_enabled() { 196 | # [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ] 197 | # } 198 | # 199 | # _circled() { 200 | # circled_digits='⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳' 201 | # if [ "$1" -le 20 ] 2>/dev/null; then 202 | # i=$(( $1 + 1 )) 203 | # eval set -- "$circled_digits" 204 | # eval echo "\${$i}" 205 | # else 206 | # echo "$1" 207 | # fi 208 | # } 209 | # 210 | # _decode_unicode_escapes() { 211 | # printf '%s' "$*" | perl -CS -pe 's/(\\u([0-9A-Fa-f]{1,4})|\\U([0-9A-Fa-f]{1,8}))/chr(hex($2.$3))/eg' 2>/dev/null 212 | # } 213 | # 214 | # if command -v pkill > /dev/null 2>&1; then 215 | # _pkillf() { 216 | # pkill -f "$@" || true 217 | # } 218 | # else 219 | # case "$_uname_s" in 220 | # *CYGWIN*) 221 | # _pkillf() { 222 | # while IFS= read -r pid; do 223 | # kill "$pid" || true 224 | # done << EOF 225 | # $(grep -Eao "$@" /proc/*/cmdline | xargs -0 | sed -E -n 's,/proc/([0-9]+)/.+$,\1,pg') 226 | # EOF 227 | # } 228 | # ;; 229 | # *) 230 | # _pkillf() { 231 | # while IFS= read -r pid; do 232 | # kill "$pid" || true 233 | # done << EOF 234 | # $(ps -x -o pid= -o command= | grep -E "$@" | cut -d' ' -f1) 235 | # EOF 236 | # } 237 | # ;; 238 | # esac 239 | # fi 240 | # 241 | # _maximize_pane() { 242 | # current_session=${1:-$(tmux display -p '#{session_name}')} 243 | # current_pane=${2:-$(tmux display -p '#{pane_id}')} 244 | # 245 | # dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -E -o '^1 %.+maximized.+$' || true) 246 | # restore=$(printf "%s" "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+'(%[0-9]+)'\"?$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p"\ 247 | # -e "s/^1 (%[0-9]+) .+maximized.+'$current_pane'\"?$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p") 248 | # 249 | # if [ -z "$restore" ]; then 250 | # [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return 251 | # current_pane_height=$(tmux display -t "$current_pane" -p "#{pane_height}") 252 | # info=$(tmux new-window -t "$current_session:" -F "#{session_name}:#{window_index}.#{pane_id}" -P "maximized... 2>/dev/null & tmux setw -t \"$current_session:\" remain-on-exit on; printf \"\\033[\$(tput lines);0fPane has been maximized, press + to restore\n\" '$current_pane'") 253 | # session_window=${info%.*} 254 | # new_pane=${info#*.} 255 | # 256 | # retry=1000 257 | # while [ x"$(tmux list-panes -t "$session_window" -F '#{session_name}:#{window_index}.#{pane_id} #{pane_dead}' 2>/dev/null)" != x"$info 1" ] && [ "$retry" -ne 0 ]; do 258 | # sleep 0.1 259 | # retry=$((retry - 1)) 260 | # done 261 | # if [ "$retry" -eq 0 ]; then 262 | # tmux display 'Unable to maximize pane' 263 | # fi 264 | # 265 | # tmux setw -t "$session_window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane" 266 | # else 267 | # $restore || tmux kill-pane 268 | # fi 269 | # } 270 | # 271 | # _toggle_mouse() { 272 | # old=$(tmux show -gv mouse) 273 | # new="" 274 | # 275 | # if [ "$old" = "on" ]; then 276 | # new="off" 277 | # else 278 | # new="on" 279 | # fi 280 | # 281 | # tmux set -g mouse $new 282 | # } 283 | # 284 | # _battery_info() { 285 | # count=0 286 | # charge=0 287 | # case "$_uname_s" in 288 | # *Darwin*) 289 | # while IFS= read -r line; do 290 | # [ -z "$line" ] && continue 291 | # discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") 292 | # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%') 293 | # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') 294 | # count=$((count + 1)) 295 | # done << EOF 296 | # $(pmset -g batt | grep 'InternalBattery') 297 | # EOF 298 | # ;; 299 | # *Linux*) 300 | # while IFS= read -r batpath; do 301 | # [ -z "$batpath" ] && continue 302 | # grep -i -q device "$batpath/scope" 2> /dev/null && continue 303 | # 304 | # discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false") 305 | # bat_capacity="$batpath/capacity" 306 | # if [ -r "$bat_capacity" ]; then 307 | # charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }') 308 | # else 309 | # bat_energy_full="$batpath/energy_full" 310 | # bat_energy_now="$batpath/energy_now" 311 | # if [ -r "$bat_energy_full" ] && [ -r "$bat_energy_now" ]; then 312 | # charge=$(awk -v charge="$charge" -v energy_now="$(cat "$bat_energy_now")" -v energy_full="$(cat "$bat_energy_full")" 'BEGIN { print charge + energy_now / energy_full }') 313 | # fi 314 | # fi 315 | # count=$((count + 1)) 316 | # done << EOF 317 | # $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*') 318 | # EOF 319 | # ;; 320 | # *CYGWIN*|*MSYS*|*MINGW*) 321 | # while IFS= read -r line; do 322 | # [ -z "$line" ] && continue 323 | # discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }') 324 | # charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }') 325 | # count=$((count + 1)) 326 | # done << EOF 327 | # $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining 2> /dev/null | tr -d '\r' | tail -n +2 || true) 328 | # EOF 329 | # ;; 330 | # *OpenBSD*) 331 | # for batid in 0 1 2; do 332 | # sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue 333 | # discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false") 334 | # if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then 335 | # charge=$(awk -v charge="$charge" -v remaining="$(sysctl -n hw.sensors.acpibat$batid.amphour3 | cut -d' ' -f1)" -v full="$(sysctl -n hw.sensors.acpibat$batid.amphour0 | cut -d' ' -f1)" 'BEGIN { print charge + remaining / full }') 336 | # else 337 | # charge=$(awk -v charge="$charge" -v remaining="$(sysctl -n hw.sensors.acpibat$batid.watthour3 | cut -d' ' -f1)" -v full="$(sysctl -n hw.sensors.acpibat$batid.watthour0 | cut -d' ' -f1)" 'BEGIN { print charge + remaining / full }') 338 | # fi 339 | # count=$((count + 1)) 340 | # done 341 | # ;; 342 | # esac 343 | # [ "$count" -ne 0 ] && charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }') || true 344 | # } 345 | # 346 | # _battery_status() { 347 | # _battery_info 348 | # if [ "$charge" = 0 ]; then 349 | # tmux set -ug '@battery_status' 350 | # return 351 | # fi 352 | # 353 | # battery_status_charging=$1 354 | # battery_status_discharging=$2 355 | # if [ x"$discharging" = x"true" ]; then 356 | # battery_status="$battery_status_discharging" 357 | # else 358 | # battery_status="$battery_status_charging" 359 | # fi 360 | # 361 | # tmux set -g '@battery_status' "$battery_status" 362 | # } 363 | # 364 | # _battery_bar() { 365 | # _battery_info 366 | # if [ "$charge" = 0 ]; then 367 | # tmux set -ug '@battery_bar' \;\ 368 | # set -ug '@battery_hbar' \;\ 369 | # set -ug '@battery_vbar' \;\ 370 | # set -ug '@battery_percentage' 371 | # return 372 | # fi 373 | # 374 | # battery_bar_symbol_full=$1 375 | # battery_bar_symbol_empty=$2 376 | # battery_bar_length=$3 377 | # battery_bar_palette=$4 378 | # battery_hbar_palette=$5 379 | # battery_vbar_palette=$6 380 | # 381 | # if [ x"$battery_bar_length" = x"auto" ]; then 382 | # columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80) 383 | # if [ "$columns" -ge 80 ]; then 384 | # battery_bar_length=10 385 | # else 386 | # battery_bar_length=5 387 | # fi 388 | # fi 389 | # 390 | # if echo "$battery_bar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then 391 | # # shellcheck disable=SC2086 392 | # { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; } 393 | # palette_style=$1 394 | # battery_bg=${2:-none} 395 | # [ x"$palette_style" = x"gradient" ] && \ 396 | # palette="196 202 208 214 220 226 190 154 118 82 46" 397 | # [ x"$palette_style" = x"heat" ] && \ 398 | # palette="243 245 247 144 143 142 184 214 208 202 196" 399 | # 400 | # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }') 401 | # eval set -- "$palette" 402 | # 403 | # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") 404 | # battery_bar="#[bg=$battery_bg]" 405 | # # shellcheck disable=SC2046 406 | # [ "$full" -gt 0 ] && \ 407 | # battery_bar="$battery_bar$(printf "#[fg=colour%s]$battery_bar_symbol_full" $(echo "$palette" | cut -d' ' -f1-"$full"))" 408 | # # shellcheck disable=SC2046 409 | # empty=$((battery_bar_length - full)) 410 | # # shellcheck disable=SC2046 411 | # [ "$empty" -gt 0 ] && \ 412 | # battery_bar="$battery_bar$(printf "#[fg=colour%s]$battery_bar_symbol_empty" $(echo "$palette" | cut -d' ' -f$((full + 1))-$((full + empty))))" 413 | # eval battery_bar="$battery_bar#[fg=colour\${$((full == 0 ? 1 : full))}]" 414 | # elif echo "$battery_bar_palette" | grep -q -E '^(([#a-z0-9]{7,9}|none),?){3}$'; then 415 | # # shellcheck disable=SC2086 416 | # { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; } 417 | # battery_full_fg=$1 418 | # battery_empty_fg=$2 419 | # battery_bg=$3 420 | # 421 | # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") 422 | # [ x"$battery_bg" != x"none" ] && \ 423 | # battery_bar="#[bg=$battery_bg]" 424 | # #shellcheck disable=SC2046 425 | # [ "$full" -gt 0 ] && \ 426 | # battery_bar="$battery_bar#[fg=$battery_full_fg]$(printf "%0.s$battery_bar_symbol_full" $(seq 1 "$full"))" 427 | # empty=$((battery_bar_length - full)) 428 | # #shellcheck disable=SC2046 429 | # [ "$empty" -gt 0 ] && \ 430 | # battery_bar="$battery_bar#[fg=$battery_empty_fg]$(printf "%0.s$battery_bar_symbol_empty" $(seq 1 "$empty"))" && \ 431 | # battery_bar="$battery_bar#[fg=$battery_empty_fg]" 432 | # fi 433 | # 434 | # if echo "$battery_hbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then 435 | # # shellcheck disable=SC2086 436 | # { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; } 437 | # palette_style=$1 438 | # [ x"$palette_style" = x"gradient" ] && \ 439 | # palette="196 202 208 214 220 226 190 154 118 82 46" 440 | # [ x"$palette_style" = x"heat" ] && \ 441 | # palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196" 442 | # 443 | # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }') 444 | # eval set -- "$palette" 445 | # 446 | # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") 447 | # eval battery_hbar_fg="colour\${$((full == 0 ? 1 : full))}" 448 | # elif echo "$battery_hbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then 449 | # # shellcheck disable=SC2086 450 | # { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; } 451 | # 452 | # # shellcheck disable=SC2046 453 | # eval $(awk "BEGIN { printf \"battery_hbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }") 454 | # fi 455 | # 456 | # eval set -- "▏ ▎ ▍ ▌ ▋ ▊ ▉ █" 457 | # # shellcheck disable=SC2046 458 | # eval $(awk "BEGIN { printf \"battery_hbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }") 459 | # battery_hbar="#[fg=${battery_hbar_fg?}]${battery_hbar_symbol?}" 460 | # 461 | # if echo "$battery_vbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then 462 | # # shellcheck disable=SC2086 463 | # { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; } 464 | # palette_style=$1 465 | # [ x"$palette_style" = x"gradient" ] && \ 466 | # palette="196 202 208 214 220 226 190 154 118 82 46" 467 | # [ x"$palette_style" = x"heat" ] && \ 468 | # palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196" 469 | # 470 | # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }') 471 | # eval set -- "$palette" 472 | # 473 | # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") 474 | # eval battery_vbar_fg="colour\${$((full == 0 ? 1 : full))}" 475 | # elif echo "$battery_vbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then 476 | # # shellcheck disable=SC2086 477 | # { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; } 478 | # 479 | # # shellcheck disable=SC2046 480 | # eval $(awk "BEGIN { printf \"battery_vbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }") 481 | # fi 482 | # 483 | # eval set -- "▁ ▂ ▃ ▄ ▅ ▆ ▇ █" 484 | # # shellcheck disable=SC2046 485 | # eval $(awk "BEGIN { printf \"battery_vbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }") 486 | # battery_vbar="#[fg=${battery_vbar_fg?}]${battery_vbar_symbol?}" 487 | # 488 | # battery_percentage="$(awk "BEGIN { printf \"%.0f%%\", ($charge) * 100 }")" 489 | # 490 | # tmux set -g '@battery_status' "$battery_status" \;\ 491 | # set -g '@battery_bar' "$battery_bar" \;\ 492 | # set -g '@battery_hbar' "$battery_hbar" \;\ 493 | # set -g '@battery_vbar' "$battery_vbar" \;\ 494 | # set -g '@battery_percentage' "$battery_percentage" 495 | # } 496 | # 497 | # _tty_info() { 498 | # tty="${1##/dev/}" 499 | # case "$_uname_s" in 500 | # *CYGWIN*) 501 | # ps -al | tail -n +2 | awk -v tty="$tty" ' 502 | # ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty { 503 | # user[$1] = $6; parent[$1] = $2; child[$2] = $1 504 | # } 505 | # END { 506 | # for (i in parent) 507 | # { 508 | # j = i 509 | # while (parent[j]) 510 | # j = parent[j] 511 | # 512 | # if (!(i in child) && j != 1) 513 | # { 514 | # file = "/proc/" i "/cmdline"; getline command < file; close(file) 515 | # gsub(/\0/, " ", command) 516 | # "id -un " user[i] | getline username 517 | # print i":"username":"command 518 | # exit 519 | # } 520 | # } 521 | # } 522 | # ' 523 | # ;; 524 | # *) 525 | # ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk ' 526 | # NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) { 527 | # user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) 528 | # } 529 | # END { 530 | # for (i in parent) 531 | # { 532 | # j = i 533 | # while (parent[j]) 534 | # j = parent[j] 535 | # 536 | # if (!(i in child) && j != 1) 537 | # { 538 | # print i":"user[i]":"command[i] 539 | # exit 540 | # } 541 | # } 542 | # } 543 | # ' 544 | # ;; 545 | # esac 546 | # } 547 | # 548 | # _ssh_or_mosh_args() { 549 | # case "$1" in 550 | # *ssh*) 551 | # args=$(printf '%s' "$1" | perl -n -e 'print if s/(.*?)\bssh\b\s+(.*)/\2/') 552 | # ;; 553 | # *mosh-client*) 554 | # args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g') 555 | # ;; 556 | # esac 557 | # 558 | # printf '%s' "$args" 559 | # } 560 | # 561 | # _username() { 562 | # tty=${1:-$(tmux display -p '#{pane_tty}')} 563 | # ssh_only=$2 564 | # 565 | # tty_info=$(_tty_info "$tty") 566 | # command=${tty_info#*:} 567 | # command=${command#*:} 568 | # 569 | # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") 570 | # if [ -n "$ssh_or_mosh_args" ]; then 571 | # # shellcheck disable=SC2086 572 | # username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }') 573 | # # shellcheck disable=SC2086 574 | # [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%username% / { print $2; exit }') 575 | # else 576 | # if ! _is_enabled "$ssh_only"; then 577 | # username=${tty_info#*:} 578 | # username=${username%%:*} 579 | # fi 580 | # fi 581 | # 582 | # printf '%s\n' "$username" 583 | # } 584 | # 585 | # _hostname() { 586 | # tty=${1:-$(tmux display -p '#{pane_tty}')} 587 | # ssh_only=$2 588 | # full=$3 589 | # h_or_H=$4 590 | # 591 | # tty_info=$(_tty_info "$tty") 592 | # command=${tty_info#*:} 593 | # command=${command#*:} 594 | # 595 | # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") 596 | # if [ -n "$ssh_or_mosh_args" ]; then 597 | # # shellcheck disable=SC2086 598 | # hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^hostname / { print $2; exit }') 599 | # # shellcheck disable=SC2086 600 | # [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%hostname% / { print $2; exit }') 601 | # 602 | # if ! _is_enabled "$full"; then 603 | # case "$hostname" in 604 | # *[a-z-].*) 605 | # hostname=${hostname%%.*} 606 | # ;; 607 | # 127.0.0.1) 608 | # hostname="localhost" 609 | # ;; 610 | # esac 611 | # fi 612 | # else 613 | # if ! _is_enabled "$ssh_only"; then 614 | # hostname="$h_or_H" 615 | # fi 616 | # fi 617 | # 618 | # printf '%s\n' "$hostname" 619 | # } 620 | # 621 | # _root() { 622 | # tty=${1:-$(tmux display -p '#{pane_tty}')} 623 | # root=$2 624 | # 625 | # username=$(_username "$tty" false) 626 | # 627 | # [ x"$username" = x"root" ] && echo "$root" 628 | # } 629 | # 630 | # _uptime() { 631 | # case "$_uname_s" in 632 | # *Darwin*|*FreeBSD*) 633 | # boot=$(sysctl -q -n kern.boottime | awk -F'[ ,:]+' '{ print $4 }') 634 | # now=$(date +%s) 635 | # ;; 636 | # *Linux*|*CYGWIN*|*MSYS*|*MINGW*) 637 | # boot=0 638 | # now=$(cut -d' ' -f1 < /proc/uptime) 639 | # ;; 640 | # *OpenBSD*) 641 | # boot=$(sysctl -n kern.boottime) 642 | # now=$(date +%s) 643 | # esac 644 | # # shellcheck disable=SC1004 645 | # awk -v boot="$boot" -v now="$now" ' 646 | # BEGIN { 647 | # uptime = now - boot 648 | # y = int(uptime / 31536000) 649 | # dy = int(uptime / 86400) % 365 650 | # d = int(uptime / 86400) 651 | # h = int(uptime / 3600) % 24 652 | # m = int(uptime / 60) % 60 653 | # s = int(uptime) % 60 654 | # 655 | # system("tmux set -g @uptime_y " y + 0 " \\; " \ 656 | # "set -g @uptime_dy " dy + 0 " \\; " \ 657 | # "set -g @uptime_d " d + 0 " \\; " \ 658 | # "set -g @uptime_h " h + 0 " \\; " \ 659 | # "set -g @uptime_m " m + 0 " \\; " \ 660 | # "set -g @uptime_s " s + 0) 661 | # }' 662 | # } 663 | # 664 | # _loadavg() { 665 | # case "$_uname_s" in 666 | # *Darwin*|*FreeBSD*) 667 | # tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f2)" 668 | # ;; 669 | # *Linux*|*CYGWIN*) 670 | # tmux set -g @loadavg "$(cut -d' ' -f1 < /proc/loadavg)" 671 | # ;; 672 | # *OpenBSD*) 673 | # tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f1)" 674 | # ;; 675 | # esac 676 | # } 677 | # 678 | # _split_window_ssh() { 679 | # tty=${1:-$(tmux display -p '#{pane_tty}')} 680 | # shift 681 | # 682 | # tty_info=$(_tty_info "$tty") 683 | # command=${tty_info#*:} 684 | # command=${command#*:} 685 | # 686 | # case "$command" in 687 | # *mosh-client*) 688 | # # shellcheck disable=SC2046 689 | # tmux split-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/') 690 | # ;; 691 | # *ssh*) 692 | # # shellcheck disable=SC2046 693 | # tmux split-window "$@" $(echo "$command" | sed -e 's/;/\\;/g') 694 | # ;; 695 | # *) 696 | # tmux split-window "$@" 697 | # esac 698 | # } 699 | # 700 | # _split_window() { 701 | # _split_window_ssh "$@" 702 | # } 703 | # 704 | # _apply_overrides() { 705 | # tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false} 706 | # tmux_conf_24b_colour=${tmux_conf_24b_colour:-$tmux_conf_theme_24b_colour} 707 | # if _is_enabled "$tmux_conf_24b_colour"; then 708 | # case "$TERM" in 709 | # screen-*|tmux-*) 710 | # ;; 711 | # *) 712 | # tmux set-option -ga terminal-overrides ",*256col*:Tc" 713 | # ;; 714 | # esac 715 | # fi 716 | # } 717 | # 718 | # _apply_bindings() { 719 | # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT 720 | # 721 | # tmux list-keys | grep -vF 'tmux.conf.local' | grep -E 'new-window|split(-|_)window|new-session|copy-selection|copy-pipe' > "$cfg" 722 | # 723 | # # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the 724 | # # output of list-keys can be truncated 725 | # perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg" 726 | # 727 | # perl -p -i -e " 728 | # s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g 729 | # ; 730 | # s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_tty}\2\5\1/g 731 | # ; 732 | # s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{pane_tty\}\3)(.*?)\2/split-window\4/g 733 | # ; 734 | # s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \ 735 | # "$cfg" 736 | # 737 | # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false} 738 | # if _is_enabled "$tmux_conf_new_window_retain_current_path"; then 739 | # perl -p -i -e " 740 | # s/\bnew-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/ 741 | # ; 742 | # s/\bnew-window\b/new-window -c '#\{pane_current_path\}'/g" \ 743 | # "$cfg" 744 | # fi 745 | # 746 | # perl -p -i -e " 747 | # s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ 748 | # "$cfg" 749 | # 750 | # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} 751 | # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} 752 | # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then 753 | # perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_tty\}\1'/g" "$cfg" 754 | # fi 755 | # 756 | # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then 757 | # perl -p -i -e " 758 | # s/\bsplit-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/ 759 | # ; 760 | # s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g 761 | # ; 762 | # s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\2'/g if /\bdisplay-menu\b/ 763 | # ; 764 | # s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{pane_tty\} -c \"#\{pane_current_path\}\"\2'/g" \ 765 | # "$cfg" 766 | # fi 767 | # 768 | # tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false} 769 | # if _is_enabled "$tmux_conf_new_session_prompt"; then 770 | # perl -p -i \ 771 | # -e "s/(? /dev/null 2>&1 && command='pbcopy' 781 | # command -v reattach-to-user-namespace > /dev/null 2>&1 && command='reattach-to-user-namespace pbcopy' 782 | # command -v xsel > /dev/null 2>&1 && command='xsel -i -b' 783 | # ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1' 784 | # command -v clip.exe > /dev/null 2>&1 && command='clip\.exe' 785 | # [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard' 786 | # 787 | # if [ -n "$command" ]; then 788 | # if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then 789 | # perl -p -i -e "s/\bcopy-selection(-and-cancel)?\b/copy-pipe\1 '$command'/g" "$cfg" 790 | # else 791 | # perl -p -i -e "s/\bcopy-pipe(-and-cancel)?\b\s+(\"|')?$command\2/copy-selection\1/g" "$cfg" 792 | # fi 793 | # fi 794 | # 795 | # # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings 796 | # awk < "$cfg" \ 797 | # '{i = $2 == "-T" ? 4 : 5; gsub(/^[;]$/, "\\\\&", $i); gsub(/^[$"#~]$/, "'"'"'&'"'"'", $i); gsub(/^['"'"']$/, "\"&\"", $i); print}' > "$cfg.in" 798 | # 799 | # # ignore bindings with errors 800 | # if ! tmux source-file "$cfg.in"; then 801 | # verbose_flag=$(tmux source-file -v /dev/null 2> /dev/null && printf -- '-v' || true) 802 | # while ! out=$(tmux source-file "$verbose_flag" "$cfg.in"); do 803 | # line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2) 804 | # perl -n -i -e "if ($. != $line) { print }" "$cfg.in" 805 | # done 806 | # fi 807 | # } 808 | # 809 | # _apply_theme() { 810 | # 811 | # # -- default theme ----------------------------------------------------- 812 | # 813 | # tmux_conf_theme_colour_1=${tmux_conf_theme_colour_1:-#080808} # dark gray 814 | # tmux_conf_theme_colour_2=${tmux_conf_theme_colour_2:-#303030} # gray 815 | # tmux_conf_theme_colour_3=${tmux_conf_theme_colour_3:-#8a8a8a} # light gray 816 | # tmux_conf_theme_colour_4=${tmux_conf_theme_colour_4:-#00afff} # light blue 817 | # tmux_conf_theme_colour_5=${tmux_conf_theme_colour_5:-#ffff00} # yellow 818 | # tmux_conf_theme_colour_6=${tmux_conf_theme_colour_6:-#080808} # dark gray 819 | # tmux_conf_theme_colour_7=${tmux_conf_theme_colour_7:-#e4e4e4} # white 820 | # tmux_conf_theme_colour_8=${tmux_conf_theme_colour_8:-#080808} # dark gray 821 | # tmux_conf_theme_colour_9=${tmux_conf_theme_colour_9:-#ffff00} # yellow 822 | # tmux_conf_theme_colour_10=${tmux_conf_theme_colour_10:-#ff00af} # pink 823 | # tmux_conf_theme_colour_11=${tmux_conf_theme_colour_11:-#5fff00} # green 824 | # tmux_conf_theme_colour_12=${tmux_conf_theme_colour_12:-#8a8a8a} # light gray 825 | # tmux_conf_theme_colour_13=${tmux_conf_theme_colour_13:-#e4e4e4} # white 826 | # tmux_conf_theme_colour_14=${tmux_conf_theme_colour_14:-#080808} # dark gray 827 | # tmux_conf_theme_colour_15=${tmux_conf_theme_colour_15:-#080808} # dark gray 828 | # tmux_conf_theme_colour_16=${tmux_conf_theme_colour_16:-#d70000} # red 829 | # tmux_conf_theme_colour_17=${tmux_conf_theme_colour_17:-#e4e4e4} # white 830 | # 831 | # # -- panes ------------------------------------------------------------- 832 | # 833 | # tmux_conf_theme_window_fg=${tmux_conf_theme_window_fg:-default} 834 | # tmux_conf_theme_window_bg=${tmux_conf_theme_window_bg:-default} 835 | # tmux_conf_theme_highlight_focused_pane=${tmux_conf_theme_highlight_focused_pane:-false} 836 | # tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-default} 837 | # tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-$tmux_conf_theme_colour_2} 838 | # 839 | # window_style="fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg" 840 | # if _is_enabled "$tmux_conf_theme_highlight_focused_pane"; then 841 | # window_active_style="fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg" 842 | # else 843 | # window_active_style="default" 844 | # fi 845 | # 846 | # tmux_conf_theme_pane_border_style=${tmux_conf_theme_pane_border_style:-thin} 847 | # tmux_conf_theme_pane_border=${tmux_conf_theme_pane_border:-$tmux_conf_theme_colour_2} 848 | # tmux_conf_theme_pane_active_border=${tmux_conf_theme_pane_active_border:-$tmux_conf_theme_colour_4} 849 | # tmux_conf_theme_pane_border_fg=${tmux_conf_theme_pane_border_fg:-$tmux_conf_theme_pane_border} 850 | # tmux_conf_theme_pane_active_border_fg=${tmux_conf_theme_pane_active_border_fg:-$tmux_conf_theme_pane_active_border} 851 | # case "$tmux_conf_theme_pane_border_style" in 852 | # fat) 853 | # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-$tmux_conf_theme_pane_border_fg} 854 | # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-$tmux_conf_theme_pane_active_border_fg} 855 | # ;; 856 | # thin|*) 857 | # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-default} 858 | # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-default} 859 | # ;; 860 | # esac 861 | # 862 | # tmux_conf_theme_pane_indicator=${tmux_conf_theme_pane_indicator:-$tmux_conf_theme_colour_4} 863 | # tmux_conf_theme_pane_active_indicator=${tmux_conf_theme_pane_active_indicator:-$tmux_conf_theme_colour_4} 864 | # 865 | # # -- status line ------------------------------------------------------- 866 | # 867 | # tmux_conf_theme_left_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_main-}") 868 | # tmux_conf_theme_left_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_sub-|}") 869 | # tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-}") 870 | # tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-|}") 871 | # 872 | # tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-$tmux_conf_theme_colour_1} 873 | # tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-$tmux_conf_theme_colour_5} 874 | # tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-bold} 875 | # 876 | # tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-$tmux_conf_theme_colour_5} 877 | # tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-$tmux_conf_theme_colour_1} 878 | # tmux_conf_theme_message_command_attr=${tmux_conf_theme_message_command_attr:-bold} 879 | # 880 | # tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-$tmux_conf_theme_colour_1} 881 | # tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-$tmux_conf_theme_colour_5} 882 | # tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-bold} 883 | # 884 | # tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-$tmux_conf_theme_colour_3} 885 | # tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-$tmux_conf_theme_colour_1} 886 | # tmux_conf_theme_status_attr=${tmux_conf_theme_status_attr:-none} 887 | # 888 | # tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-#h ❐ #S ● #I #W} 889 | # 890 | # tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \ 891 | # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ 892 | # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ 893 | # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ 894 | # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ 895 | # -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ 896 | # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ 897 | # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ 898 | # -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') 899 | # 900 | # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-$tmux_conf_theme_colour_3} 901 | # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-$tmux_conf_theme_colour_1} 902 | # tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-none} 903 | # tmux_conf_theme_window_status_format=${tmux_conf_theme_window_status_format:-#I #W} 904 | # 905 | # tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-$tmux_conf_theme_colour_1} 906 | # tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-$tmux_conf_theme_colour_4} 907 | # tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-bold} 908 | # tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-#I #W} 909 | # 910 | # tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-default} 911 | # tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-default} 912 | # tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-underscore} 913 | # 914 | # tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-$tmux_conf_theme_colour_5} 915 | # tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-default} 916 | # tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-blink,bold} 917 | # 918 | # tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-$tmux_conf_theme_colour_4} 919 | # tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-default} 920 | # tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-none} 921 | # 922 | # if [ x"$tmux_conf_theme_window_status_bg" = x"$tmux_conf_theme_status_bg" ] || [ x"$tmux_conf_theme_window_status_bg" = x"default" ]; then 923 | # spacer='' 924 | # spacer_current=' ' 925 | # else 926 | # spacer=' ' 927 | # spacer_current=' ' 928 | # fi 929 | # if [ x"$tmux_conf_theme_window_status_last_bg" = x"$tmux_conf_theme_status_bg" ] || [ x"$tmux_conf_theme_window_status_last_bg" = x"default" ] ; then 930 | # spacer_last='' 931 | # else 932 | # spacer_last=' ' 933 | # fi 934 | # if [ x"$tmux_conf_theme_window_status_activity_bg" = x"$tmux_conf_theme_status_bg" ] || [ x"$tmux_conf_theme_window_status_activity_bg" = x"default" ] ; then 935 | # spacer_activity='' 936 | # spacer_last_activity="$spacer_last" 937 | # else 938 | # spacer_activity=' ' 939 | # spacer_last_activity=' ' 940 | # fi 941 | # if [ x"$tmux_conf_theme_window_status_bell_bg" = x"$tmux_conf_theme_status_bg" ] || [ x"$tmux_conf_theme_window_status_bell_bg" = x"default" ] ; then 942 | # spacer_bell='' 943 | # spacer_last_bell="$spacer_last" 944 | # spacer_activity_bell="$spacer_activity" 945 | # spacer_last_activity_bell="$spacer_last_activity" 946 | # else 947 | # spacer_bell=' ' 948 | # spacer_last_bell=' ' 949 | # spacer_activity_bell=' ' 950 | # spacer_last_activity_bell=' ' 951 | # fi 952 | # spacer="#{?window_last_flag,#{?window_activity_flag,#{?window_bell_flag,$spacer_last_activity_bell,$spacer_last_activity},#{?window_bell_flag,$spacer_last_bell,$spacer_last}},#{?window_activity_flag,#{?window_bell_flag,$spacer_activity_bell,$spacer_activity},#{?window_bell_flag,$spacer_bell,$spacer}}}" 953 | # if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then 954 | # if [ -z "$tmux_conf_theme_right_separator_main" ]; then 955 | # window_status_separator=' ' 956 | # else 957 | # window_status_separator='' 958 | # fi 959 | # tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$spacer$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag?,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]$spacer#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_right_separator_main" 960 | # tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main" 961 | # else 962 | # if [ -z "$tmux_conf_theme_left_separator_main" ]; then 963 | # window_status_separator=' ' 964 | # else 965 | # window_status_separator='' 966 | # fi 967 | # tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$spacer$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if /!default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]$spacer#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main" 968 | # tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg]$tmux_conf_theme_left_separator_main" 969 | # fi 970 | # 971 | # tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \ 972 | # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ 973 | # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ 974 | # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ 975 | # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ 976 | # -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ 977 | # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ 978 | # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ 979 | # -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') 980 | # tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \ 981 | # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ 982 | # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ 983 | # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ 984 | # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ 985 | # -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ 986 | # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ 987 | # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ 988 | # -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') 989 | # 990 | # # -- indicators 991 | # 992 | # tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-⚇} # U+2687 993 | # tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-none} 994 | # tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-none} 995 | # tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-none} 996 | # 997 | # tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-⌨} # U+2328 998 | # tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-none} 999 | # tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-none} 1000 | # tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-none} 1001 | # 1002 | # tmux_conf_theme_mouse=${tmux_conf_theme_mouse:-↗} # U+2197 1003 | # tmux_conf_theme_mouse_fg=${tmux_conf_theme_mouse_fg:-none} 1004 | # tmux_conf_theme_mouse_bg=${tmux_conf_theme_mouse_bg:-none} 1005 | # tmux_conf_theme_mouse_attr=${tmux_conf_theme_mouse_attr:-none} 1006 | # 1007 | # tmux_conf_theme_root=${tmux_conf_theme_root:-!} 1008 | # tmux_conf_theme_root_fg=${tmux_conf_theme_root_fg:-none} 1009 | # tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-none} 1010 | # tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-bold,blink} 1011 | # 1012 | # tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-⚏} # U+268F 1013 | # tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-none} 1014 | # tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-none} 1015 | # tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-none} 1016 | # 1017 | # # -- status-left style 1018 | # 1019 | # tmux_conf_theme_status_left=${tmux_conf_theme_status_left-' ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '} 1020 | # tmux_conf_theme_status_left_fg=${tmux_conf_theme_status_left_fg:-$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8} 1021 | # tmux_conf_theme_status_left_bg=${tmux_conf_theme_status_left_bg:-$tmux_conf_theme_colour_9,$tmux_conf_theme_colour_10,$tmux_conf_theme_colour_11} 1022 | # tmux_conf_theme_status_left_attr=${tmux_conf_theme_status_left_attr:-bold,none,none} 1023 | # 1024 | # if [ -n "$tmux_conf_theme_status_left" ]; then 1025 | # status_left=$(echo "$tmux_conf_theme_status_left" | sed \ 1026 | # -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ 1027 | # -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix$tmux_conf_theme_prefix ,$(printf "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ 1028 | # -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{?mouse,$tmux_conf_theme_mouse ,$(printf "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ 1029 | # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ 1030 | # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') 1031 | # 1032 | # if [ -n "$(tmux display -p '#{version}')" ]; then 1033 | # status_left=$(echo "$status_left" | sed \ 1034 | # -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") 1035 | # else 1036 | # status_left=$(echo "$status_left" | sed \ 1037 | # -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") 1038 | # fi 1039 | # 1040 | # status_left=$(printf '%s' "$status_left" | awk \ 1041 | # -v status_bg="$tmux_conf_theme_status_bg" \ 1042 | # -v fg_="$tmux_conf_theme_status_left_fg" \ 1043 | # -v bg_="$tmux_conf_theme_status_left_bg" \ 1044 | # -v attr_="$tmux_conf_theme_status_left_attr" \ 1045 | # -v mainsep="$tmux_conf_theme_left_separator_main" \ 1046 | # -v subsep="$tmux_conf_theme_left_separator_sub" ' 1047 | # function subsplit(s, l, i, a, r) 1048 | # { 1049 | # l = split(s, a, ",") 1050 | # for (i = 1; i <= l; ++i) 1051 | # { 1052 | # o = split(a[i], _, "(") - 1 1053 | # c = split(a[i], _, ")") - 1 1054 | # open += o - c 1055 | # o_ = split(a[i], _, "{") - 1 1056 | # c_ = split(a[i], _, "}") - 1 1057 | # open_ += o_ - c_ 1058 | # o__ = split(a[i], _, "[") - 1 1059 | # c__ = split(a[i], _, "]") - 1 1060 | # open__ += o__ - c__ 1061 | # 1062 | # if (i == l) 1063 | # r = sprintf("%s%s", r, a[i]) 1064 | # else if (open || open_ || open__) 1065 | # r = sprintf("%s%s,", r, a[i]) 1066 | # else 1067 | # r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep) 1068 | # } 1069 | # 1070 | # gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r) 1071 | # return r 1072 | # } 1073 | # BEGIN { 1074 | # FS = "|" 1075 | # l1 = split(fg_, fg, ",") 1076 | # l2 = split(bg_, bg, ",") 1077 | # l3 = split(attr_, attr, ",") 1078 | # l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3) 1079 | # } 1080 | # { 1081 | # for (i = j = 1; i <= NF; ++i) 1082 | # { 1083 | # if (open || open_ || open__) 1084 | # printf "|%s", subsplit($i) 1085 | # else 1086 | # { 1087 | # if (i > 1) 1088 | # printf "#[fg=%s,bg=%s,none]%s#[fg=%s,bg=%s,%s]%s", bg[j_], bg[j], mainsep, fg[j], bg[j], attr[j], subsplit($i) 1089 | # else 1090 | # printf "#[fg=%s,bg=%s,%s]%s", fg[j], bg[j], attr[j], subsplit($i) 1091 | # } 1092 | # 1093 | # if (!open && !open_ && !open__) 1094 | # { 1095 | # j_ = j 1096 | # j = j % l + 1 1097 | # } 1098 | # } 1099 | # printf "#[fg=%s,bg=%s,none]%s", bg[j_], status_bg, mainsep 1100 | # }') 1101 | # fi 1102 | # 1103 | # status_left="$status_left " 1104 | # 1105 | # # -- status-right style 1106 | # 1107 | # tmux_conf_theme_status_right=${tmux_conf_theme_status_right-' #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '} 1108 | # tmux_conf_theme_status_right_fg=${tmux_conf_theme_status_right_fg:-$tmux_conf_theme_colour_12,$tmux_conf_theme_colour_13,$tmux_conf_theme_colour_14} 1109 | # tmux_conf_theme_status_right_bg=${tmux_conf_theme_status_right_bg:-$tmux_conf_theme_colour_15,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_17} 1110 | # tmux_conf_theme_status_right_attr=${tmux_conf_theme_status_right_attr:-none,none,bold} 1111 | # 1112 | # if [ -n "$tmux_conf_theme_status_right" ]; then 1113 | # status_right=$(echo "$tmux_conf_theme_status_right" | sed \ 1114 | # -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ 1115 | # -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix ,$(printf "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ 1116 | # -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{?mouse,$tmux_conf_theme_mouse ,$(printf "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ 1117 | # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ 1118 | # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') 1119 | # 1120 | # if [ -n "$(tmux display -p '#{version}')" ]; then 1121 | # status_right=$(echo "$status_right" | sed \ 1122 | # -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") 1123 | # else 1124 | # status_right=$(echo "$status_right" | sed \ 1125 | # -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") 1126 | # fi 1127 | # 1128 | # status_right=$(printf '%s' "$status_right" | awk \ 1129 | # -v status_bg="$tmux_conf_theme_status_bg" \ 1130 | # -v fg_="$tmux_conf_theme_status_right_fg" \ 1131 | # -v bg_="$tmux_conf_theme_status_right_bg" \ 1132 | # -v attr_="$tmux_conf_theme_status_right_attr" \ 1133 | # -v mainsep="$tmux_conf_theme_right_separator_main" \ 1134 | # -v subsep="$tmux_conf_theme_right_separator_sub" ' 1135 | # function subsplit(s, l, i, a, r) 1136 | # { 1137 | # l = split(s, a, ",") 1138 | # for (i = 1; i <= l; ++i) 1139 | # { 1140 | # o = split(a[i], _, "(") - 1 1141 | # c = split(a[i], _, ")") - 1 1142 | # open += o - c 1143 | # o_ = split(a[i], _, "{") - 1 1144 | # c_ = split(a[i], _, "}") - 1 1145 | # open_ += o_ - c_ 1146 | # o__ = split(a[i], _, "[") - 1 1147 | # c__ = split(a[i], _, "]") - 1 1148 | # open__ += o__ - c__ 1149 | # 1150 | # if (i == l) 1151 | # r = sprintf("%s%s", r, a[i]) 1152 | # else if (open || open_ || open__) 1153 | # r = sprintf("%s%s,", r, a[i]) 1154 | # else 1155 | # r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep) 1156 | # } 1157 | # 1158 | # gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r) 1159 | # return r 1160 | # } 1161 | # BEGIN { 1162 | # FS = "|" 1163 | # l1 = split(fg_, fg, ",") 1164 | # l2 = split(bg_, bg, ",") 1165 | # l3 = split(attr_, attr, ",") 1166 | # l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3) 1167 | # } 1168 | # { 1169 | # for (i = j = 1; i <= NF; ++i) 1170 | # { 1171 | # if (open_ || open || open__) 1172 | # printf "|%s", subsplit($i) 1173 | # else 1174 | # printf "#[fg=%s,bg=%s,none]%s#[fg=%s,bg=%s,%s]%s", bg[j], (i == 1) ? status_bg : bg[j_], mainsep, fg[j], bg[j], attr[j], subsplit($i) 1175 | # 1176 | # if (!open && !open_ && !open__) 1177 | # { 1178 | # j_ = j 1179 | # j = j % l + 1 1180 | # } 1181 | # } 1182 | # }') 1183 | # fi 1184 | # 1185 | # # -- variables 1186 | # 1187 | # tmux_conf_battery_bar_symbol_full=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_full:-◼}") 1188 | # tmux_conf_battery_bar_symbol_empty=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_empty:-◻}") 1189 | # tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-auto} 1190 | # tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-gradient} 1191 | # tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-gradient} 1192 | # tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-gradient} 1193 | # tmux_conf_battery_status_charging=$(_decode_unicode_escapes "${tmux_conf_battery_status_charging:-↑}") # U+2191 1194 | # tmux_conf_battery_status_discharging=$(_decode_unicode_escapes "${tmux_conf_battery_status_discharging:-↓}") # U+2193 1195 | # 1196 | # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _battery_bar' 1197 | # _battery_info 1198 | # if [ "$charge" != 0 ]; then 1199 | # case "$status_left $status_right" in 1200 | # *'#{battery_status}'*|*'#{battery_bar}'*|*'#{battery_hbar}'*|*'#{battery_vbar}'*|*'#{battery_percentage}'*) 1201 | # status_left=$(echo "$status_left" | sed -E \ 1202 | # -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \ 1203 | # -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \ 1204 | # -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \ 1205 | # -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \ 1206 | # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') 1207 | # status_right=$(echo "$status_right" | sed -E \ 1208 | # -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \ 1209 | # -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \ 1210 | # -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \ 1211 | # -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \ 1212 | # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') 1213 | # status_right="#(printf '\n'; nice cut -c3- ~/.tmux.conf | sh -s _battery_status \"$tmux_conf_battery_status_charging\" \"$tmux_conf_battery_status_discharging\")$status_right" 1214 | # interval=60 1215 | # if [ $_tmux_version -ge 302 ]; then 1216 | # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done" 1217 | # elif [ $_tmux_version -gt 204 ]; then 1218 | # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" 1219 | # else 1220 | # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\")$status_right" 1221 | # fi 1222 | # ;; 1223 | # esac 1224 | # fi 1225 | # 1226 | # case "$status_left $status_right" in 1227 | # *'#{username}'*|*'#{hostname}'*|*'#{hostname_full}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*|*'#{hostname_full_ssh}'*) 1228 | # status_left=$(echo "$status_left" | sed \ 1229 | # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ 1230 | # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ 1231 | # -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ 1232 | # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ 1233 | # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ 1234 | # -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') 1235 | # status_right=$(echo "$status_right" | sed \ 1236 | # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ 1237 | # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ 1238 | # -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ 1239 | # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ 1240 | # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ 1241 | # -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') 1242 | # ;; 1243 | # esac 1244 | # 1245 | # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _uptime' 1246 | # case "$status_left $status_right" in 1247 | # *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*|*'#{uptime_s}'*) 1248 | # status_left=$(echo "$status_left" | sed -E \ 1249 | # -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \ 1250 | # -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \ 1251 | # -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \ 1252 | # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ 1253 | # -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \ 1254 | # -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g') 1255 | # status_right=$(echo "$status_right" | sed -E \ 1256 | # -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \ 1257 | # -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \ 1258 | # -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \ 1259 | # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ 1260 | # -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \ 1261 | # -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g') 1262 | # interval=60 1263 | # case "$status_left $status_right" in 1264 | # *'#{@uptime_s}'*) 1265 | # interval=$(tmux show -gv status-interval) 1266 | # ;; 1267 | # esac 1268 | # if [ $_tmux_version -ge 302 ]; then 1269 | # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done" 1270 | # elif [ $_tmux_version -gt 204 ]; then 1271 | # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" 1272 | # else 1273 | # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" 1274 | # fi 1275 | # ;; 1276 | # esac 1277 | # 1278 | # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _loadavg' 1279 | # case "$status_left $status_right" in 1280 | # *'#{loadavg}'*) 1281 | # status_left=$(echo "$status_left" | sed -E \ 1282 | # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') 1283 | # status_right=$(echo "$status_right" | sed -E \ 1284 | # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') 1285 | # interval=$(tmux show -gv status-interval) 1286 | # if [ $_tmux_version -ge 302 ]; then 1287 | # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done" 1288 | # elif [ $_tmux_version -gt 204 ]; then 1289 | # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" 1290 | # else 1291 | # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" 1292 | # fi 1293 | # ;; 1294 | # esac 1295 | # 1296 | # # -- clock ------------------------------------------------------------- 1297 | # 1298 | # tmux_conf_theme_clock_colour=${tmux_conf_theme_clock_colour:-$tmux_conf_theme_colour_4} 1299 | # tmux_conf_theme_clock_style=${tmux_conf_theme_clock_style:-24} 1300 | # 1301 | # # -- custom variables --------------------------------------------------- 1302 | # 1303 | # if [ -f ~/.tmux.conf.local ] && [ x"$(cut -c3- ~/.tmux.conf.local | sh 2>/dev/null -s printf probe)" = x"probe" ]; then 1304 | # replacements=$(perl -n -e 'print if s!^#\s+([^()\s]+)\s*\(\)\s*{\s*\n!s%#\\\{\1\\\}%#(cut -c3- ~/.tmux.conf.local | sh -s \1)%g; !p' < ~/.tmux.conf.local) 1305 | # status_left=$(echo "$status_left" | perl -p -e "$replacements" || echo "$status_left") 1306 | # status_right=$(echo "$status_right" | perl -p -e "$replacements" || echo "$status_right") 1307 | # fi 1308 | # 1309 | # # ----------------------------------------------------------------------- 1310 | # 1311 | # tmux setw -g window-style "$window_style" \; setw -g window-active-style "$window_active_style" \;\ 1312 | # setw -g pane-border-style "fg=$tmux_conf_theme_pane_border_fg,bg=$tmux_conf_theme_pane_border_bg" \; set -g pane-active-border-style "fg=$tmux_conf_theme_pane_active_border_fg,bg=$tmux_conf_theme_pane_active_border_bg" \;\ 1313 | # set -g display-panes-colour "$tmux_conf_theme_pane_indicator" \; set -g display-panes-active-colour "$tmux_conf_theme_pane_active_indicator" \;\ 1314 | # set -g message-style "fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr" \;\ 1315 | # set -g message-command-style "fg=$tmux_conf_theme_message_command_fg,bg=$tmux_conf_theme_message_command_bg,$tmux_conf_theme_message_command_attr" \;\ 1316 | # setw -g mode-style "fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr" \;\ 1317 | # set -g status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1318 | # set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1319 | # set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1320 | # set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")" \;\ 1321 | # setw -g window-status-style "fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr" \;\ 1322 | # setw -g window-status-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_format")" \;\ 1323 | # setw -g window-status-current-style "fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr" \;\ 1324 | # setw -g window-status-current-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_current_format")" \;\ 1325 | # setw -g window-status-activity-style "fg=$tmux_conf_theme_window_status_activity_fg,bg=$tmux_conf_theme_window_status_activity_bg,$tmux_conf_theme_window_status_activity_attr" \;\ 1326 | # setw -g window-status-bell-style "fg=$tmux_conf_theme_window_status_bell_fg,bg=$tmux_conf_theme_window_status_bell_bg,$tmux_conf_theme_window_status_bell_attr" \;\ 1327 | # setw -g window-status-last-style "fg=$tmux_conf_theme_window_status_last_fg,bg=$tmux_conf_theme_window_status_last_bg,$tmux_conf_theme_window_status_last_attr" \;\ 1328 | # setw -g window-status-separator "$window_status_separator" \;\ 1329 | # set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\ 1330 | # set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")" \;\ 1331 | # setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\ 1332 | # setw -g clock-mode-style "$tmux_conf_theme_clock_style" 1333 | # } 1334 | # 1335 | # _apply_configuration() { 1336 | # 1337 | # if ! command -v perl > /dev/null 2>&1; then 1338 | # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time' 1339 | # return 1340 | # fi 1341 | # if ! command -v sed > /dev/null 2>&1; then 1342 | # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time' 1343 | # return 1344 | # fi 1345 | # if ! command -v awk > /dev/null 2>&1; then 1346 | # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time' 1347 | # return 1348 | # fi 1349 | # 1350 | # # see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard 1351 | # if command -v reattach-to-user-namespace > /dev/null 2>&1; then 1352 | # default_shell="$(tmux show -gv default-shell)" 1353 | # case "$default_shell" in 1354 | # *fish) 1355 | # tmux set -g default-command "reattach-to-user-namespace -l $default_shell" 1356 | # ;; 1357 | # *sh) 1358 | # tmux set -g default-command "exec $default_shell... 2> /dev/null & reattach-to-user-namespace -l $default_shell" 1359 | # ;; 1360 | # esac 1361 | # fi 1362 | # 1363 | # case "$_uname_s" in 1364 | # *CYGWIN*|*MSYS*) 1365 | # # prevent Cygwin and MSYS2 from cd-ing into home directory when evaluating /etc/profile 1366 | # tmux setenv -g CHERE_INVOKING 1 1367 | # ;; 1368 | # esac 1369 | # 1370 | # _apply_overrides 1371 | # _apply_theme& 1372 | # _apply_bindings& 1373 | # 1374 | # # shellcheck disable=SC2046 1375 | # tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}') 1376 | # wait 1377 | # } 1378 | # 1379 | # _urlview() { 1380 | # tmux capture-pane -J -S - -E - -b "urlview-$1" -t "$1" 1381 | # tmux split-window "tmux show-buffer -b urlview-$1 | urlview || true; tmux delete-buffer -b urlview-$1" 1382 | # } 1383 | # 1384 | # _fpp() { 1385 | # tmux capture-pane -J -S - -E - -b "fpp-$1" -t "$1" 1386 | # tmux split-window "tmux show-buffer -b fpp-$1 | fpp || true; tmux delete-buffer -b fpp-$1" 1387 | # } 1388 | # 1389 | # "$@" --------------------------------------------------------------------------------