dotfiles: init

This commit is contained in:
2018-10-30 23:34:18 +02:00
commit 1826e633c1
12 changed files with 1419 additions and 0 deletions

3
.stowrc Normal file
View File

@@ -0,0 +1,3 @@
--ignore='README.md'
--target=/Users/madundead

53
Brewfile Normal file
View File

@@ -0,0 +1,53 @@
tap "heroku/brew"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/services"
brew "bat"
brew "curl"
brew "diff-so-fancy"
brew "fd"
brew "fzf"
brew "htop"
brew "httpie"
brew "mysql", restart_service: true
brew "neovim"
brew "nmap"
brew "node"
brew "rbenv"
brew "reattach-to-user-namespace"
brew "redis", restart_service: true
brew "ripgrep"
brew "speedtest-cli"
brew "stow"
brew "streamlink"
brew "tig"
brew "tldr"
brew "tmux"
brew "urlview"
brew "wget"
brew "zsh"
brew "heroku/brew/heroku"
cask "alfred"
cask "dash"
cask "discord"
cask "iterm2"
cask "karabiner-elements"
cask "macdown"
cask "macvim"
cask "qlcolorcode"
cask "qlimagesize"
cask "qlmarkdown"
cask "qlstephen"
cask "qlvideo"
cask "quicklook-json"
cask "quicklookase"
cask "sequel-pro"
cask "steam"
cask "transmission"
cask "virtualbox"
cask "vlc"
cask "webpquicklook"
cask "xquartz"

1
README.md Normal file
View File

@@ -0,0 +1 @@
# DOTFILES

2
TODO.md Normal file
View File

@@ -0,0 +1,2 @@
* cleanup all this mess
* use this repo instead of stuff

8
bash/.bash_profile Normal file
View File

@@ -0,0 +1,8 @@
if [ -s ~/.bashrc ]; then
source ~/.bashrc;
fi
eval "$(rbenv init -)"
export PATH="/usr/local/sbin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"

61
bash/.bashrc Normal file
View File

@@ -0,0 +1,61 @@
[ -f /etc/bashrc ] && . /etc/bashrc
[ -f ~/.z.sh ] && . ~/.z.sh
[ -f /etc/bash_completion ] && . /etc/bash_completion
# Don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth
shopt -s histappend
shopt -s checkwinsize
shopt -s no_empty_cmd_completion
shopt -s cdspell
shopt -s checkhash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:/usr/local/lib
export EDITOR=nvim
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Creds
export HOMEBREW_GITHUB_API_TOKEN="2a4fad8fb1b5ff1de5fdf043aeea7d6cf0c5b101"
alias ls='ls -G'
alias ll='ls -l'
alias vi='vim'
alias cat='bat --style changes'
alias grep='rg'
alias be='bundle exec'
alias vim='nvim'
alias ..='cd ..'
alias ...='cd ../..'
# Homebrew stuff
if [ -x /usr/local/bin/brew ]; then
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export MANPATH=/usr/local/share/man:$MANPATH
# bash_completion if installed
if [ -f `brew --prefix`/etc/bash_completion.d ]; then
. `brew --prefix`/etc/bash_completion.d
fi
fi
__git_ps1() { :;}
if [ -e ~/.git-prompt.sh ]; then
source ~/.git-prompt.sh
fi
PS1='\[\e[34m\]\u\[\e[1;32m\]@\[\e[0;33m\]\h\[\e[35m\]:\[\e[m\]\w\[\e[1;34m\]$(__git_ps1)\[\e[1;31m\]> \[\e[0m\]'
# fzf experiments
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_ALT_C_COMMAND='fd --type d --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND='fd --type f --type d --hidden --follow --exclude .git'
[ -n "$NVIM_LISTEN_ADDRESS" ] && export FZF_DEFAULT_OPTS='--no-height'
if [ -x ~/.vim/plugged/fzf.vim/bin/preview.rb ]; then
export FZF_CTRL_T_OPTS="--preview '~/.vim/plugged/fzf.vim/bin/preview.rb {} | head -200'"
fi
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview' --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' --header 'Press CTRL-Y to copy command into clipboard' --border"

535
git/.git-prompt.sh Normal file
View File

@@ -0,0 +1,535 @@
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
# 2) Add the following line to your .bashrc/.zshrc:
# source ~/.git-prompt.sh
# 3a) Change your PS1 to call __git_ps1 as
# command-substitution:
# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
# ZSH: setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
# the optional argument will be used as format string.
# 3b) Alternatively, for a slightly faster prompt, __git_ps1 can
# be used for PROMPT_COMMAND in Bash or for precmd() in Zsh
# with two parameters, <pre> and <post>, which are strings
# you would put in $PS1 before and after the status string
# generated by the git-prompt machinery. e.g.
# Bash: PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
# will show username, at-sign, host, colon, cwd, then
# various status string, followed by dollar and SP, as
# your prompt.
# ZSH: precmd () { __git_ps1 "%n" ":%~$ " "|%s" }
# will show username, pipe, then various status string,
# followed by colon, cwd, dollar and SP, as your prompt.
# Optionally, you can supply a third argument with a printf
# format string to finetune the output of the branch status
#
# The repository status will be displayed only if you are currently in a
# git repository. The %s token is the placeholder for the shown status.
#
# The prompt status always includes the current branch name.
#
# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
# unstaged (*) and staged (+) changes will be shown next to the branch
# name. You can configure this per-repository with the
# bash.showDirtyState variable, which defaults to true once
# GIT_PS1_SHOWDIRTYSTATE is enabled.
#
# You can also see if currently something is stashed, by setting
# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
# then a '$' will be shown next to the branch name.
#
# If you would like to see if there're untracked files, then you can set
# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
# files, then a '%' will be shown next to the branch name. You can
# configure this per-repository with the bash.showUntrackedFiles
# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
# enabled.
#
# If you would like to see the difference between HEAD and its upstream,
# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">"
# indicates you are ahead, "<>" indicates you have diverged and "="
# indicates that there is no difference. You can further control
# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list
# of values:
#
# verbose show number of commits ahead/behind (+/-) upstream
# name if verbose, then also show the upstream abbrev name
# legacy don't use the '--count' option available in recent
# versions of git-rev-list
# git always compare HEAD to @{upstream}
# svn always compare HEAD to your SVN upstream
#
# You can change the separator between the branch name and the above
# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator
# is SP.
#
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
# find one, or @{upstream} otherwise. Once you have set
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
# setting the bash.showUpstream config variable.
#
# If you would like to see more information about the identity of
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
# to one of these values:
#
# contains relative to newer annotated tag (v1.6.3.2~35)
# branch relative to newer tag or branch (master~4)
# describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
# tag relative to any older tag (v1.6.3.1-13-gdd42c2f)
# default exactly matching tag
#
# If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
# the colored output of "git status -sb" and are available only when
# using __git_ps1 for PROMPT_COMMAND or precmd.
#
# If you would like __git_ps1 to do nothing in the case when the current
# directory is set up to be ignored by git, then set
# GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the
# repository level by setting bash.hideIfPwdIgnored to "false".
# check whether printf supports -v
__git_printf_supports_v=
printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1
# stores the divergence from upstream in $p
# used by GIT_PS1_SHOWUPSTREAM
__git_ps1_show_upstream ()
{
local key value
local svn_remote svn_url_pattern count n
local upstream=git legacy="" verbose="" name=""
svn_remote=()
# get some config options from git-config
local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
while read -r key value; do
case "$key" in
bash.showupstream)
GIT_PS1_SHOWUPSTREAM="$value"
if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
p=""
return
fi
;;
svn-remote.*.url)
svn_remote[$((${#svn_remote[@]} + 1))]="$value"
svn_url_pattern="$svn_url_pattern\\|$value"
upstream=svn+git # default upstream is SVN if available, else git
;;
esac
done <<< "$output"
# parse configuration values
for option in ${GIT_PS1_SHOWUPSTREAM}; do
case "$option" in
git|svn) upstream="$option" ;;
verbose) verbose=1 ;;
legacy) legacy=1 ;;
name) name=1 ;;
esac
done
# Find our upstream
case "$upstream" in
git) upstream="@{upstream}" ;;
svn*)
# get the upstream from the "git-svn-id: ..." in a commit message
# (git-svn uses essentially the same procedure internally)
local -a svn_upstream
svn_upstream=($(git log --first-parent -1 \
--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
if [[ 0 -ne ${#svn_upstream[@]} ]]; then
svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}
svn_upstream=${svn_upstream%@*}
local n_stop="${#svn_remote[@]}"
for ((n=1; n <= n_stop; n++)); do
svn_upstream=${svn_upstream#${svn_remote[$n]}}
done
if [[ -z "$svn_upstream" ]]; then
# default branch name for checkouts with no layout:
upstream=${GIT_SVN_ID:-git-svn}
else
upstream=${svn_upstream#/}
fi
elif [[ "svn+git" = "$upstream" ]]; then
upstream="@{upstream}"
fi
;;
esac
# Find how many commits we are ahead/behind our upstream
if [[ -z "$legacy" ]]; then
count="$(git rev-list --count --left-right \
"$upstream"...HEAD 2>/dev/null)"
else
# produce equivalent output to --count for older versions of git
local commits
if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"
then
local commit behind=0 ahead=0
for commit in $commits
do
case "$commit" in
"<"*) ((behind++)) ;;
*) ((ahead++)) ;;
esac
done
count="$behind $ahead"
else
count=""
fi
fi
# calculate the result
if [[ -z "$verbose" ]]; then
case "$count" in
"") # no upstream
p="" ;;
"0 0") # equal to upstream
p="=" ;;
"0 "*) # ahead of upstream
p=">" ;;
*" 0") # behind upstream
p="<" ;;
*) # diverged from upstream
p="<>" ;;
esac
else
case "$count" in
"") # no upstream
p="" ;;
"0 0") # equal to upstream
p=" u=" ;;
"0 "*) # ahead of upstream
p=" u+${count#0 }" ;;
*" 0") # behind upstream
p=" u-${count% 0}" ;;
*) # diverged from upstream
p=" u+${count#* }-${count% *}" ;;
esac
if [[ -n "$count" && -n "$name" ]]; then
__git_ps1_upstream_name=$(git rev-parse \
--abbrev-ref "$upstream" 2>/dev/null)
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
p="$p \${__git_ps1_upstream_name}"
else
p="$p ${__git_ps1_upstream_name}"
# not needed anymore; keep user's
# environment clean
unset __git_ps1_upstream_name
fi
fi
fi
}
# Helper function that is meant to be called from __git_ps1. It
# injects color codes into the appropriate gitstring variables used
# to build a gitstring.
__git_ps1_colorize_gitstring ()
{
if [[ -n ${ZSH_VERSION-} ]]; then
local c_red='%F{red}'
local c_green='%F{green}'
local c_lblue='%F{blue}'
local c_clear='%f'
else
# Using \[ and \] around colors is necessary to prevent
# issues with command line editing/browsing/completion!
local c_red='\[\e[31m\]'
local c_green='\[\e[32m\]'
local c_lblue='\[\e[1;34m\]'
local c_clear='\[\e[0m\]'
fi
local bad_color=$c_red
local ok_color=$c_green
local flags_color="$c_lblue"
local branch_color=""
if [ $detached = no ]; then
branch_color="$ok_color"
else
branch_color="$bad_color"
fi
c="$branch_color$c"
z="$c_clear$z"
if [ "$w" = "*" ]; then
w="$bad_color$w"
fi
if [ -n "$i" ]; then
i="$ok_color$i"
fi
if [ -n "$s" ]; then
s="$flags_color$s"
fi
if [ -n "$u" ]; then
u="$bad_color$u"
fi
r="$c_clear$r"
}
# Helper function to read the first line of a file into a variable.
# __git_eread requires 2 arguments, the file path and the name of the
# variable, in that order.
__git_eread ()
{
test -r "$1" && IFS=$'\r\n' read "$2" <"$1"
}
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
# when called from PS1 using command substitution
# in this mode it prints text to add to bash PS1 prompt (includes branch name)
#
# __git_ps1 requires 2 or 3 arguments when called from PROMPT_COMMAND (pc)
# in that case it _sets_ PS1. The arguments are parts of a PS1 string.
# when two arguments are given, the first is prepended and the second appended
# to the state string when assigned to PS1.
# The optional third parameter will be used as printf format string to further
# customize the output of the git-status string.
# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
__git_ps1 ()
{
# preserve exit status
local exit=$?
local pcmode=no
local detached=no
local ps1pc_start='\u@\h:\w '
local ps1pc_end='\$ '
local printf_format=' (%s)'
case "$#" in
2|3) pcmode=yes
ps1pc_start="$1"
ps1pc_end="$2"
printf_format="${3:-$printf_format}"
# set PS1 to a plain prompt so that we can
# simply return early if the prompt should not
# be decorated
PS1="$ps1pc_start$ps1pc_end"
;;
0|1) printf_format="${1:-$printf_format}"
;;
*) return $exit
;;
esac
# ps1_expanded: This variable is set to 'yes' if the shell
# subjects the value of PS1 to parameter expansion:
#
# * bash does unless the promptvars option is disabled
# * zsh does not unless the PROMPT_SUBST option is set
# * POSIX shells always do
#
# If the shell would expand the contents of PS1 when drawing
# the prompt, a raw ref name must not be included in PS1.
# This protects the user from arbitrary code execution via
# specially crafted ref names. For example, a ref named
# 'refs/heads/$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' might cause the
# shell to execute 'sudo rm -rf /' when the prompt is drawn.
#
# Instead, the ref name should be placed in a separate global
# variable (in the __git_ps1_* namespace to avoid colliding
# with the user's environment) and that variable should be
# referenced from PS1. For example:
#
# __git_ps1_foo=$(do_something_to_get_ref_name)
# PS1="...stuff...\${__git_ps1_foo}...stuff..."
#
# If the shell does not expand the contents of PS1, the raw
# ref name must be included in PS1.
#
# The value of this variable is only relevant when in pcmode.
#
# Assume that the shell follows the POSIX specification and
# expands PS1 unless determined otherwise. (This is more
# likely to be correct if the user has a non-bash, non-zsh
# shell and safer than the alternative if the assumption is
# incorrect.)
#
local ps1_expanded=yes
[ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
[ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no
local repo_info rev_parse_exit_code
repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
--is-bare-repository --is-inside-work-tree \
--short HEAD 2>/dev/null)"
rev_parse_exit_code="$?"
if [ -z "$repo_info" ]; then
return $exit
fi
local short_sha=""
if [ "$rev_parse_exit_code" = "0" ]; then
short_sha="${repo_info##*$'\n'}"
repo_info="${repo_info%$'\n'*}"
fi
local inside_worktree="${repo_info##*$'\n'}"
repo_info="${repo_info%$'\n'*}"
local bare_repo="${repo_info##*$'\n'}"
repo_info="${repo_info%$'\n'*}"
local inside_gitdir="${repo_info##*$'\n'}"
local g="${repo_info%$'\n'*}"
if [ "true" = "$inside_worktree" ] &&
[ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] &&
[ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] &&
git check-ignore -q .
then
return $exit
fi
local r=""
local b=""
local step=""
local total=""
if [ -d "$g/rebase-merge" ]; then
__git_eread "$g/rebase-merge/head-name" b
__git_eread "$g/rebase-merge/msgnum" step
__git_eread "$g/rebase-merge/end" total
if [ -f "$g/rebase-merge/interactive" ]; then
r="|REBASE-i"
else
r="|REBASE-m"
fi
else
if [ -d "$g/rebase-apply" ]; then
__git_eread "$g/rebase-apply/next" step
__git_eread "$g/rebase-apply/last" total
if [ -f "$g/rebase-apply/rebasing" ]; then
__git_eread "$g/rebase-apply/head-name" b
r="|REBASE"
elif [ -f "$g/rebase-apply/applying" ]; then
r="|AM"
else
r="|AM/REBASE"
fi
elif [ -f "$g/MERGE_HEAD" ]; then
r="|MERGING"
elif [ -f "$g/CHERRY_PICK_HEAD" ]; then
r="|CHERRY-PICKING"
elif [ -f "$g/REVERT_HEAD" ]; then
r="|REVERTING"
elif [ -f "$g/BISECT_LOG" ]; then
r="|BISECTING"
fi
if [ -n "$b" ]; then
:
elif [ -h "$g/HEAD" ]; then
# symlink symbolic ref
b="$(git symbolic-ref HEAD 2>/dev/null)"
else
local head=""
if ! __git_eread "$g/HEAD" head; then
return $exit
fi
# is it a symbolic ref?
b="${head#ref: }"
if [ "$head" = "$b" ]; then
detached=yes
b="$(
case "${GIT_PS1_DESCRIBE_STYLE-}" in
(contains)
git describe --contains HEAD ;;
(branch)
git describe --contains --all HEAD ;;
(tag)
git describe --tags HEAD ;;
(describe)
git describe HEAD ;;
(* | default)
git describe --tags --exact-match HEAD ;;
esac 2>/dev/null)" ||
b="$short_sha..."
b="($b)"
fi
fi
fi
if [ -n "$step" ] && [ -n "$total" ]; then
r="$r $step/$total"
fi
local w=""
local i=""
local s=""
local u=""
local c=""
local p=""
if [ "true" = "$inside_gitdir" ]; then
if [ "true" = "$bare_repo" ]; then
c="BARE:"
else
b="GIT_DIR!"
fi
elif [ "true" = "$inside_worktree" ]; then
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
[ "$(git config --bool bash.showDirtyState)" != "false" ]
then
git diff --no-ext-diff --quiet || w="*"
git diff --no-ext-diff --cached --quiet || i="+"
if [ -z "$short_sha" ] && [ -z "$i" ]; then
i="#"
fi
fi
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
git rev-parse --verify --quiet refs/stash >/dev/null
then
s="$"
fi
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null
then
u="%${ZSH_VERSION+%}"
fi
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
__git_ps1_show_upstream
fi
fi
local z="${GIT_PS1_STATESEPARATOR-" "}"
# NO color option unless in PROMPT_COMMAND mode
if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
__git_ps1_colorize_gitstring
fi
b=${b##refs/heads/}
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
__git_ps1_branch_name=$b
b="\${__git_ps1_branch_name}"
fi
local f="$w$i$s$u"
local gitstring="$c$b${f:+$z$f}$r$p"
if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then
gitstring=$(printf -- "$printf_format" "$gitstring")
else
printf -v gitstring -- "$printf_format" "$gitstring"
fi
PS1="$ps1pc_start$gitstring$ps1pc_end"
else
printf -- "$printf_format" "$gitstring"
fi
return $exit
}

1
ruby/.gemrc Normal file
View File

@@ -0,0 +1 @@
gem: --no-rdoc --no-ri

22
sync.sh Executable file
View File

@@ -0,0 +1,22 @@
# xcode-select --install
if ! [ -x "$(command -v brew)" ]; then
echo "==> Found brew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "==> Brew already installed"
fi
echo "==> Brew bundle"
brew bundle
if [ -f ~/.local/share/nvim/site/autoload/plug.vim ]; then
echo "==> Found vim-plug"
else
echo "==> Installing vim-plug"
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
echo "==> Symlinking dotfiles"
for dir in $(ls -d */); do stow -Rv ${dir}; done

89
tmux/.tmux.conf Normal file
View File

@@ -0,0 +1,89 @@
# NOTE: First of all install TPM
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
unbind-key C-b
set -g prefix C-a
set-clipboard on
set-option -g default-command "reattach-to-user-namespace -l bash"
# Set the base index for windows to 1 instead of 0.
set -g base-index 1
# Set the base index for panes to 1 instead of 0.
setw -g pane-base-index 1
# Vi-mode
set -g mode-keys vi
# Enable activity alerts.
set -g visual-activity off
# Renumber windows when a window is closed
set -g renumber-windows on
# => Theme
set -g status-bg black
set -g status-fg white
set -g window-status-current-bg white
set -g window-status-current-fg black
set -g window-status-current-attr bold
# Default window title colors
setw -g window-status-fg colour244 #base0
setw -g window-status-bg default
# Active window title colors
setw -g window-status-current-fg colour166 #orange
setw -g window-status-current-bg default
# Message text
set -g message-bg colour235 #base02
set -g message-fg colour166 #orange
set -g window-status-format " #W "
set -g window-status-current-format " #W "
set -g status-left ''
set -g status-right ''
set -g status-justify centre
# => Bindings
# Kill pane without confirmation
bind-key x kill-pane
bind-key \ split-window -h
bind-key - split-window -v
# Painless copying with tmux-yank
unbind [
bind Escape copy-mode
setw -g mode-keys vi
unbind-key -T copy-mode-vi v
bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode.
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode.
bind-key -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode.
bind-key -t copy-mode-vi 'K' halfpage-up
bind-key -t copy-mode-vi 'J' halfpage-down
# => Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Depends on 'urlview'
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-open'
# Default keysbindings for panes
set -g @plugin 'tmux-plugins/tmux-pain-control'
# If run as "tmux attach", create a session if one does not already exist
new-session -A -s main
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

View File

@@ -0,0 +1 @@
source ../../.vimrc

643
vim/.vimrc Normal file
View File

@@ -0,0 +1,643 @@
" Author: Konstantin Bukley <madundead@gmail.com>
" License: WTFPL
" Description: Personal vim configuration
" ========================================================
" -> General
" ========================================================
" Turn off vi-compatible mode
set nocompatible
" Encoding
set encoding=utf-8
set fileencoding=utf-8
" Quantity of comand line entries vim have to remember
set history=500
" Remap the <leader> to ,
let mapleader=","
let g:mapleader=","
" Includes ftplugin.vim which is responsible for filetype detection
filetype plugin indent on
" Set syntax highlighting
syntax on
" ========================================================
" -> Plugins
" ========================================================
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall
endif
call plug#begin('~/.vim/plugged')
" ======== Languages / Textobjects =======================
Plug 'sheerun/vim-polyglot'
Plug 'mxw/vim-jsx'
Plug 'jtratner/vim-flavored-markdown', { 'for': 'markdown' }
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-datetime'
Plug 'kana/vim-textobj-entire'
Plug 'kana/vim-textobj-function'
Plug 'nelstrom/vim-textobj-rubyblock'
Plug 'austintaylor/vim-indentobject'
Plug 'lucapette/vim-textobj-underscore'
Plug 'bootleq/vim-textobj-rubysymbol'
" ======== Utility ======================================
Plug 'mattn/emmet-vim',
Plug 'mileszs/ack.vim'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'gregsexton/gitv', { 'on': 'Gitv' }
Plug 'junegunn/vim-easy-align', { 'on': ['<Plug>(EasyAlign)', 'EasyAlign'] }
Plug 'gregsexton/MatchTag', { 'for': 'html' }
Plug 'ctrlpvim/ctrlp.vim'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'mattn/gist-vim' | Plug 'mattn/webapi-vim'
Plug 'Raimondi/delimitMate'
Plug 'nelstrom/vim-visual-star-search'
Plug 'benmills/vimux'
Plug 'skalnik/vim-vroom'
Plug 'dyng/ctrlsf.vim'
Plug 'terryma/vim-expand-region'
Plug 'terryma/vim-multiple-cursors'
Plug 'bogado/file-line'
" ======== Snippets & Autocomplete ======================
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" ======== Appearence ===================================
Plug 'altercation/vim-colors-solarized'
Plug 'itchyny/lightline.vim'
Plug 'airblade/vim-gitgutter'
Plug 'mhinz/vim-startify'
" ======== tpope <3 ====================================
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails', { 'for': 'ruby' }
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-git'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
" ========= Some of my stuff ===========================
" Bunch of helper functions extracted in their own plugin
" Plug 'madundead/vim-madundead'
Plug '~/Development/vim-madundead'
" ======== Experimental =================================
Plug 'vim-utils/vim-interruptless' " prevents [O]K, [L]oad interuption
Plug 'ngmy/vim-rubocop'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/fzf.vim'
Plug 'neomake/neomake'
Plug 'slashmili/alchemist.vim'
Plug 'dylanaraps/crayon'
Plug 'machakann/vim-highlightedyank'
Plug 'rhysd/clever-f.vim'
Plug 'majutsushi/tagbar'
Plug 'darfink/vim-plist'
call plug#end()
" ========================================================
" -> Plugin settings
" ========================================================
" Enable matchit.vim
runtime macros/matchit.vim
" --- Netrw
let g:netrw_banner = 0
let g:netrw_list_hide = '^\.$'
let g:netrw_liststyle = 4
" --- NERDTree
let NERDTreeWinPos = "right"
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let NERDTreeAutoDeleteBuffer = 1
let NERDTreeHijackNetrw = 1
" --- CtrlP
let g:ctrlp_max_height = 10
let g:ctrlp_show_hidden = 0
let g:ctrlp_follow_symlinks = 1
let g:ctrlp_max_files = 20000
let g:ctrlp_reuse_window = 'startify'
let g:ctrlp_extensions = ['funky']
let g:ctrlp_user_command = 'rg --files %s'
let g:ctrlp_status_func =
\ {
\ 'main': 'madundead#ctrlp_main_status',
\ 'prog': 'madundead#ctrlp_prog_status',
\ }
let g:ctrlp_custom_ignore =
\ {
\ 'dir': '\v[\/]\.(git|hg|svn|idea)$',
\ 'file': '\v\.DS_Store$'
\ }
" --- Ultisnips
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
" --- CtrlSF
let g:ctrlsf_ackprg = 'rg'
let g:ctrlsf_regex_pattern = 1
let g:ctrlsf_case_sensitive = 'smart'
let g:ctrlsf_default_root = 'project'
let g:ctrlsf_context = '-B 1 -A 1'
let g:ctrlsf_position = 'bottom'
let g:ctrlsf_winsize = '40%'
let g:ctrlsf_mapping =
\ {
\ 'next': 'n',
\ 'prev': 'N',
\ }
" --- gist-vim
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
let g:gist_post_private = 1
let g:gist_show_privates = 1
" --- vimux
let g:vroom_use_vimux = 1
" --- vim-startify
let g:startify_relative_path = 0
let g:startify_files_number = 5
let g:startify_session_persistence = 1
let g:startify_session_autoload = 1
let g:startify_session_delete_buffers = 1
let g:startify_enable_special = 1
let g:startify_change_to_vcs_root = 1
let g:startify_show_sessions = 1
let g:startify_list_order =
\ [
\ [ ' > Recent: ' ],
\ 'dir',
\ [ ' > Bookmarks: ' ],
\ 'bookmarks'
\ ]
let g:startify_skiplist =
\ [
\ 'COMMIT_EDITMSG',
\ $VIMRUNTIME .'/doc',
\ 'bundle/.*/doc',
\ '\.vimgolf',
\ ]
let g:startify_custom_indices = [ '1', '2', '3', '4', '5', 'h', 'd', 'E', 'z' ]
let g:startify_bookmarks = [ '~/', '~/Development', '~/.vimrc', '~/.zshrc' ]
let g:startify_custom_footer = [ '', ' All work and no play makes Jack a dull boy', '' ]
let g:startify_custom_header = []
" --- lightline
"
" NOTE: Proper status line marks require madundead/vim-madundead
"
let g:lightline =
\ {
\ 'enable': { 'tabline': 0 },
\ 'colorscheme': 'solarized',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ],
\ 'right': [],
\ },
\ 'inactive': {
\ 'right': [],
\ },
\ 'component_function': {
\ 'fugitive': 'madundead#lightline_fugitive',
\ 'filename': 'madundead#lightline_file_name',
\ 'fileformat': 'madundead#lightline_file_format',
\ 'filetype': 'madundead#lightline_file_type',
\ 'fileencoding': 'madundead#lightline_file_encoding',
\ 'mode': 'madundead#lightline_mode',
\ 'ctrlpmark': 'madundead#lightline_ctrlp',
\ },
\ }
let g:lightline.mode_map =
\ {
\ 'n' : ' N ',
\ 'i' : ' I ',
\ 'R' : ' R ',
\ 'v' : ' V ',
\ 'V' : ' V ',
\ 'c' : ' N ',
\ "\<C-v>": ' V ',
\ 's' : 'S',
\ 'S' : 'S',
\ "\<C-s>": 'S',
\ '?': ' '
\ }
" ========================================================
" -> Colors & Fonts
" ========================================================
" solarized is love solarized is life
colorscheme solarized
set background=dark
" set guifont=Source\ Code\ Pro:h16
if has('gui_running')
set guifont=Menlo:h14
set guioptions-=T " remove toolbar
set guioptions-=m " remove menubar
set guioptions+=LlRrb " remove
set guioptions-=LlRrb " scrollbars
set t_Co=256
else
" Disable Background Color Erase (BCE) so that color schemes
" work properly when Vim is used inside tmux and GNU screen.
" See also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
set t_Co=16
endif
" ========================================================
" -> User Interface
" ========================================================
" enables menu at the bottom
set wildmenu
" highlight search
set hlsearch
" nicer separators
set fillchars=diff:⣿,vert:│
" don't try to highlight lines longer than 800 characters.
set synmaxcol=200
" when a file has been detected to have been changed outside of Vim and
" it has not been changed inside of Vim, automatically read it again.
set autoread
" do not redraw while running macros
set lazyredraw
" tab label - requires vim-madundead
set tabline=%!madundead#tabline()
" show status even for single buffer displayed
set laststatus=2
" highlight current line
set cursorline
" number rows
set number
" disable welcome message
set shortmess+=I
" show matching braces
set showmatch
" shows when you are in insert mode
set showmode
" shows commands in right bottom corner
set showcmd
" show cursor position all the tiem
set ruler
" show title in console status bar
set title
" dont wrap lines
set nowrap
" when I scroll up or down, there are 2 lines between the line I'm on and the bottom or top of the screen.
set scrolloff=5
" how many tenths of a second to blink on matching brackets
set mat=2
" disable cursor blink
set gcr=a:blinkon0
" hide the mouse pointer while typing
set mousehide
" vim requires a POSIX-compliant shell. fish isn't
if $SHELL =~ 'bin/fish'
set shell=/bin/sh
endif
" ========================================================
" -> Behavior & Different Tricks
" ========================================================
" Shamelessly taken from YADR dotfile repo https://github.com/skwp/dotfiles
" Stuff to ignore whent tab completing
set wildignore=*.o,*.obj,*~
set wildignore+=*vim/backups*
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=vendor/rails/**
set wildignore+=vendor/cache/**
set wildignore+=*.gem
set wildignore+=log/**
set wildignore+=tmp/**
set wildignore+=*.png,*.jpg,*.gif
" Russian keymap support
set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯЖ;ABCDEFGHIJKLMNOPQRSTUVWXYZ:,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz
" W invokes sudo
command! W w !sudo tee % > /dev/null
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
" Dunno
set matchtime=2
" Force backspace to behave like in any other editor
set backspace=2
" Start searching as soon as you type first letter
set incsearch
" Turn off visualbell
set novisualbell
" Fuck backups
set nobackup
set nowb
set noswapfile
" Doesn't select lines number in vim
set mouse=a
" Facny whitespace characters
set list listchars=tab:→\ ,trail
" Abbrev. of messages (avoids 'hit enter')
set shortmess+=filmnrxoOtT
" Start scrolling when we're 8 lines away from margins
set scrolloff=8
" The minimal number of screen columns to keep to the left and to the
" right of the cursor if 'nowrap' is set.
set sidescrolloff=15
" The minimal number of columns to scroll horizontally
set sidescroll=1
" Vertical splits in diff mode
set diffopt+=vertical
" Reduce delay between modes
set timeoutlen=1000 ttimeoutlen=0
" ========================================================
" -> Indentations
" ========================================================
" Automatically inserts one extra level of indentation in some cases
set smartindent
" Affects how <TAB> key presses are interpreted depending on where the cursor is
set smarttab
" Tab counts as 2 columns
set tabstop=2
" Numbers of spaces to (auto)indent
set shiftwidth=2
" Spaces
set expandtab
" Don't write end of file
" set noeol
" ========================================================
" -> Filetype Dependent Settings
" ========================================================
if has("autocmd")
au filetype help nnoremap <buffer><CR> <c-]>
au filetype help nnoremap <buffer><BS> <c-T>
au filetype help set nonumber
au BufNewFile,BufRead Capfile,Gemfile,Vagrantfile setl ft=ruby
au BufNewFile,BufRead *.rabl,*.jbuilder setl ft=ruby
au BufNewFile,BufRead *.phtml setl ft=html
au BufNewFile,BufRead *.md,*.markdown setl ft=ghmarkdown
" Only show cursorline in the current window and in normal mode.
augroup cline
au!
au WinLeave,InsertEnter * set nocursorline
au WinEnter,InsertLeave * set cursorline
augroup END
" Close tab if only NERDTree left
au WinEnter * call madundead#nerdtree_close_hack()
" Apply solarized tweak
au VimEnter * call madundead#tweak_solarized()
" Neomake
au BufWritePost * Neomake
" Prevent CtrlP or NERDTree from opening a split in Startify
au User Startified setl buftype=
endif
" ========================================================
" -> Hotkeys & Bindings
" ========================================================
" Remap ; to :
nnoremap ; :
" Close buffer by Q
nnoremap <silent> Q :q!<CR>
" Move between splits (not very nice)
nmap <silent> <Up> :wincmd k<CR>
nmap <silent> <Down> :wincmd j<CR>
nmap <silent> <Left> :wincmd h<CR>
nmap <silent> <Right> :wincmd l<CR>
" Move between splits (better backup option)
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Bash like keys for the vim command line
cnoremap <C-A> <Home>
cnoremap <C-E> <End>
" ,<space> -> clears search highlight
nmap <silent><leader><space> :nohlsearch<cr>
" ,, -> toggle between last open buffers
nmap <leader><leader> <c-^>
" ,w -> strip trailing whitespace
nmap <silent><leader>w :call madundead#strip_trailing_whitespace()<CR>
" ,n -> NERDTree
nmap <silent><leader>n :NERDTreeToggle<CR>
" ,c -> next conflict marker
nmap <silent><leader>c <ESC>/\v^[<=>]{7}( .*\|$)<CR>
" ,b -> Gblame
nmap <leader>b :Gblame<CR>
" ,t -> opens new tab
nmap <leader>t :tabnew<CR>
" ,f -> prompts for search
nmap <leader>f :CtrlSF
" ,g -> Gitv
nmap <leader>g :Gitv <CR>
" ,d -> binding fucking pry
nmap <leader>d orequire 'pry'; binding.pry<ESC>
" ,p -> current buffer file path
nmap <leader>p :echo @%<CR>
" ,s -> reload vimrc
nmap <silent><leader>s :so ~/.vimrc<CR>
\ :call madundead#tweak_solarized()<CR>
" ,rh -> hashrocket to :
nmap <leader>rh :%s/\v:(\w+) \=\>/\1:/g<cr>
" Switching between tabs
nmap <silent><Tab> :tabnext<CR>
nmap <silent><S-Tab> :tabprevious<CR>
" n/N centers screen on the entry
nmap N Nzz
nmap n nzz
" Move faster
nnoremap <C-j> <C-d>
nnoremap <C-k> <C-u>
" Even in VISUAL mode
vnoremap <C-j> <C-d>
vnoremap <C-k> <C-u>
" Move properly when line wrapping is on
nnoremap j gj
nnoremap k gk
" Visual mode indentations
vnoremap < <gv
vnoremap > >gv
" Make Y/yy consistent with D/dd and C/cc
nnoremap yy Y
nnoremap Y y$
" vv/ss for splits
nnoremap <silent>vv <c-w>v
" nnoremap <silent>ss <c-w>s
" Highlight VCS conflict markers
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
" Start interactive EasyAlign in visual mode
vmap <Enter> <Plug>(EasyAlign)
" Ctrl + e for emmet
imap <C-e> <C-y>, <CR>
" Allow the . to execute once for each line of a visual selection
vnoremap . :normal .<CR>
nnoremap H ^
nnoremap L $
nnoremap K <nop>
" Move visual block
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
" Keep the cursor in place while joining lines
nnoremap J mzJ`z
" TODO: Space should be used for something more useful
" Folding on <Space>
" NOTE: Keep this for future reference
" My attempt at git 2-way merging
" map <silent> <space>l :diffget //2<CR>:diffupdate<CR>
" map <silent> <space>h :diffget //3<CR>:diffupdate<CR>
" nnoremap <space>j ]cw
" nnoremap <space>k [cw
" map <silent> <space><w> :only<CR>:w<CR>
" REMINDERS:
" m -- ruby method motion (e.g. cim)
" i -- indentation motion (e.g. dai)
" gx -- opens url in browser
" ctrl + e -- emmet
" ctrl + n -- vim-multiple-cursor
" EXPERIMENTAL:
" Toggle wrap
nnoremap <leader>W :set wrap!<cr>
" Keep old vim-commentary hotkeys
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
nmap \\\ <Plug>CommentaryLine
nmap \\u <Plug>CommentaryUndo
" git
noremap <Leader>ga :Gwrite<CR>
noremap <Leader>gc :Gcommit<CR>
noremap <Leader>gsh :Gpush<CR>
noremap <Leader>gll :Gpull<CR>
noremap <Leader>gs :Gstatus<CR>
noremap <Leader>gb :Gblame<CR>
noremap <Leader>gd :Gvdiff<CR>
noremap <Leader>gr :Gremove<CR>
map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
map y <Plug>(highlightedyank)
let g:highlightedyank_highlight_duration = 400
" Delete comment character when joining commented lines
if v:version > 703 || v:version == 703 && has("patch541")
set formatoptions+=j
endif
map <Space> <Plug>Sneak_;
map <leader><Space> <Plug>Sneak_,
au FileType markdown vmap <Leader><Bslash> :EasyAlign*<Bar><Enter>