Skip to content

Instantly share code, notes, and snippets.

@nLight
Last active March 24, 2017 20:16
Show Gist options
  • Save nLight/4256ffb990096875ccb9 to your computer and use it in GitHub Desktop.
Save nLight/4256ffb990096875ccb9 to your computer and use it in GitHub Desktop.
dots
# Git
## Git undo
alias gundo="git reset HEAD~1"
## Resolve conflicts
alias conflicts='git status -s | grep -e "^\(DD\|AU\|UD\|UA\|DU\|AA\|UU\)" | cut -d " " -f2'
alias resolve='conflicts | xargs subl'
alias cadd='conflicts | xargs git add'
## WIP
alias wip="git commit -am \"WIP\""
## Open changed files in sublime
alias changes='git status -s | grep -e "^\(\\sM\|\\?\\?\)" | rev | cut -d" " -f1 | rev | xargs atom'
alias g="git"
alias gcm="git commit -m"
alias gco="git checkout"
[push]
default = matching
[rebase]
autosquash = true
[merge]
tool = opendiff
"\e[1;9D": backward-word
"\e[1;9C": forward-word
set-option -g history-limit 10000
# Use vim keybindings in copy mode
setw -g mode-keys vi
set-option -g default-command "reattach-to-user-namespace -l zsh"
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
bind -n S-Up copy-mode # PgUp enables copy-mode
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
set -g mouse on
# to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
# toggle mouse
bind m run "cut -c3- ~/.tmux.conf | sh -s toggle_mouse"
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
tmux_conf_theme=powerline
# -- display -------------------------------------------------------------------
# start windows numbering at 1
set -g base-index 1
# make pane numbering consistent with windows
setw -g pane-base-index 1
# rename window to reflect current program
setw -g automatic-rename on
# renumber windows when a window is closed
set -g renumber-windows on
# set terminal title
set -g set-titles on
set -g set-titles-string '#h ❐ #S ● #I #W'
# Highlight active window
set-window-option -g window-status-current-bg green
# Set status bar
set -g status-bg colour235
set -g status-fg white
set -g status-left-bg colour2
set -g status-left-fg "#FFFFFF"
set -g status-left " #S "
set -g status-left-length 15
set -g status-right "#[fg=green]%d %b %R "
set -g status-interval 60
# window list
set -g status-justify centre
set -g window-status-format "#[fg=colour8] #I #[fg=colour231]#W#[fg=colour166]#F "
set -g window-status-current-format "#[fg=colour117,bg=colour31] #I #[fg=colour231]#W#[fg=colour234]#F "
set -g window-status-separator ""
# -- New panes/windows opens with current dir ----------------------------------
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "$HOME/workspace"
# -- Productivity hot keys -----------------------------------------------------
bind "/" send-keys 'bundle exec rake' C-m
bind "e" send-keys 'subl ./' C-m
bind -n M-Up send-keys 'git push' C-m
bind -n M-Down send-keys 'git pull' C-m
bind -n M-c send-keys 'git commit' C-m
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
#
# General
#
# Set case-sensitivity for completion, history lookup, etc.
# zstyle ':prezto:*:*' case-sensitive 'yes'
# Color output (auto set to 'no' on dumb terminals).
zstyle ':prezto:*:*' color 'yes'
# Set the Zsh modules to load (man zshmodules).
# zstyle ':prezto:load' zmodule 'attr' 'stat'
# Set the Zsh functions to load (man zshcontrib).
# zstyle ':prezto:load' zfunction 'zargs' 'zmv'
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'tmux' \
'history' \
'history-substring-search' \
'directory' \
'spectrum' \
'utility' \
'completion' \
'git' \
'prompt'
#
# Editor
#
# Set the key mapping style to 'emacs' or 'vi'.
zstyle ':prezto:module:editor' key-bindings 'emacs'
# Auto convert .... to ../..
# zstyle ':prezto:module:editor' dot-expansion 'yes'
#
# Git
#
# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'.
# zstyle ':prezto:module:git:status:ignore' submodules 'all'
#
# GNU Utility
#
# Set the command prefix on non-GNU systems.
# zstyle ':prezto:module:gnu-utility' prefix 'g'
#
# History Substring Search
#
# Set the query found color.
zstyle ':prezto:module:history-substring-search:color' found ''
# Set the query not found color.
zstyle ':prezto:module:history-substring-search:color' not-found ''
# Set the search globbing flags.
zstyle ':prezto:module:history-substring-search' globbing-flags ''
#
# Pacman
#
# Set the Pacman frontend.
# zstyle ':prezto:module:pacman' frontend 'yaourt'
#
# Prompt
#
# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
zstyle ':prezto:module:prompt' theme 'sorin'
#
# Ruby
#
# Auto switch the Ruby version on directory change.
# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes'
#
# Screen
#
# Auto start a session when Zsh is launched in a local terminal.
# zstyle ':prezto:module:screen:auto-start' local 'yes'
# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:screen:auto-start' remote 'yes'
#
# SSH
#
# Set the SSH identities to load into the agent.
# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github'
#
# Syntax Highlighting
#
# Set syntax highlighters.
# By default, only the main highlighter is enabled.
# zstyle ':prezto:module:syntax-highlighting' highlighters \
# 'main' \
# 'brackets' \
# 'pattern' \
# 'cursor' \
# 'root'
#
# Set syntax highlighting styles.
# zstyle ':prezto:module:syntax-highlighting' styles \
# 'builtin' 'bg=blue' \
# 'command' 'bg=blue' \
# 'function' 'bg=blue'
#
# Terminal
#
# Auto set the tab and window titles.
zstyle ':prezto:module:terminal' auto-title 'yes'
# Set the window title format.
zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'
# Set the tab title format.
zstyle ':prezto:module:terminal:tab-title' format '%n@%m: %s'
#
# Tmux
#
# Auto start a session when Zsh is launched in a local terminal.
zstyle ':prezto:module:tmux:auto-start' local 'yes'
# Auto start a session when Zsh is launched in a SSH connection.
zstyle ':prezto:module:tmux:auto-start' remote 'yes'
bindkey -e
bindkey '^[[1;9C' forward-word
bindkey '^[[1;9D' backward-word
# General Productivity
## Show git status on an empty <Return>
accept-line() {
if [[ -z $BUFFER && -d .git ]]; then
zle -I
git status
else
zle ".$WIDGET"
fi
}
zle -N accept-line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment