Last active
February 28, 2017 21:59
-
-
Save noahhendrix/3001799 to your computer and use it in GitHub Desktop.
dotfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log | |
tags | |
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ================ | |
# Behavior | |
# ================ | |
# Use VIM and VIM keybindings in bash | |
export EDITOR=vim | |
set -o vi | |
# Smart tab-completion | |
bind 'set completion-ignore-case on' | |
# Add autocompletion for other programs like git. | |
# Requires `brew install bash-completion` | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
# Allow for multiple rubies on the same system. | |
# Requires `brew install rbenv` | |
export RBENV_ROOT="${HOME}/.rbenv" | |
if [ -d "${RBENV_ROOT}" ]; then | |
export PATH="${RBENV_ROOT}/bin:${PATH}" | |
eval "$(rbenv init -)" | |
fi | |
# ================ | |
# Prompt | |
# ================ | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
LIGHT_GRAY="\[\033[0;37m\]" | |
COLOR_NONE="\[\e[0m\]" | |
# Show the git branch name and use color for status (red=dirty, green=clean, | |
# yellow=staged) IF you’re in a git repo. | |
function set_bash_prompt () { | |
# Set the PROMPT_SYMBOL variable. We do this first so we don't lose the | |
# return value of the last command. | |
if test $? -eq 0 ; then | |
prompt_symbol="${GREEN}❯" | |
else | |
prompt_symbol="${RED}❯" | |
fi | |
# Capture the output of the `git status` command. | |
git_status="$(git status 2> /dev/null)" | |
if [[ ${git_status} ]]; then | |
# Set color based on clean/staged/dirty. | |
if [[ ${git_status} =~ "working directory clean" ]]; then | |
color=$GREEN | |
elif [[ ${git_status} =~ "Changes to be committed" ]]; then | |
color=$YELLOW | |
else | |
color=$RED | |
fi | |
# Get the name of the branch. | |
branch_pattern="^On branch ([^${IFS}]*)" | |
if [[ ${git_status} =~ ${branch_pattern} ]]; then | |
branch="${color}${BASH_REMATCH[1]}" | |
fi | |
else | |
branch="" | |
fi | |
# Set the bash prompt variable. | |
PS1="${LIGHT_GRAY}\W ${branch} ${prompt_symbol} ${COLOR_NONE}" | |
} | |
# Tell bash to execute this function just before displaying its prompt. | |
PROMPT_COMMAND=set_bash_prompt | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem: --no-ri --no-rdoc | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Noah Hendrix | |
email = [email protected] | |
[mergetool] | |
keepBackup = true | |
[color] | |
ui = true | |
[core] | |
excludesfile = ~/.gitignore_global | |
editor = vim | |
[push] | |
default = current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Zero is really hard to reach | |
set-option -g base-index 1 | |
set-window-option -g pane-base-index 1 | |
# Remap prefix to C-a | |
set -g prefix C-a | |
unbind C-b | |
bind C-a send-prefix | |
# Configure status bar | |
set -g status on | |
set -g status-utf8 on | |
set -g status-right "" | |
# Enable 256-colors | |
set -g default-terminal "screen-256color" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved | |
" ================ | |
" Plugins | |
" ================ | |
" To Install | |
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
call plug#begin('~/.vim/plugged') | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
Plug 'pangloss/vim-javascript' | |
Plug 'mxw/vim-jsx' | |
Plug 'dockyard/vim-easydir' | |
Plug 'tpope/vim-vinegar' | |
Plug 'mbbill/undotree' | |
Plug 'tpope/vim-surround' | |
Plug 'Raimondi/delimitMate' | |
Plug 'tpope/vim-repeat' | |
Plug 'w0rp/ale' | |
call plug#end() | |
" ================ | |
" Theming | |
" ================ | |
colorscheme desert | |
" ================ | |
" File Handling | |
" ================ | |
set backupdir=~/.vim/backup/ | |
set directory=~/.vim/swap/ | |
set viminfo+=n~/.vim/viminfo | |
set encoding=utf-8 | |
set autoread " Auto-reload files when changed on disk | |
set splitbelow splitright " More natural splitting | |
set statusline=%f%m%=%r " FILENAME [RO] | |
set laststatus=2 " Always show statusline | |
function! RenameFile() | |
let old_name = expand('%') | |
let new_name = input('New file name: ', expand('%'), 'file') | |
if new_name != '' && new_name != old_name | |
exec ':saveas ' . new_name | |
exec ':silent !rm ' . old_name | |
redraw! | |
endif | |
endfunction | |
" ================ | |
" Code stuff | |
" ================ | |
syntax on | |
filetype plugin indent on | |
set expandtab shiftwidth=2 tabstop=2 softtabstop=2 | |
set backspace=indent,eol,start | |
" Fix for slow Ruby syntax highlighting: | |
" http://stackoverflow.com/questions/16902317 | |
set regexpengine=1 | |
" Color columns after 80 | |
let &colorcolumn=join(range(101, 999), ",") | |
highlight ColorColumn ctermbg=235 guibg=#2c2d27 | |
" Syntax Checking | |
let g:validator_javascript_checkers = ['npm run eslint'] | |
" ================ | |
" Line Behavior | |
" ================ | |
set nowrap | |
set relativenumber number | |
set timeout timeoutlen=1000 ttimeoutlen=100 " Fix slow O inserts | |
set list listchars=tab:»·,trail:· " Show trailing whitespace | |
autocmd BufWritePre * :%s/\s\+$//e " Remove trailing whitespace on save | |
" ================ | |
" Searching | |
" ================ | |
set ignorecase smartcase " Case-insensitive searching (unless capital letter) | |
set incsearch " Incremental searching | |
set hlsearch " Highlight results | |
" Tab-completion using longest common sub-string | |
set wildmenu wildmode=longest:full,list:full,list:longest wildchar=<TAB> | |
" The Silver Searcher | |
if executable('ag') | |
" Use ag over grep | |
set grepprg=ag\ --nogroup\ --nocolor | |
endif | |
" ================ | |
" Shortcuts | |
" ================ | |
let mapleader="," | |
map <Leader>q :cclose<CR> | |
map <Leader>v :vsp $MYVIMRC<CR> | |
" FZF.vim | |
nnoremap <c-p> :Files<cr> | |
nnoremap <c-b> :Buffers<cr> | |
command! W w | |
command! Q q | |
command! Vsp vsp | |
command! Grep grep | |
command! Cnf cnf | |
command! Cn cn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find $(dirname $0)/.* -maxdepth 0 -type f -exec ln -f -s {} \; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment