Browse Source

Massive configs

ubuntu_ci
Ein Verne 4 years ago
parent
commit
3a9e966193
No known key found for this signature in database
GPG Key ID: 926634D64ACAD792
  1. 10
      .github/workflows/setup.yml
  2. 13
      .gitmodules
  3. 201
      .zshrc
  4. 37
      Brewfile
  5. 69
      Brewfile-essentials
  6. 37
      Makefile
  7. 15
      README.md
  8. 27
      bootstrap.sh
  9. 27
      brew.sh
  10. 23
      config/asdf-install.conf.yml
  11. 17
      config/asdf.conf.yml
  12. 40
      config/bootstrap.conf.yml
  13. 42
      config/install.conf.yml
  14. 2
      config/packages.conf.yml
  15. 10
      config/projects.conf.yml
  16. 15
      config/tmux.conf.yml
  17. 10
      config/update.conf.yml
  18. 1
      dotbot
  19. 1
      dotbot-asdf
  20. 1
      dotbot-brew
  21. 49
      git/gitignore_global
  22. 2
      hammerspoon/Spoons/BingDaily.spoon/init.lua
  23. 24
      hammerspoon/ime.lua
  24. 71
      hammerspoon/init.lua
  25. 1
      hammerspoon/stackline
  26. 18
      install
  27. 2
      install.sh
  28. 9
      karabiner/karabiner.edn
  29. 18
      karabiner/karabiner.json
  30. 11
      mackup/mackup.cfg
  31. 0
      macos/init_mac.sh
  32. 352
      skhd/skhdrc
  33. 23
      wp-completion.bash
  34. 25
      yabai/yabai_focus_display
  35. 69
      yabai/yabairc
  36. 1
      zsh/alias.zsh

10
.github/workflows/setup.yml

@ -9,5 +9,11 @@ jobs:
- name: build - name: build
env: env:
CI_MODE: true CI_MODE: true
run: bash ./bootstrap.sh run: |
make
make bootstrap
make dotfiles
make macos
make asdf
make brew
make tmux

13
.gitmodules vendored

@ -0,0 +1,13 @@
[submodule "dotbot"]
path = dotbot
url = https://github.com/anishathalye/dotbot
ignore = dirty
[submodule "dotbot-brew"]
path = dotbot-brew
url = https://github.com/d12frosted/dotbot-brew.git
[submodule "dotbot-asdf"]
path = dotbot-asdf
url = https://github.com/sobolevn/dotbot-asdf.git
[submodule "hammerspoon/stackline"]
path = hammerspoon/stackline
url = https://github.com/AdamWagner/stackline.git

201
.zshrc

@ -1,98 +1,138 @@
# If you come from bash you might have to change your $PATH. # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# export PATH=$HOME/bin:/usr/local/bin:$PATH # Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
# you need to git clone [email protected]:zsh-users/antigen.git to $HOME if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
if [[ -d $HOME/antigen ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
source $HOME/antigen/antigen.zsh
fi fi
if [[ -f "$HOME/antigen.zsh" ]]; then if [[ ! -f ~/.zinit/bin/zinit.zsh ]]; then
source $HOME/antigen.zsh mkdir ~/.zinit
git clone https://github.com/zdharma/zinit.git ~/.zinit/bin
fi fi
if [[ -f "$HOME/dotfiles/wp-completion.bash" ]]; then # load zinit
autoload bashcompinit source ~/.zinit/bin/zinit.zsh
bashcompinit
source $HOME/dotfiles/wp-completion.bash # 快速目录跳转
fi zinit ice lucid wait='1'
# Turbo mode with "wait"
zinit light-mode lucid wait for \
is-snippet OMZ::lib/history.zsh \
MichaelAquilina/zsh-you-should-use \
romkatv/zsh-prompt-benchmark \
zdharma/history-search-multi-word \
atload"unalias zi; alias zi='zinit'" \
ajeetdsouza/zoxide
# Ref: zdharma/fast-syntax-highlighting
# Note: Use wait 1 second works for kubectl
zinit wait lucid for \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
zdharma/fast-syntax-highlighting \
atload"zpcdreplay" wait"1" \
OMZP::kubectl \
blockf \
zsh-users/zsh-completions \
atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions \
as"completion" is-snippet \
https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker \
https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose
# 语法高亮
zinit ice lucid wait='0' atinit='zpcompinit'
zinit light zdharma/fast-syntax-highlighting
# 自动建议
zinit ice lucid wait="0" atload='_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions
# 补全
zinit ice lucid wait='0'
zinit light zsh-users/zsh-completions
# 加载 OMZ 框架及部分插件
zinit snippet OMZ::lib/completion.zsh
zinit snippet OMZ::lib/history.zsh
zinit snippet OMZ::lib/key-bindings.zsh
zinit snippet OMZ::lib/theme-and-appearance.zsh
zinit snippet OMZ::plugins/colored-man-pages/colored-man-pages.plugin.zsh
zinit snippet OMZ::plugins/sudo/sudo.plugin.zsh
zinit snippet OMZ::plugins/git-flow/git-flow.plugin.zsh
zinit snippet OMZ::plugins/autojump/autojump.plugin.zsh
zinit snippet OMZ::plugins/mvn/mvn.plugin.zsh
zinit snippet OMZ::plugins/tmux/tmux.plugin.zsh
zinit snippet OMZ::plugins/tmuxinator/tmuxinator.plugin.zsh
zinit snippet OMZ::plugins/command-not-found/command-not-found.plugin.zsh
zinit snippet OMZ::plugins/pip/pip.plugin.zsh
zinit ice lucid wait='1'
zinit snippet OMZ::plugins/git/git.plugin.zsh
# Gitignore plugin – commands gii and gi
zinit ice wait"2" lucid
zinit load voronkovich/gitignore.plugin.zsh
zinit load djui/alias-tips
export ASDF_DIR=$(brew --prefix asdf) export ASDF_DIR=$(brew --prefix asdf)
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle asdf
antigen bundle gem
antigen bundle git
antigen bundle git-extras
antigen bundle git-flow
antigen bundle mvn
antigen bundle tig
antigen bundle heroku
antigen bundle lein
antigen bundle command-not-found
antigen bundle tmux
antigen bundle tmuxinator
antigen bundle docker
antigen bundle docker-compose
# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-completions
antigen bundle Tarrasch/zsh-autoenv
antigen bundle rupa/z
antigen bundle supercrabtree/k
antigen bundle zsh-users/zsh-history-substring-search
#antigen bundle tylerreckart/hyperzsh
#antigen bundle extract
antigen bundle z
#antigen bundle mafredri/zsh-async
#antigen bundle sindresorhus/pure
antigen bundle unixorn/autoupdate-antigen.zshplugin
antigen bundle djui/alias-tips
# Python Plugins
antigen bundle pip
antigen bundle python
antigen bundle virtualenv
# ASDF
if [ -d "$HOME/.asdf" ]; then
# zinit ice wait lucid
# zinit light asdf-vm/asdf
# OR
load_asdf() {
source $HOME/.asdf/asdf.sh
}
zinit light-mode wait lucid for \
atload'load_asdf' \
zdharma/null
fi
# zinit light denysdovhan/spaceship-prompt
zinit ice depth=1; zinit light romkatv/powerlevel10k
zinit ice as"program" from"gh-r" mv"exa* -> exa" pick"exa/exa" lucid atload"alias ls='exa --icons'"
zinit light ogham/exa
# OS specific plugins # OS specific plugins
case `uname` in case `uname` in
Darwin) Darwin)
antigen bundle brew # zinit bundle kiurchv/asdf.plugin.zsh
antigen bundle brew-cask
antigen bundle osx
;; ;;
FreeBSD) FreeBSD)
;; ;;
esac esac
if type brew &>/dev/null; then #if type brew &>/dev/null; then
echo "brew completion" # echo "brew completion"
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH # FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
#fpath=$(brew --prefix)/share/zsh-completions:$fpath # #fpath=$(brew --prefix)/share/zsh-completions:$fpath
fpath=($HOME/.asdf/completions $fpath) # fpath=($HOME/.asdf/completions $fpath)
#fi
#. $(brew --prefix asdf)/asdf.sh
#. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash
# Compinit : After zinits, before cdreplay
# https://carlosbecker.com/posts/speeding-up-zsh/
autoload -Uz compinit
if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.zcompdump) ]; then
compinit;
else
compinit -C;
fi fi
autoload -Uz compinit && compinit
. $(brew --prefix asdf)/asdf.sh
. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash
# Load the theme. # Load the theme.
# antigen theme agnoster # zinit theme agnoster
# workaround for https://github.com/zsh-users/antigen/issues/675 # workaround for https://github.com/zsh-users/zinit/issues/675
THEME=denysdovhan/spaceship-prompt
antigen list | grep $THEME; if [ $? -ne 0 ]; then antigen theme $THEME; fi
# Tell Antigen that you're done. # Tell zinit that you're done.
antigen apply # zinit apply
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
@ -118,14 +158,10 @@ ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
# plugins, and themes. Aliases can be placed here, though oh-my-zsh # plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder. # users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`. # For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi #transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
#tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } #tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
source $HOME/dotfiles/zsh/common.zsh source $HOME/dotfiles/zsh/common.zsh
source $HOME/dotfiles/zsh/keybindings.zsh source $HOME/dotfiles/zsh/keybindings.zsh
@ -147,7 +183,7 @@ fi
ZSH_DISABLE_COMPFIX=true ZSH_DISABLE_COMPFIX=true
fpath=(~/.zsh/completions $fpath) # fpath=(~/.zsh/completions $fpath)
# space # space
SPACESHIP_DIR_SHOW="${SPACESHIP_DIR_SHOW=true}" SPACESHIP_DIR_SHOW="${SPACESHIP_DIR_SHOW=true}"
@ -162,4 +198,5 @@ SPACESHIP_DIR_COLOR="${SPACESHIP_DIR_COLOR="cyan"}"
# usage adb-screencap > screen.png # usage adb-screencap > screen.png
alias adbcap="adb shell screencap -p" alias adbcap="adb shell screencap -p"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

37
Brewfile

@ -1,3 +1,4 @@
tap "buo/cask-upgrade"
tap "homebrew/cask", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git" tap "homebrew/cask", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git"
tap "homebrew/cask-drivers", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git" tap "homebrew/cask-drivers", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git"
tap "homebrew/cask-fonts", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git" tap "homebrew/cask-fonts", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git"
@ -5,9 +6,9 @@ tap "homebrew/core", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew
tap "homebrew/bundle" tap "homebrew/bundle"
tap "homebrew/services" tap "homebrew/services"
tap "homebrew/cask-versions" tap "homebrew/cask-versions"
tap "adoptopenjdk/openjdk"
# primitives # primitives
brew "axel"
# https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands # https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands
brew "coreutils" brew "coreutils"
brew "exa" brew "exa"
@ -32,7 +33,7 @@ brew "rsync"
brew "lastpass-cli" brew "lastpass-cli"
brew "youtube-dl" brew "youtube-dl"
brew "ffmpeg" brew "ffmpeg"
brew "imagemagic" brew "imagemagick"
brew "mas" brew "mas"
brew "nmap" brew "nmap"
brew "p7zip" brew "p7zip"
@ -41,35 +42,27 @@ brew "proxychains-ng"
brew "htop" brew "htop"
brew "neofetch" brew "neofetch"
brew "readline" brew "readline"
brew "asdf"
brew "cmake" brew "cmake"
brew "node"
brew "sqlite" brew "sqlite"
brew "xz" brew "xz"
brew "zlib" brew "zlib"
# productivity # productivity
brew "axel"
brew "exa"
brew "fzf"
brew "ripgrep" brew "ripgrep"
brew "fd" brew "fd"
brew "hexyl" # brew "hexyl"
brew "xsv" # brew "xsv"
brew "jq" brew "jq"
brew "hledger" # brew "hledger"
brew "getantibody/tap/antibody"
# dev # dev
brew "ruby" brew "ruby"
brew "go" brew "go"
brew "cmake"
brew "sqlite"
# brew "postgresql" # brew "postgresql"
brew "youtube-dl" brew "youtube-dl"
# brew "heroku" # brew "heroku"
brew "node" # brew "node"
brew "yarn" # brew "yarn"
# brew "wrk" # brew "wrk"
if ENV.key? 'CI_MODE' if ENV.key? 'CI_MODE'
@ -94,17 +87,13 @@ cask "jd-gui"
cask "karabiner-elements" cask "karabiner-elements"
cask "keycastr" cask "keycastr"
cask "licecap" cask "licecap"
cask "maccy"
cask "mos" cask "mos"
cask "mpv" cask "mpv"
cask "nextcloud" cask "nextcloud"
cask "nitroshare" cask "nitroshare"
cask "visual-studio-code" cask "visual-studio-code"
cask "syncthing" cask "syncthing"
cask "shadowsocksx-ng"
cask "neteasemusic" cask "neteasemusic"
cask "google-trends"
cask "oversight"
# open broadcaster software # open broadcaster software
cask "obs" cask "obs"
# note-taking app # note-taking app
@ -116,6 +105,16 @@ cask "upic"
cask "via" cask "via"
cask "vlc" cask "vlc"
# Quick look
cask "qlcolorcode"
cask "qlstephen"
cask "qlmarkdown"
cask "quicklook-json"
cask "qlimagesize"
cask "suspicious-package"
cask "quicklookase"
cask "qlvideo"
mas "WeChat", id: 836500024 mas "WeChat", id: 836500024
mas "Unsplash Wallpapers", id: 1284863847 mas "Unsplash Wallpapers", id: 1284863847
mas "Microsoft OneNote", id: 784801555 mas "Microsoft OneNote", id: 784801555

69
Brewfile-essentials

@ -0,0 +1,69 @@
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "github/gh"
tap "koekeishiya/formulae"
tap "narze/taps"
tap "yqrashawn/goku"
brew "awscli"
brew "bat"
# brew "diff-so-fancy"
brew "ffmpeg"
brew "ghq"
brew "git"
brew "git-delta"
brew "git-flow"
brew "jq"
brew "mackup"
brew "magic-wormhole"
brew "mas"
brew "mpc"
brew "mpd"
brew "ncmpcpp"
brew "neofetch"
brew "reattach-to-user-namespace"
brew "terminal-notifier"
brew "tldr"
brew "tmux"
brew "tree"
brew "watch"
brew "zsh"
brew "github/gh/gh"
brew "koekeishiya/formulae/skhd"
brew "koekeishiya/formulae/yabai"
brew "yqrashawn/goku/goku"
cask "1password"
cask "alfred"
# cask "arq" # Wait for v5 compatability
cask "beardedspice"
cask "bitbar"
cask "dash"
cask "docker"
cask "dropbox"
cask "firefox"
cask "flux"
cask "font-firacode-nerd-font"
cask "font-fantasque-sans-mono-nerd-font"
cask "google-backup-and-sync"
cask "google-chrome"
cask "hazel"
cask "joplin"
cask "kitty"
cask "karabiner-elements"
cask "keyboard-maestro"
cask "ngrok"
cask "omnifocus"
cask "postgres"
cask "postman"
cask "rescuetime"
cask "setapp"
cask "slack"
cask "spotify"
cask "startupizer"
cask "syncthing"
cask "telegram"
cask "the-unarchiver"
cask "visual-studio-code"
cask "whatpulse"

37
Makefile

@ -0,0 +1,37 @@
.PHONY: help
help: ## Print command list
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
_prepare:
@git submodule update --init --recursive
_bootstrap:
@./install -c config/bootstrap.conf.yml
bootstrap: _prepare dotfiles _bootstrap ## Bootstrap new machine
dotfiles: ## Update dotfiles
@./install
macos: ## Run macos script
@./macos/init_mac.sh
brew: ## Install brew & cask packages
@./install -c config/packages.conf.yml --plugin-dir dotbot-brew
tmux: ## Install non-brew tools eg. tmux package manager
@./install -c config/tmux.conf.yml
asdf: ## Install asdf-vm
@./install -c config/asdf-install.conf.yml --plugin-dir dotbot-brew
@./install -c config/asdf.conf.yml --plugin-dir dotbot-asdf
update: ## Update everything
@make _prepare
@./install -c config/update.conf.yml
vim: ## Setup vim
@./install -c config/vim.conf.yml
all: _prepare dotfiles _bootstrap brew tmux asdf ## Run all tasks at once

15
README.md

@ -4,19 +4,14 @@ dotfiles config contain vim, zsh, tmux configurations.
git clone [email protected]:einverne/dotfiles.git git clone [email protected]:einverne/dotfiles.git
cd dotfiles cd dotfiles
bash bootstrap.sh ./install
## Overview ## Overview
- zsh - using [dotbot](https://github.com/anishathalye/dotbot/) to manage dotfiles
- vim - zsh, using [zinit](https://github.com/zdharma/zinit/) as plugin management
- tmux - vim, using [vim-plug](https://github.com/junegunn/vim-plug) to manage vim plugins, vim-plug relate configuration is under `vim-plug_vimrc`. In Vim, `:PlugInstall` to install all vim plugins.
- tmux, using [tpm](https://github.com/tmux-plugins/tpm) to manage tmux plugins, in tmux, press `Ctrl +B` + `I` to install all tmux plugins.
With
- [antigen](https://gtk.pw/antigen) to manage zsh plugins, `source ~/.zshrc` to install all zsh plugins
- [vim-plug](https://github.com/junegunn/vim-plug) to manage vim plugins, vim-plug relate configuration is under `vim-plug_vimrc`. In Vim, `:PlugInstall` to install all vim plugins.
- [tpm](https://github.com/tmux-plugins/tpm) to manage tmux plugins, in tmux, press `Ctrl +B` + `I` to install all tmux plugins.
### zsh config ### zsh config
to see `.zshrc` file to see `.zshrc` file

27
bootstrap.sh

@ -12,9 +12,6 @@ fi
echo "Setup hostname" echo "Setup hostname"
sudo scutil --set HostName mac sudo scutil --set HostName mac
echo "Install from brew.sh"
# bash brew.sh
echo "Install with Brew Bundle" echo "Install with Brew Bundle"
set +e set +e
brew cleanup brew cleanup
@ -41,23 +38,6 @@ ln -s $PWD/git/global.gitconfig $HOME/.gitconfig
echo "Setup Zsh" echo "Setup Zsh"
sudo sh -c 'echo /usr/local/bin/zsh >> /etc/shells' sudo sh -c 'echo /usr/local/bin/zsh >> /etc/shells'
sudo chsh -s $(which zsh) sudo chsh -s $(which zsh)
if [ -f ~/.zshrc ]; then
cat ~/.zshrc
mv ~/.zshrc ~/zshrc.bak
fi
ln -s $PWD/.zshrc $HOME/.zshrc
echo "Setup Vim"
ln -s $PWD/.vimrc $HOME/.vimrc
echo "Setup Tmux"
ln -s $PWD/tmux/.tmux.conf $HOME/.tmux.conf
ln -s $PWD/tmux/.tmux.conf.local $HOME/.tmux.conf.local
echo "Setup idea vimrc"
ln -s $PWD/idea/.ideavimrc $HOME/.ideavimrc
ls -al $HOME
echo "Setup applications" echo "Setup applications"
echo "- fzf" echo "- fzf"
@ -69,10 +49,5 @@ echo "Link editors"
mkdir -p ~/Applications/ mkdir -p ~/Applications/
sudo ln -s /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code /usr/local/bin/code sudo ln -s /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code /usr/local/bin/code
# echo "Setup Ruby"
# ./ruby/ruby
# echo "Setup Go"
# mkdir -p ~/go
echo "Setup macOS defaults" echo "Setup macOS defaults"
bash init_mac.sh bash etc/init_mac.sh

27
brew.sh

@ -1,27 +0,0 @@
# https://github.com/mathiasbynens/dotfiles/blob/main/brew.sh
brew update
brew upgrade
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed.
brew install findutils
# Install GNU `sed`, overwriting the built-in `sed`.
brew install gnu-sed --with-default-names
# Install more recent versions of some macOS tools.
brew install vim --with-override-system-vi
# GNU multiple precision arithmetic library
brew install gmp
# Install font tools.
# brew tap bramstein/webfonttools
# brew install sfnt2woff
# brew install sfnt2woff-zopfli
# brew install woff2
brew install ack
brew install git-lfs
brew install imagemagick --with-webp
brew install p7zip
# Remove outdated versions from the cellar.
brew cleanup

23
config/asdf-install.conf.yml

@ -0,0 +1,23 @@
# Asdf dependencies
- brew:
- coreutils
- automake
- autoconf
- openssl
- libyaml
- readline
- libxslt
- libtool
- unixodbc
- unzip
- curl
- shell:
- description: Clone asdf
quiet: true
command: |
if cd ~/.asdf;
then git pull;
else git clone https://github.com/asdf-vm/asdf.git ~/.asdf;
fi

17
config/asdf.conf.yml

@ -0,0 +1,17 @@
- asdf:
- plugin: python
url: https://github.com/danhper/asdf-python.git
global: 3.7.8
versions:
- 3.7.8
- 3.6.1
- plugin: ruby
url: https://github.com/asdf-vm/asdf-ruby.git
global: 2.6.5
versions:
- 2.6.5
- plugin: neovim
url: https://github.com/richin13/asdf-neovim.git
global: nightly
versions:
- nightly

40
config/bootstrap.conf.yml

@ -0,0 +1,40 @@
- brew:
- git
- mackup
- mas
- zsh
# Setup zinit
- create:
- ~/.zinit
- shell:
- description: Clone zinit
quiet: true
command: |
if cd ~/.zinit/bin;
then git pull;
else git clone https://github.com/zdharma/zinit.git ~/.zinit/bin; fi
# Change default shell to zsh
- shell:
- description: Change default shell to zsh
quiet: true
command: |
update_shell() {
local shell_path;
shell_path="$(command -v zsh)"
fancy_echo "Changing your shell to zsh ..."
if ! grep "$shell_path" /etc/shells > /dev/null 2>&1 ; then
fancy_echo "Adding '$shell_path' to /etc/shells"
sudo sh -c "echo $shell_path >> /etc/shells"
fi
sudo chsh -s "$shell_path" "$USER"
}
update_shell
- cask:
- lastpass
- syncthing

42
config/install.conf.yml

@ -0,0 +1,42 @@
- defaults:
link:
relink: true
force: true
- clean: ['~']
- link:
~/.dotfiles:
force: true
path: ''
- link:
~/.zshrc:
path: .zshrc
~/.gitconfig:
path: git/global.gitconfig
~/.gitignore_global:
path: git/gitignore_global
~/.tmux.conf:
path: tmux/.tmux.conf
~/.tmux.conf.local:
path: tmux/.tmux.conf.local
~/.vim:
path: .vim
~/.vimrc:
path: .vimrc
~/.ideavimrc:
path: idea/.ideavimrc
~/.hammerspoon:
if: '[ `uname` = Darwin ]'
path: hammerspoon
~/.mackup.cfg:
path: mackup/mackup.cfg
~/.Brewfile:
path: Brewfile
~/.skhdrc:
path: skhd/skhdrc
~/.yabairc:
path: yabai/yabairc
~/.yabai_focus_display:
path: yabai/yabai_focus_display

2
config/packages.conf.yml

@ -0,0 +1,2 @@
- brewfile:
- ~/.Brewfile

10
config/projects.conf.yml

@ -0,0 +1,10 @@
- defaults:
link:
relink: true
- create:
- ~/Git
- ~/projects
- shell:
- cd ~/Git && git clone [email protected]:einverne/einverne.github.io.git

15
config/tmux.conf.yml

@ -0,0 +1,15 @@
- brew:
- tmux
# Setup tpm : tmux plugin manager
- create:
- ~/.tmux/plugins
- shell:
- description: Clone tpm
quiet: true
command: |
if cd ~/.tmux/plugins/tpm;
then git pull;
else git clone https://github.com/tmux-plugins/tpm.git ~/.tmux/plugins/tpm;
fi

10
config/update.conf.yml

@ -0,0 +1,10 @@
- shell:
- description: Zinit self update
command: zsh -i -c "zinit self-update"
- description: Zinit update
command: zsh -i -c "zinit update"
- description: Brew update
command: brew update
- description: Cask update
command: brew cu -acy

1
dotbot

@ -0,0 +1 @@
Subproject commit 5294594f5aa9c3affd0d656ba6843c1c0b0bce60

1
dotbot-asdf

@ -0,0 +1 @@
Subproject commit 6aa52891d85fbd7ab00d74484847cdb18533ce80

1
dotbot-brew

@ -0,0 +1 @@
Subproject commit f67b2704b7d28b7efcb20e544b79a4fa04484400

49
git/gitignore_global

@ -0,0 +1,49 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
/*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Redis snapshot
dump.rdb
.vscode
.elixir_ls
.githooks
.local
.history
*.gitignored.*

2
hammerspoon/Spoons/BingDaily.spoon/init.lua

@ -80,7 +80,7 @@ end
function obj:init() function obj:init()
create_dir(obj.bing_path) create_dir(obj.bing_path)
if obj.timer == nil then if obj.timer == nil then
obj.timer = hs.timer.doEvery(60, function() bingRequest() end) obj.timer = hs.timer.doEvery(7200, function() bingRequest() end)
obj.timer:setNextTrigger(5) obj.timer:setNextTrigger(5)
else else
obj.timer:start() obj.timer:start()

24
hammerspoon/ime.lua

@ -8,26 +8,28 @@ end
-- app to expected ime config -- app to expected ime config
local app2Ime = { local app2Ime = {
{'/System/Library/CoreServices/Finder.app', 'English'}, {'/System/Library/CoreServices/Finder.app', 'Chinese'},
{'/Applications/Alfred 4.app', 'English'}, {'/Applications/Alfred 4.app', 'Chinese'},
{'/Applications/Bitwarden.app', 'English'}, {'/Applications/Bitwarden.app', 'Chinese'},
{'/Applications/Dash.app', 'Chinese'},
{'/Applications/iTerm.app', 'Chinese'}, {'/Applications/iTerm.app', 'Chinese'},
{'/Applications/Xcode.app', 'English'}, {'/Applications/Lark.app', 'Chinese'},
{'/Applications/Xcode.app', 'Chinese'},
{'/Applications/GoldenDict.app', 'Chinese'}, {'/Applications/GoldenDict.app', 'Chinese'},
{'/Applications/Google Chrome.app', 'Chinese'}, {'/Applications/Google Chrome.app', 'Chinese'},
{'/Applications/DingTalk.app', 'Chinese'}, {'/Applications/DingTalk.app', 'Chinese'},
{'/Applications/Kindle.app', 'English'}, {'/Applications/Kindle.app', 'Chinese'},
{'/Applications/NeteaseMusic.app', 'Chinese'}, {'/Applications/NeteaseMusic.app', 'Chinese'},
{'/Applications/WeChat.app', 'Chinese'}, {'/Applications/WeChat.app', 'Chinese'},
{'/Applications/Lark.app', 'Chinese'}, {'/Applications/Lark.app', 'Chinese'},
{'/Applications/System Preferences.app', 'English'}, {'/Applications/System Preferences.app', 'Chinese'},
{'/Applications/Dash.app', 'English'},
{'/Applications/MindNode.app', 'Chinese'}, {'/Applications/MindNode.app', 'Chinese'},
{'/Applications/Preview.app', 'Chinese'},
{'/Applications/Obsidian.app', 'Chinese'}, {'/Applications/Obsidian.app', 'Chinese'},
{'/Applications/wechatwebdevtools.app', 'English'}, {'/Applications/Preview.app', 'Chinese'},
{'/Applications/Sketch.app', 'English'}, {'/Applications/Sketch.app', 'Chinese'},
{'/Users/einverne/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/201.8538.31/IntelliJ IDEA.app', 'English'}, {'/Applications/wechatwebdevtools.app', 'Chinese'},
{'/Applications/WeChat.app', 'Chinese'},
{'/Users/einverne/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/201.8538.31/IntelliJ IDEA.app', 'Chinese'},
} }
function updateFocusAppInputMethod() function updateFocusAppInputMethod()

71
hammerspoon/init.lua

@ -6,6 +6,16 @@ require 'autoscript'
require 'ime' require 'ime'
-- require 'usb' -- require 'usb'
local module = {
'ime',
'autoscript'
}
local function loadModuleByName(modName)
end
-- hs.loadSpoon("ReloadConfiguration") -- hs.loadSpoon("ReloadConfiguration")
-- spoon.ReloadConfiguration:start() -- spoon.ReloadConfiguration:start()
-- hs.alert.show("Config reload!") -- hs.alert.show("Config reload!")
@ -107,6 +117,8 @@ end
function ssidChangedCallback() function ssidChangedCallback()
newSSID = hs.wifi.currentNetwork() newSSID = hs.wifi.currentNetwork()
local devices = hs.usb.attachedDevices()
if newSSID == homeSSID and lastSSID ~= homeSSID then if newSSID == homeSSID and lastSSID ~= homeSSID then
-- We just joined our home WiFi network -- We just joined our home WiFi network
hs.alert.show("Welcome home!") hs.alert.show("Welcome home!")
@ -123,10 +135,10 @@ function ssidChangedCallback()
if newSSID == workSSID then if newSSID == workSSID then
hs.alert.show("work karabiner setup") hs.alert.show("work karabiner setup")
selectKarabinerProfile("Work") selectKarabinerProfile("goku")
else else
hs.alert.show("built-in karabiner setup") hs.alert.show("built-in karabiner setup")
selectKarabinerProfile("Built-in") selectKarabinerProfile("goku")
end end
lastSSID = newSSID lastSSID = newSSID
@ -194,10 +206,15 @@ else
end end
end end
function reloadConfig()
hs.reload()
hs.execute("/bin/launchctl kickstart -k \"gui/${UID}/homebrew.mxcl.yabai\"")
end
hsreload_keys = {hyper, "R"} hsreload_keys = {hyper, "R"}
hsreload_keys = hsreload_keys or {{"cmd", "shift", "ctrl"}, "R"} hsreload_keys = hsreload_keys or {{"cmd", "shift", "ctrl"}, "R"}
if string.len(hsreload_keys[2]) > 0 then if string.len(hsreload_keys[2]) > 0 then
hs.hotkey.bind(hsreload_keys[1], hsreload_keys[2], "Reload Configuration", function() hs.reload() end) hs.hotkey.bind(hsreload_keys[1], hsreload_keys[2], "Reload Configuration", reloadConfig)
hs.notify.new({title="Hammerspoon config reloaded", informativeText="Manually trigged via keyboard shortcut"}):send() hs.notify.new({title="Hammerspoon config reloaded", informativeText="Manually trigged via keyboard shortcut"}):send()
end end
@ -339,19 +356,6 @@ if spoon.ClipShow then
spoon.ModalMgr:deactivate({"clipshowM"}) spoon.ModalMgr:deactivate({"clipshowM"})
end) end)
-- Register clipshowM with modal supervisor
hsclipsM_keys = hsclipsM_keys or {"alt", "C"}
if string.len(hsclipsM_keys[2]) > 0 then
spoon.ModalMgr.supervisor:bind(hsclipsM_keys[1], hsclipsM_keys[2], "Enter clipshowM Environment", function()
-- We need to take action upon hsclipsM_keys is pressed, since pressing another key to showing ClipShow panel is redundant.
spoon.ClipShow:toggleShow()
-- Need a little trick here. Since the content type of system clipboard may be "URL", in which case we don't need to activate clipshowM.
if spoon.ClipShow.canvas:isShowing() then
spoon.ModalMgr:deactivateAll()
spoon.ModalMgr:activate({"clipshowM"})
end
end)
end
end end
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -368,14 +372,6 @@ if spoon.HSaria2 then
end end
end end
----------------------------------------------------------------------------------------------------
-- Register Hammerspoon Search
if spoon.HSearch then
hsearch_keys = hsearch_keys or {"alt", "G"}
if string.len(hsearch_keys[2]) > 0 then
spoon.ModalMgr.supervisor:bind(hsearch_keys[1], hsearch_keys[2], 'Launch Hammerspoon Search', function() spoon.HSearch:toggleShow() end)
end
end
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
-- Register Hammerspoon API manual: Open Hammerspoon manual in default browser -- Register Hammerspoon API manual: Open Hammerspoon manual in default browser
@ -426,15 +422,6 @@ if spoon.CountDown then
end end
end end
----------------------------------------------------------------------------------------------------
-- Register lock screen
hslock_keys = hslock_keys or {"alt", "L"}
if string.len(hslock_keys[2]) > 0 then
spoon.ModalMgr.supervisor:bind(hslock_keys[1], hslock_keys[2], "Lock Screen", function()
hs.caffeinate.lockScreen()
end)
end
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
-- resizeM modal environment -- resizeM modal environment
if spoon.WinWin then if spoon.WinWin then
@ -549,13 +536,17 @@ if string.len(hstype_keys[2]) > 0 then
end) end)
end end
----------------------------------------------------------------------------------------------------
-- Register Hammerspoon console
hsconsole_keys = hsconsole_keys or {"alt", "Z"}
if string.len(hsconsole_keys[2]) > 0 then
spoon.ModalMgr.supervisor:bind(hsconsole_keys[1], hsconsole_keys[2], "Toggle Hammerspoon Console", function() hs.toggleConsole() end)
end
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
-- Finally we initialize ModalMgr supervisor -- Finally we initialize ModalMgr supervisor
spoon.ModalMgr.supervisor:enter() spoon.ModalMgr.supervisor:enter()
stackline = require "stackline.stackline.stackline"
local myStackline = {
appearance = {
showIcons = true, -- default is true
},
features = {
clickToFocus = true
}
}
stackline:init(myStackline)

1
hammerspoon/stackline

@ -0,0 +1 @@
Subproject commit c93a0bd889f5dc1170a87b0ea7d74c85b06283fe

18
install

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
CONFIG="config/install.conf.yml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" \
--verbose \
--plugin-dir dotbot-brew \
-c "${CONFIG}" "${@}"

2
install.sh

@ -3,7 +3,6 @@ VIMDIR=${1:-$HOME}
# install ctags to solve "Exuberant ctags not found in PATH" error # install ctags to solve "Exuberant ctags not found in PATH" error
sudo apt-get install -y git zsh zsh-antigen vim vim-gtk tmux sudo apt-get install -y git zsh zsh-antigen vim vim-gtk tmux
chsh -s $(which zsh)
sudo apt-get install -y exuberant-ctags sudo apt-get install -y exuberant-ctags
sudo apt-get install -y htop tree zip unzip wget nethogs sudo apt-get install -y htop tree zip unzip wget nethogs
@ -34,7 +33,6 @@ if [ "$use_vim_configs" == "Y" ] || [ "$use_vim_configs" == "y" ]; then
# link zshrc # link zshrc
ln -rsf $PWD/.zshrc $VIMDIR/.zshrc 2> /dev/null ln -rsf $PWD/.zshrc $VIMDIR/.zshrc 2> /dev/null
#curl -L git.io/antigen > $VIMDIR/antigen.zsh #curl -L git.io/antigen > $VIMDIR/antigen.zsh
git clone [email protected]:zsh-users/antigen.git $HOME/antigen
fi fi
# install asdf # install asdf

9
karabiner/karabiner.edn

@ -45,10 +45,11 @@
:applications {:chrome ["^com\\.google\\.Chrome$"] :applications {:chrome ["^com\\.google\\.Chrome$"]
:chrome-canary [ "^com\\.google\\.Chrome\\.canary$"] :chrome-canary [ "^com\\.google\\.Chrome\\.canary$"]
:chromes ["^com\\.google\\.Chrome$" "^com\\.google\\.Chrome\\.canary$"] :chromes ["^com\\.google\\.Chrome$" "^com\\.google\\.Chrome\\.canary$"]
:ctrlnp ["md\\.obsidian", :ctrlnp ["^md\\.obsidian",
"com\\.jetbrains\\.intellij", "^com\\.jetbrains\\.intellij",
"com.electron.lark" "^com\\.electron\\.lark"
"com\\.google\\.Chrome"] "^com\\.tencent\\.xinWeChat"
"^com\\.google\\.Chrome"]
:finder ["^com\\.apple\\.finder$"] :finder ["^com\\.apple\\.finder$"]
:terminals ["com\\.apple\\.Terminal", :terminals ["com\\.apple\\.Terminal",
"com\\.googlecode\\.iterm2"] "com\\.googlecode\\.iterm2"]

18
karabiner/karabiner.json

@ -2606,10 +2606,11 @@
"conditions": [ "conditions": [
{ {
"bundle_identifiers": [ "bundle_identifiers": [
"md\\.obsidian", "^md\\.obsidian",
"com\\.jetbrains\\.intellij", "^com\\.jetbrains\\.intellij",
"com.electron.lark", "^com\\.electron\\.lark",
"com\\.google\\.Chrome" "^com\\.tencent\\.xinWeChat",
"^com\\.google\\.Chrome"
], ],
"type": "frontmost_application_if" "type": "frontmost_application_if"
} }
@ -2633,10 +2634,11 @@
"conditions": [ "conditions": [
{ {
"bundle_identifiers": [ "bundle_identifiers": [
"md\\.obsidian", "^md\\.obsidian",
"com\\.jetbrains\\.intellij", "^com\\.jetbrains\\.intellij",
"com.electron.lark", "^com\\.electron\\.lark",
"com\\.google\\.Chrome" "^com\\.tencent\\.xinWeChat",
"^com\\.google\\.Chrome"
], ],
"type": "frontmost_application_if" "type": "frontmost_application_if"
} }

11
mackup/mackup.cfg

@ -0,0 +1,11 @@
[storage]
engine = file_system
path = Sync
directory = Mackup
[applications_to_sync]
macosx
[applications_to_ignore]
karabiner-elements

0
init_mac.sh → macos/init_mac.sh

352
skhd/skhdrc

@ -0,0 +1,352 @@
#!/bin/bash
# NOTE(koekeishiya): A list of all built-in modifier and literal keywords can
# be found at https://github.com/koekeishiya/skhd/issues/1
#
# A hotkey is written according to the following rules:
#
# hotkey = <mode> '<' <action> | <action>
#
# mode = 'name of mode' | <mode> ',' <mode>
#
# action = <keysym> '[' <proc_map_lst> ']' | <keysym> '->' '[' <proc_map_lst> ']'
# <keysym> ':' <command> | <keysym> '->' ':' <command>
# <keysym> ';' <mode> | <keysym> '->' ';' <mode>
#
# keysym = <mod> '-' <key> | <key>
#
# mod = 'modifier keyword' | <mod> '+' <mod>
#
# key = <literal> | <keycode>
#
# literal = 'single letter or built-in keyword'
#
# keycode = 'apple keyboard kVK_<Key> values (0x3C)'
#
# proc_map_lst = * <proc_map>
#
# proc_map = <string> ':' <command>
#
# string = '"' 'sequence of characters' '"'
#
# command = command is executed through '$SHELL -c' and
# follows valid shell syntax. if the $SHELL environment
# variable is not set, it will default to '/bin/bash'.
# when bash is used, the ';' delimeter can be specified
# to chain commands.
#
# to allow a command to extend into multiple lines,
# prepend '\' at the end of the previous line.
#
# an EOL character signifies the end of the bind.
#
# -> = keypress is not consumed by skhd
#
# NOTE(koekeishiya): A mode is declared according to the following rules:
#
# mode_decl = '::' <name> '@' ':' <command> | '::' <name> ':' <command> |
# '::' <name> '@' | '::' <name>
#
# name = desired name for this mode,
#
# @ = capture keypresses regardless of being bound to an action
#
# command = command is executed through '$SHELL -c' and
# follows valid shell syntax. if the $SHELL environment
# variable is not set, it will default to '/bin/bash'.
# when bash is used, the ';' delimeter can be specified
# to chain commands.
#
# to allow a command to extend into multiple lines,
# prepend '\' at the end of the previous line.
#
# an EOL character signifies the end of the bind.
# add an on_enter command to the default mode
# :: default : chunkc border::color 0xff775759
#
# defines a new mode 'test' with an on_enter command, that captures keypresses
# :: test @ : chunkc border::color 0xff24ccaa
#
# from 'default' mode, activate mode 'test'
# cmd - x ; test
#
# from 'test' mode, activate mode 'default'
# test < cmd - x ; default
#
# launch a new terminal instance when in either 'default' or 'test' mode
# default, test < cmd - return : open -na /Applications/Terminal.app
# application specific bindings
#
# cmd - n [
# "kitty" : echo "hello kitty"
# "qutebrowser" : echo "hello qutebrowser"
# "finder" : false
# ]
# narze's config
# Legends
# Leader : Alt
# Navigation : H / J / K / L (vim)
# Prew / Next : < / >
# Move : Leader + Shift
# Resize : Leader + Cmd
# Monitor : I / O
# Desktop : U / P or Leader + Ctrl
# Keycodes
# 0x23 = Colemak semicolon / Qwerty P
# 0x2B = Comma / <
# 0x2F = Fullstop / >
# 0x2C = Slash
# open terminal
# cmd - return : /Applications/iTerm.app/Contents/MacOS/iTerm2 --single-instance -d ~ &> /dev/null
# close focused window
# alt - w : yabai -m window --close
# focus window
alt - j : yabai -m window --focus south
alt - h : yabai -m window --focus west
alt - k : yabai -m window --focus north
alt - l : yabai -m window --focus east
# alt - m : yabai -m window --focus recent
# focus window in stack
alt - 0x2B : yabai -m window --focus stack.prev
alt - 0x2F : yabai -m window --focus stack.next
alt - 0x2C : yabai -m window --focus stack.recent
# focus monitor
alt - u : ~/.yabai_focus_display prev
# alt + ctrl - h : ~/.yabai_focus_display prev
alt - y : ~/.yabai_focus_display next
# alt + ctrl - i : ~/.yabai_focus_display next
# move window
alt + cmd + shift - j : yabai -m window --warp south
alt + cmd + shift - h : yabai -m window --warp west
alt + cmd + shift - k : yabai -m window --warp north
alt + cmd + shift - l : yabai -m window --warp east
# swap window
alt + shift - j : yabai -m window --swap south
alt + shift - h : yabai -m window --swap west
alt + shift - k : yabai -m window --swap north
alt + shift - l : yabai -m window --swap east
# stack window
alt + ctrl + shift - h : yabai -m window --stack west
alt + ctrl + shift - j : yabai -m window --stack south
alt + ctrl + shift - k : yabai -m window --stack north
alt + ctrl + shift - l : yabai -m window --stack east
# make floating window fill screen, make it float if not already floating
ctrl + alt + cmd - t : yabai -m window --toggle float; \
floating=$(yabai -m query --windows --window | jq .floating); \
[ $floating -eq 1 ] && yabai -m window --grid 1:1:0:0:1:1
# float fill left half
ctrl + alt + cmd - h : yabai -m window --grid 1:2:0:0:1:1
ctrl + alt + cmd - m : yabai -m window --grid 1:2:0:0:1:1
# float fill right half
ctrl + alt + cmd - i : yabai -m window --grid 1:2:1:0:1:1
# float fill bottom half
ctrl + alt + cmd - n : yabai -m window --grid 2:1:0:1:1:1
# float fill top half
ctrl + alt + cmd - e : yabai -m window --grid 2:1:0:0:1:1
# create desktop
ctrl + cmd + alt - m : yabai -m space --create;
# create desktop, move window and follow focus
ctrl + alt + cmd - k : yabai -m space --create; \
yabai -m window --space last; \
yabai -m space --focus last; \
yabai -m window --grid 1:1:0:0:1:1
# destroy desktop
ctrl + cmd + alt + shift - w : yabai -m space --focus prev; \
yabai -m space next --destroy
# fast focus desktop
# alt + ctrl - 0x2B : yabai -m space --focus recent
# alt - l : yabai -m space --focus prev
# alt + ctrl - h : yabai -m space --focus prev
# alt - 0x23 : yabai -m space --focus next
# alt + ctrl - i : yabai -m space --focus next
alt - 1 : yabai -m space --focus 1
alt - 2 : yabai -m space --focus 2
alt - 3 : yabai -m space --focus 3
alt - 4 : yabai -m space --focus 4
# send window to desktop
# alt + ctrl + shift - 0x2B : yabai -m window --space recent
# alt + shift - l : yabai -m window --space prev
# alt + ctrl + shift - h : yabai -m window --space prev
# alt + shift - 0x23 : yabai -m window --space next
shift + alt - 1 : yabai -m window --space 1
shift + alt - 2 : yabai -m window --space 2
shift + alt - 3 : yabai -m window --space 3
shift + alt - 4 : yabai -m window --space 4
shift + alt + cmd - 1 : yabai -m window --space 1; yabai -m space --focus 1
shift + alt + cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2
shift + alt + cmd - 3 : yabai -m window --space 3; yabai -m space --focus 3
shift + alt + cmd - 4 : yabai -m window --space 4; yabai -m space --focus 4
# send window to desktop and follow focus
# shift + cmd - x : yabai -m window --space $(chunkc get _last_active_desktop); yabai -m space --focus $(chunkc get _last_active_desktop)
# shift + cmd - z : yabai -m window --space prev; yabai -m space --focus prev
# shift + cmd - c : yabai -m window --space next; yabai -m space --focus next
# shift + cmd - 1 : yabai -m window --space 1; yabai -m space --focus 1
# shift + cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2
# shift + cmd - 3 : yabai -m window --space 3; yabai -m space --focus 3
# shift + cmd - 4 : yabai -m window --space 4; yabai -m space --focus 4
ctrl + alt - 1 : yabai -m display --focus 1
ctrl + alt - 2 : yabai -m display --focus 2
ctrl + alt - 3 : yabai -m display --focus 3
# send window to monitor and follow focus
alt + shift - u : yabai -m window --display prev; yabai -m display --focus prev
alt + shift - y : yabai -m window --display next; yabai -m display --focus next
# shift + alt + cmd - 1 : yabai -m window --display 1; yabai -m display --focus 1
# shift + alt + cmd - 2 : yabai -m window --display 2; yabai -m display --focus 2
# shift + alt + cmd - 3 : yabai -m window --display 3; yabai -m display --focus 3
# increase region size
alt + cmd - a : yabai -m window --resize left:-80:0
alt + cmd - r : yabai -m window --resize bottom:0:80
alt + cmd - w : yabai -m window --resize top:0:-80
alt + cmd - s : yabai -m window --resize right:80:0
# decrease region size
alt + cmd + ctrl - a : yabai -m window --resize left:80:0
alt + cmd + ctrl - r : yabai -m window --resize bottom:0:-80
alt + cmd + ctrl - w : yabai -m window --resize top:0:80
alt + cmd + ctrl - s : yabai -m window --resize right:-80:0
# set insertion point for focused container
ctrl + alt - h : yabai -m window --insert west
ctrl + alt - m : yabai -m window --insert west
ctrl + alt - n : yabai -m window --insert south
ctrl + alt - e : yabai -m window --insert north
ctrl + alt - i : yabai -m window --insert east
# rotate tree
alt - r : yabai -m space --rotate 90
# mirror tree y-axis
alt + shift - x : yabai -m space --mirror vertical
# mirror tree x-axis
alt - x : yabai -m space --mirror horizontal
# toggle desktop padding
alt - a : yabai -m space --toggle padding
# toggle window fullscreen
alt - f : yabai -m window --toggle fullscreen
# toggle window native fullscreen
shift + alt - f : yabai -m window --toggle native-fullscreen
# toggle window zoom
alt - z : yabai -m window --toggle zoom-fullscreen
# toggle window split type
alt - c : yabai -m window --toggle split
# toggle window fade
alt - q : yabai -m window --toggle fade
# float / unfloat window and center on screen
alt - t : yabai -m window --toggle float;\
yabai -m window --grid 6:6:1:1:4:4
# toggle sticky
alt - s : yabai -m window --toggle sticky
# toggle border
alt - b : yabai -m window --toggle border
# classic pip
alt - p : yabai -m window --toggle float;\
yabai -m window --toggle sticky;\
yabai -m window --toggle topmost;\
yabai -m window --grid 5:5:3:0:2:2
# toggle sticky, float and resize to picture-in-picture size
alt + shift - p : yabai -m window --toggle sticky;\
yabai -m window --toggle topmost;\
yabai -m window --toggle border;\
yabai -m window --toggle pip
# float next window to be tiled
# shift + alt - t : chunkc set window_float_next 1
# change layout of desktop
ctrl + alt - a : yabai -m space --layout bsp; \
terminal-notifier -title Yabai -message "Bsp mode activated"
ctrl + alt - r: yabai -m space --layout float; \
terminal-notifier -title Yabai -message "Float mode activated"
ctrl + alt - s : yabai -m space --layout stack; \
terminal-notifier -title Yabai -message "Stack mode activated"
# ctrl + alt - l : yabai -m space --deserialize ~/.chunkwm_layout
# ctrl + alt + cmd - l : yabai -m space --serialize ~/.chunkwm_layout
# Fix screenshot taking in app mode
cmd + shift - 4 -> : yabai -m window --toggle border; sleep 3; yabai -m window --toggle border;
ctrl + cmd + shift - 4 -> : yabai -m window --toggle border; sleep 3; yabai -m window --toggle border;
# MPC commands
ctrl + alt + cmd + shift - 0x23 : mpc toggle
ctrl + alt + cmd - 0x2B : mpc prev
ctrl + alt + cmd - 0x2F : mpc next
# Reload yabai
ctrl + alt + cmd - z : osascript -e 'tell application "Keyboard Maestro Engine" to do script "Hide All Windows"' && \
launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"
# Float everything in screen except current window
ctrl + alt + cmd - x : ids=$(yabai -m query --windows --space | jq -r ".[] | select(.floating == 0) | .id") && \
while IFS= read -r id; do \
yabai -m window $id --toggle float; \
done <<< "$ids" && \
ids=$(yabai -m query --windows --space | jq -r ".[] | select(.floating == 1) | .id") && \
while IFS= read -r id; do \
yabai -m window $id --grid 6:6:1:1:4:4; \
done <<< "$ids" && \
# Unfloat
ctrl + alt + cmd - c : ids=$(yabai -m query --windows --space | jq -r ".[] | select(.floating == 1) | .id") && \
while IFS= read -r id; do \
yabai -m window $id --toggle float ; \
done <<< "$ids"
# Balance windows
alt - 0x2C : yabai -m space --balance
# Toggle space windows gap
alt - d : yabai -m space --toggle gap
# Toggle space windows padding
alt - g : yabai -m space --toggle padding
# Task randomizer
ctrl + alt + cmd + shift - d : osascript ~/Library/Scripts/omnifocus-task-randomizer.applescript
# Hyper 1-0
ctrl + alt + cmd + shift - 1 : /Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge
# change layout of desktop
ctrl + alt - a : yabai -m space --layout bsp
ctrl + alt - d : yabai -m space --layout float
ctrl + alt - s : yabai -m space --layout $(yabai -m query --spaces --space | jq -r 'if .type == "bsp" then "float" else "bsp" end')

23
wp-completion.bash

@ -1,23 +0,0 @@
# bash completion for the `wp` command
_wp_complete() {
local OLD_IFS="$IFS"
local cur=${COMP_WORDS[COMP_CWORD]}
IFS=$'\n'; # want to preserve spaces at the end
local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
if [[ "$opts" =~ \<file\>\s* ]]
then
COMPREPLY=( $(compgen -f -- $cur) )
elif [[ $opts = "" ]]
then
COMPREPLY=( $(compgen -f -- $cur) )
else
COMPREPLY=( ${opts[*]} )
fi
IFS="$OLD_IFS"
return 0
}
complete -o nospace -F _wp_complete wp

25
yabai/yabai_focus_display

@ -0,0 +1,25 @@
#!/bin/sh
# https://github.com/koekeishiya/yabai/issues/225
case "${1}" in
next)
step=1
;;
prev)
step=-1
;;
*)
echo >&2 "ERROR: must provide an argument 'next' or 'prev'!"
exit 1
;;
esac
jq -nr \
--argjson displays "$(yabai -m query --displays)" \
--argjson focused "$(yabai -m query --displays --display)" \
--argjson step "$step" \
'$displays
| sort_by(.frame.x)
| .[index($focused) + if (index($focused) + $step) < 0 then 0 else $step end].index // $focused.index' \
| xargs yabai -m display --focus

69
yabai/yabairc

@ -0,0 +1,69 @@
#!/usr/bin/env sh
# global settings
yabai -m config mouse_follows_focus on
yabai -m config focus_follows_mouse autofous
yabai -m config window_placement second_child
yabai -m config window_topmost off
yabai -m config window_shadow on
yabai -m config window_opacity off
yabai -m config window_opacity_duration 0.0
yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.85
yabai -m config split_ratio 0.55
yabai -m config auto_balance off
yabai -m config mouse_modifier fn
yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize
yabai -m config mouse_drop_action stack
# border
yabai -m config window_border off
yabai -m config window_border_width 6
yabai -m config active_window_border_color 0xff775759
yabai -m config normal_window_border_color 0xff555555
yabai -m config insert_feedback_color 0xffd75f5f
# general space settings
yabai -m config layout bsp
yabai -m config top_padding 5
yabai -m config bottom_padding 5
yabai -m config left_padding 5
yabai -m config right_padding 5
yabai -m config window_gap 4
yabai -m window --stack next
# space label
yabai -m space 1 --label main
yabai -m space 2 --label code
yabai -m space 3 --label git
yabai -m space 4 --label other
yabai -m rule --add label="Activity Monitor" app="^Activity Monitor$" manage=off
yabai -m rule --add label="Adobe Lightroom Classic" app="Adobe Lightroom Classic" manage=off space=main
yabai -m rule --add label="Alfred Preferences" app="^Alfred Preferences$" manage=off
yabai -m rule --add label="App Store" app="^App Store$" manage=off
yabai -m rule --add label="Calculator" app="^Calculator$" manage=off
yabai -m rule --add label="Dash" app="Dash" manage=off
yabai -m rule --add label="DataGrip" app="DataGrip" manage=off
yabai -m rule --add app="^Discord$" space=7 grid=1:1:0:0:1:1 manage=off
yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off
yabai -m rule --add label="GoldenDict" app="GoldenDict" manage=off
yabai -m rule --add label="IntelliJ IDEA" app="IntelliJ IDEA" manage=off space=code
yabai -m rule --add label="Preview" app="Preview" manage=off
yabai -m rule --add label="System Preferences" app="^System Preferences$" manage=off
yabai -m rule --add label="SmartGit" app="SmartGit" manage=off space=git
yabai -m rule --add label="VirtualBox" app="^VirtualBox$" manage=off
# signals
# focus mouse hovered window when a window is closed, minimized or terminated
yabai -m signal --add event=window_destroyed action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse"
yabai -m signal --add event=window_minimized action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse"
yabai -m signal --add event=application_terminated action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse"
echo "yabai configuration loaded.."

1
zsh/alias.zsh

@ -1,6 +1,7 @@
alias tmux="TERM=screen-256color tmux -2" alias tmux="TERM=screen-256color tmux -2"
alias vi="vim" alias vi="vim"
alias ls="exa" alias ls="exa"
alias cd="z"
alias mux="TERM=screen-256color tmuxinator" alias mux="TERM=screen-256color tmuxinator"
#alias ls="ls -alh" #alias ls="ls -alh"
alias cp="cp -i" alias cp="cp -i"

Loading…
Cancel
Save