feat(*): initial commit

This commit is contained in:
2022-05-09 00:28:23 +08:00
commit 50d445306b
11 changed files with 2124 additions and 0 deletions

43
README.md Normal file
View File

@@ -0,0 +1,43 @@
![iTerm2 screenshot](./images/screenshot-1.png)
# Rack Lin's dotfiles
I am using [GNU Stow](https://www.gnu.org/software/stow/) - a symlink farm manager to manage dotfiles.
**Warning**: Dont blindly use my settings unless you know what that entails. Use at your own risk!
## Prerequisites
Make sure you have installed all of the following prerequisites on your development machine:
- [GNU Stow](https://www.gnu.org/software/stow/) > 2.3.0 that support new `--dotfiles` option
- [z for fish](https://github.com/jethrokuan/z) - Directory jumping
- [Exa](https://the.exa.website/) - `ls` replacement
- [ghq](https://github.com/x-motemen/ghq) - Local Git repository organizer
- [fzf](https://github.com/junegunn/fzf) - is a general-purpose command-line fuzzy finder.
## Contents
- git config
- zsh config
- [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh)
- [powerlevel10k theme](https://github.com/romkatv/powerlevel10k)
- tmux config
- MacOSX config
## How to use
### git
Lets stow git setting,
`stow --dotfiles -vSt ~ git`
Thats it! we have successfully created a symlink for `.gitconfig` ,and a symlink for `.gitignore_global`
### zsh
`stow --dotfiles -vSt ~ zsh`
### tmux
`stow --dotfiles -vSt ~ tmux`
## About me
- [Twitter](https://twitter.com/racklin)
- [github](https://github.com/racklin)

29
git/dot-gitconfig Executable file
View File

@@ -0,0 +1,29 @@
[user]
name = Rack Lin
email = racklin@gmail.com
[color]
diff = auto
status = auto
branch = auto
[alias]
zip = archive --format=zip HEAD
[branch "master"]
remote = origin
merge = master
[core]
excludesfile = /Users/rack/.gitignore_global
fileMode = false
ignorecase = false
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[github]
user = racklin@gmail.com
[ghq]
root = ~/.ghq
[init]
defaultBranch = master

50
git/dot-gitignore_global Executable file
View File

@@ -0,0 +1,50 @@
*.o
\#*#
*#
.#*
.*~
*~
.DS_Store
*.sw[po]
tags
TAGS
.svn
*.dSYM
*.log
*.dvi
*.aux
*.elc
.zshrc.local
.python-version
samples
.netrwhist
.bundle
/vendor/bundle
Gemfile.lock
node_modules
bower_components
# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
*.xcworkspace/xcshareddata
# Atom.io
.atom/packages/save-session
.atom/compile-cache
.atom/storage

BIN
images/screenshot-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

86
tmux/dot-tmux.conf Normal file
View File

@@ -0,0 +1,86 @@
set -g default-terminal "xterm-256color"
#set -ga terminal-overrides ",*256col*:Tc"
set -ga terminal-overrides ",xterm-256color:Tc"
# action key
unbind C-b
set-option -g prefix C-t
set-option -g repeat-time 0
#### Key bindings
set-window-option -g mode-keys vi
#bind t send-key C-t
# Reload settings
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Open current directory
bind o run-shell "open #{pane_current_path}"
bind -r e kill-pane -a
# vim-like pane switching
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# Moving window
bind-key -n C-S-Left swap-window -t -1 \; previous-window
bind-key -n C-S-Right swap-window -t +1 \; next-window
# Resizing pane
bind -r C-k resize-pane -U 5
bind -r C-j resize-pane -D 5
bind -r C-h resize-pane -L 5
bind -r C-l resize-pane -R 5
#### basic settings
set-option -g status-justify "left"
#set-option utf8-default on
#set-option -g mouse-select-pane
set-window-option -g mode-keys vi
#set-window-option -g utf8 on
# look'n feel
set-option -g status-fg cyan
set-option -g status-bg black
set -g pane-active-border-style fg=colour166,bg=default
set -g window-style fg=colour10,bg=default
set -g window-active-style fg=colour12,bg=default
set-option -g history-limit 64096
set -sg escape-time 10
#### COLOUR
# default statusbar colors
set-option -g status-style bg=colour235,fg=colour136,default
# default window title colors
set-window-option -g window-status-style fg=colour244,bg=colour234,dim
# active window title colors
set-window-option -g window-status-current-style fg=colour166,bg=default,bright
# pane border
set-option -g pane-border-style fg=colour235 #base02
set-option -g pane-active-border-style fg=colour136,bg=colour235
# message text
set-option -g message-style bg=colour235,fg=colour166
# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
# clock
set-window-option -g clock-mode-colour colour64 #green
# allow the title bar to adapt to whatever host you connect to
set -g set-titles on
set -g set-titles-string "#T"
# import
if-shell "uname -s | grep -q Darwin" "source ~/.tmux.conf.osx"
# Powerline
source ~/.tmux.powerline.conf

2
tmux/dot-tmux.conf.osx Normal file
View File

@@ -0,0 +1,2 @@
# sync clipboard
set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"

View File

@@ -0,0 +1,21 @@
# vim: ft=tmux
if-shell 'test -z "$POWERLINE_CONFIG_COMMAND"' 'set-environment -g POWERLINE_CONFIG_COMMAND powerline-config'
# Don't version-check for this core functionality -- anything too old to
# support these options likely won't work well with powerline
set -g status on
set -g status-interval 2
set -g status-left-length 60
set -g status-left '#[fg=colour235,bg=colour252,bold] #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]'
set -g status-right-length 150
set -g status-right '#[fg=colour59]#[fg=colour255,bg=colour59] #[fg=colour254,bold]#[fg=colour16,bg=colour254,bold] #h '
set -g window-status-separator '#[fg=colour244,bg=colour234] '
set -g window-status-format "#[fg=colour244,bg=colour234] #I #[fg=colour240] #[default,bg=colour234]#W "
set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I  #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
# load powerline
if-shell 'env "$POWERLINE_CONFIG_COMMAND" tmux setup' '' 'run-shell "powerline-config tmux setup"'

10
zsh/dot-config-osx.zsh Normal file
View File

@@ -0,0 +1,10 @@
# Add HomeBrew PATH
export PATH=/opt/homebrew/bin:$PATH
# EXA
[ -x /opt/homebrew/bin/exa ] && alias ll="exa -l -g --icons"
# PHP
export PATH="/opt/homebrew/opt/php/bin:$PATH"
export PATH="/opt/homebrew/opt/php/sbin:$PATH"

17
zsh/dot-fzf.zsh Normal file
View File

@@ -0,0 +1,17 @@
# Setup fzf
# ---------
if [[ ! "$PATH" == */opt/homebrew/opt/fzf/bin* ]]; then
export PATH="${PATH:+${PATH}:}/opt/homebrew/opt/fzf/bin"
fi
# using fd instead of find
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
# Auto-completion
# ---------------
[[ $- == *i* ]] && source "/opt/homebrew/opt/fzf/shell/completion.zsh" 2> /dev/null
# Key bindings
# ------------
source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh"

1741
zsh/dot-p10k.zsh Normal file

File diff suppressed because it is too large Load Diff

125
zsh/dot-zshrc Normal file
View File

@@ -0,0 +1,125 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#ZSH_THEME="agnoster"
ZSH_THEME="powerlevel10k/powerlevel10k"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# FZF
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# GHQ and FZF
alias ghqcd="cd \$(ghq list --full-path | fzf)"
# OS SPECIFIC SETTINGS
case "$(uname)" in
Darwin)
[ -f ~/.config-osx.zsh ] && source ~/.config-osx.zsh
;;
esac
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh