Skip to content

Instantly share code, notes, and snippets.

@taifen
Forked from prabirshrestha/.bash_profile
Created June 19, 2014 10:18
Show Gist options
  • Select an option

  • Save taifen/89c83a272d42864306f3 to your computer and use it in GitHub Desktop.

Select an option

Save taifen/89c83a272d42864306f3 to your computer and use it in GitHub Desktop.
Font=Powerline Consolas
ForegroundColour=131,148,150
BackgroundColour=0,43,54
CursorColour=220,50,47
Black=7,54,66
BoldBlack=0,43,54
Red=220,50,47
BoldRed=203,75,22
Green=133,153,0
BoldGreen=88,110,117
Yellow=181,137,0
BoldYellow=101,123,131
Blue=38,139,210
BoldBlue=131,148,150
Magenta=211,54,130
BoldMagenta=108,113,196
Cyan=42,161,152
BoldCyan=147,161,161
White=238,232,213
BoldWhite=253,246,227
Transparency=low
FontHeight=12
Scrollbar=none
# curl https://gist.github.com/prabirshrestha/279d8b179d9353fe8694/raw/.tmux.conf -o ~/.tmux.conf
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Change the prefix to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# enable pretty colors
set -g default-terminal "screen-256color"
# increase scroll-back history
set -g history-limit 5000
# use vim key bindings
setw -g mode-keys vi
# start window index at 1
set -g base-index 1
# start pane index at 1
set -g pane-base-index 1
# change the default delay to make it more responsive
set -sg escape-time 1
# Splitting panes
bind \ split-window -h
bind - split-window -v
# pane movements
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# pane resizing
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# window movement
bind -r C-h select-window -t:-
bind -r C-l select-window -t:+
# remapping copy paste to vim
# unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
# setw -g monitory-activity on
set -g visual-activity on
# Enable mouse support in ~/.tmux.conf
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-window-option -g mode-mouse on
# mouse can be used to resize panes (by dragging dividers)
set -g mouse-resize-pane on
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
#bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
set-option -g renumber-windows on
setw -g aggressive-resize on
# status bar
set -g status-interval 2
set -g status-left-length 52
set -g status-right-length 451
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
set -g message-attr bold
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 window-status-format "#[fg=white,bg=colour234] #I #W "
set -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour25,bg=colour39,noreverse,bold] #I  #W #[fg=colour39,bg=colour234,nobold]"
set -g status-right "#[fg=colour235,bg=colour252,bold] %d %b#[fg=colour238,bg=colour252,nobold]#[fg=colour245,bg=colour238,bold]%r"
" vim: set syntax=vim:
" must be first line
if has('vim_starting')
set nocompatible
" required
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" required
call neobundle#begin(expand('~/.vim/bundle/'))
" let NeoBundle manage Neobundle
" required:
NeoBundleFetch 'Shougo/neobundle.vim'
"NeoBundle 'kien/ctrlp.vim'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/vimproc.vim' " cd ~/.vim/bundle/vimproc.vim && make -f make_cygwin.mak
NeoBundle 'maxbrunsfeld/vim-yankstack'
NeoBundle 'Shougo/neomru.vim'
NeoBundle 'tsukkee/unite-help'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'tpope/vim-surround'
NeoBundle 'spf13/vim-autoclose'
NeoBundle 'terryma/vim-multiple-cursors'
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'jistr/vim-nerdtree-tabs'
NeoBundle 'mbbill/undotree'
NeoBundle 'nathanaelkane/vim-indent-guides'
NeoBundle 'mhinz/vim-signify'
NeoBundle 'reedes/vim-litecorrect'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'scrooloose/nerdcommenter'
NeoBundle 'godlygeek/tabular'
NeoBundle 'elzr/vim-json'
NeoBundle 'groenewege/vim-less'
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'briancollins/vim-jst'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'amirh/HTML-AutoCloseTag'
NeoBundle 'hail2u/vim-css3-syntax'
NeoBundle 'gorodinskiy/vim-coloresque'
NeoBundle 'tpope/vim-haml'
"NeoBundle 'fatih/vim-go'
NeoBundle 'tpope/vim-markdown'
NeoBundle 'spf13/vim-preview'
NeoBundle 'ervandew/supertab'
NeoBundle 'mattn/emmet-vim'
NeoBundle 'majutsushi/tagbar'
NeoBundle 'rking/ag.vim'
if (has("python") || has("python3"))
NeoBundle 'bling/vim-airline'
endif
" NeoBundles goes here
call neobundle#end()
" Remap fast jj to escape
inoremap jj <ESC>
" use Ctrl-S for saving, also in insert mode
" make sure to set these two lines in ~/.bash_profile and ~/.zshrc
" bind -r '\C-s'
" stty -ixon
nmap <c-s> :w<CR>
imap <c-s> <Esc>:w<CR>a
imap <c-s> <Esc><c-s>
" reselect what was just pasted
nnoremap <leader>v V`]
silent function! OSX()
return has('macunix')
endfunction
silent function! LINUX()
return has('unix) && !has('macunix) && !has('win32unix)
endfunction
silent function! WINDOWS()
return (has('win16') || has('win32') || has('win64'))
endfunction
silent function! CYGWIN()
return has('win32unix')
endfunction
if CYGWIN()
" block cursors in cygwin vim
" http://superuser.com/a/634327
let &t_ti.="\e[1 q"
let &t_SI.="\e[5 q"
let &t_EI.="\e[1 q"
let &t_te.="\e[0 q"
endif
set background=dark " Assume a dark background
colorscheme solarized
filetype plugin indent on " Automatically detect file types.
syntax on " Syntax highlighting
set mouse=a " Automatically enable mouse usage
set mousehide " Hide the mouse cursor while typing
scriptencoding utf-8
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" mouse resize splits using vim under tmux http://superuser.com/a/550482
if &term =~ '^screen'
" tmux knows the extended mouse mode
set ttymouse=xterm2
endif
if has('clipboard')
if has('unnamedplus') " When possible use + register for copy paste
set clipboard=unnamedplus
else
set clipboard=unnamed
endif
endif
" copy cut and paste settings for clipboard
vmap <C-c> "+y
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <C-r><C-o>+
" set autowrite " Automatically write a file when
" leaving a modified buffer
set viewoptions=folds,options,cursor,unix,slash " Better unix / windows compatibility
set virtualedit=onemore " Allow for cursor beyond last character
set history=1000 " Allow for cursor beyond last character
set spell " Spell checking on
set hidden " Allow buffer switching without saving
" Setting up the directories
set backup
if has('persistent_undo')
set undofile " So is persistent undo ...
set undolevels=1000 " Maximum number of changes that can be undone
set undoreload=1000 " Maximum number lines to save for undo on a buffer reload
endif
set tabpagemax=15 " Only show 15 tabs
set showmode " Display current mode
set cursorline " Highlight current line
highlight clear SignColumn " SignColumn should match background
highlight clear LineNr " Current line number row will have same background color in relative mode
set backspace=indent,eol,start " Backspace for dummies
set linespace=0 " No extra spaces between rows
set nu " Line numbers on
set showmatch " Show matching brackets/parenthesis
set incsearch " Find as you type search
set hlsearch " Highlight search terms
set winminheight=0 " Windows can be 0 line height
set ignorecase " Case insensitive search
set smartcase " Case sensitive when uc present
set wildmenu " Show list instead of just completing
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too
set scrolljump=5 " Lines to scroll when cursor leaves screen
set scrolloff=3 " Minimum lines to keep above and below cursor
set foldenable " Auto fold code
set list
set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
set nowrap " Do not wrap long lines
set autoindent " Indent at the same level of the previous line
set shiftwidth=4 " Use indents of 4 spaces
set expandtab " Tabs are spaces, not tabs
set tabstop=4 " An indentation every four columns
set softtabstop=4 " Let backspace delete indent
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
set splitright " Puts new vertical split windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
set pastetoggle=<F12> " paste toggle (sane indentation pastes)
autocmd FileType c,cpp,cs,java,go,php,javascript,python,twig,xml,yml autocmd BufWritePre <buffer> call StripTrailingWhitespace()
autocmd FileType haskell setlocal expandtab shiftwidth=2 softtabstop=2
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
let mapleader = ','
let maplocalleader = '_'
" Easier moving in tabs and windows
" The lines conflict with the default digraph mapping of <C-K>
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-L> <C-W>l<C-W>_
map <C-H> <C-W>h<C-W>_
" Wrapped lines goes down/up to next row, rather than next line in file.
noremap j gj
noremap k gk
" Stupid shift key fixes
if has("user_commands")
command! -bang -nargs=* -complete=file E e<bang> <args>
command! -bang -nargs=* -complete=file W w<bang> <args>
command! -bang -nargs=* -complete=file Wq wq<bang> <args>
command! -bang -nargs=* -complete=file WQ wq<bang> <args>
command! -bang Wa wa<bang>
command! -bang WA wa<bang>
command! -bang Q q<bang>
command! -bang QA qa<bang>
command! -bang Qa qa<bang>
endif
cmap Tabe tabe
" Yank from the cursor to the end of the line, to be consistent with C and D.
noremap Y y$
" Clear current search highlighting by fast //
nmap <silent> // :nohlsearch<CR>
" Find merge conflict markers
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
" Shortcuts
" Change working Directory to that of the current file
cmap cwd lcd %:p:h
cmap cd. lcd %:p:h
" Visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
" Allowing using the repeat operator with a visual selection (!)
"http://stackoverflow.com/a/8064607/127816
vnoremap . :normal .<CR>
" For when you forget to sudo.. Really Write the file.
cmap w!! w !sudo tee % >/dev/null
function! StripTrailingWhitespace()
" Preparation: save last search, cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" do the business:
%s/\s\+$//e
" clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
function! InitializeDirectories()
let parent = $HOME
let prefix = 'vim'
let dir_list = {
\ 'backup': 'backupdir',
\ 'views': 'viewdir',
\ 'swap': 'directory' }
if has('persistent_undo')
let dir_list['undo'] = 'undodir'
endif
let common_dir = parent . '/.' . prefix
for [dirname, settingname] in items(dir_list)
let directory = common_dir . dirname . '/'
if exists("*mkdir")
if !isdirectory(directory)
call mkdir(directory)
endif
endif
if !isdirectory(directory)
echo "Warning: Unable to create backup directory: " . directory
echo "Try: mkdir -p " . directory
else
let directory = substitute(directory, " ", "\\\\ ", "g")
exec "set " . settingname . "=" . directory
endif
endfor
endfunction
call InitializeDirectories()
" Plugins setup goes here
" NerdTree
map <C-e> <plug>NERDTreeTabsToggle<CR>
map <leader>e :NERDTreeFind<CR>
nmap <leader>nt :NERDTtreeFind<CR>
let NERDTreeShowBookmarks=1
let NERDTreeIgnore=['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr']
let NERDTreeChDirMode=0
let NERDTreeQuitOnOpen=0
let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeKeepTreeinNewTab=1
" Tabularize
nmap <Leader>a& :Tabularize /&<CR>
vmap <Leader>a& :Tabularize /&<CR>
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:<CR>
vmap <Leader>a: :Tabularize /:<CR>
nmap <Leader>a:: :Tabularize /:\zs<CR>
vmap <Leader>a:: :Tabularize /:\zs<CR>
nmap <Leader>a, :Tabularize /,<CR>
vmap <Leader>a, :Tabularize /,<CR>
nmap <Leader>a,, :Tabularize /,\zs<CR>
vmap <Leader>a,, :Tabularize /,\zs<CR>
nmap <Leader>a<Bar> :Tabularize /<Bar><CR>
vmap <Leader>a<Bar> :Tabularize /<Bar><CR>
"" ctrlp
"let g:ctrlp_working_path_mode = 'ra'
"nnoremap <silent> <D-t> :CtrlP<CR>
"nnoremap <silent> <D-r> :CtrlPMRU<CR>
"let g:ctrlp_custom_ignore = {
"\ 'dir': '\.git$\|\.hg$\|\.svn$',
"\ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
"" On Windows use "dir" as fallback command.
"if executable('ag')
"let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
"elseif executable('ack')
"let s:ctrlp_fallback = 'ack %s --nocolor -f'
"elseif WINDOWS()
"let s:ctrlp_fallback = 'dir %s /-n /b /s /a-d'
"else
"let s:ctrlp_fallback = 'find %s -type f'
"endif
"let g:ctrlp_user_command = {
"\ 'types': {
"\ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
"\ 2: ['.hg', 'hg --cwd %s locate -I .'],
"\ },
"\ 'fallback': s:ctrlp_fallback
"\ }
" Fugitive
nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
nnoremap <silent> <leader>ge :Gedit<CR>
" Mnemonic _interactive
nnoremap <silent> <leader>gi :Git add -p %<CR>
nnoremap <silent> <leader>gg :SignifyToggle<CR>
" Undotree
nnoremap <Leader>u :UndotreeToggle<CR>
" if undotree is opened, it is likely one wants to interact
let g:undotree_SetFocusWhenToggle=1
" indent_guides
let g:indent_guides_start_level=2
let g:indent_guides_guide_size=1
let g:indent_guides_enable_on_vim_startup=1
" syntastic
let g:syntastic_enable_signs = 1
let g:syntastic_error_symbol = ''
let g:syntastic_warning_symbol = '!'
let g:syntastic_check_on_open = 1
" vim-airline
set laststatus=2
let g:airline_powerline_fonts=1
" unite.vim
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#set_profile('files', 'smartcase', 1)
call unite#custom#source('line,outline','matchers','matcher_fuzzy')
" replacing unite with ctrl-p
let g:unite_data_directory='~/.vim/.cache/unite'
let g:unite_enable_start_insert=1
let g:unite_split_rule = 'botright'
let g:unite_source_history_yank_enable=1
let g:unite_prompt='» '
if executable('ag')
let g:unite_source_grep_command='ag'
let g:unite_source_grep_default_opts='--nocolor --nogroup -S -C4'
let g:unite_source_grep_recursive_opt=''
elseif executable('ack')
let g:unite_source_grep_command='ack'
let g:unite_source_grep_default_opts='--no-heading --no-color -C4'
let g:unite_source_grep_recursive_opt=''
endif
nmap <space> [unite]
nnoremap [unite] <nop>
"if WINDOWS()
"nnoremap <silent> [unite]<space> :<C-u>Unite -toggle -auto-resize -buffer-name=mixed file_rec:! buffer file_mru bookmark<cr><c-u>
"nnoremap <silent> [unite]f :<C-u>Unite -toggle -auto-resize -buffer-name=files file_rec:!<cr><c-u>
"else
nnoremap <silent> [unite]<space> :<C-u>Unite -toggle -auto-resize -buffer-name=mixed file_rec/async:! buffer file_mru bookmark<cr><c-u>
nnoremap <silent> [unite]f :<C-u>Unite -toggle -auto-resize -buffer-name=files file_rec/async:!<cr><c-u>
nnoremap <silent> <C-p> :<C-u>Unite -toggle -auto-resize -buffer-name=files file_rec/async:!<cr><c-u>
"endif
nnoremap <silent> [unite]e :<C-u>Unite -buffer-name=recent file_mru<cr>
nnoremap <silent> [unite]y :<C-u>Unite -buffer-name=yanks history/yank<cr>
nnoremap <silent> [unite]l :<C-u>Unite -auto-resize -buffer-name=line line<cr>
nnoremap <silent> [unite]b :<C-u>Unite -auto-resize -buffer-name=buffers buffer<cr>
nnoremap <silent> [unite]/ :<C-u>Unite -no-quit -buffer-name=search grep:.<cr>
nnoremap <silent> [unite]m :<C-u>Unite -auto-resize -buffer-name=mappings mapping<cr>
nnoremap <silent> [unite]s :<C-u>Unite -quick-match buffer<cr>
nnoremap <silent> [unite]h :<C-u>Unite -start-insert help <cr>
"nnoremap < C - h > : < C - u > Unite - start - insert help < CR >
# curl https://gist.github.com/prabirshrestha/279d8b179d9353fe8694/raw/.zshrc -o ~/.zshrc
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="babun"
# use agnoster if you want powerlines
#ZSH_THEME="agnoster"
plugins=(colored-man docker git jake-node jump npm nvm z)
source $ZSH/oh-my-zsh.sh
# User configuration
export PATH=$HOME/bin:/usr/local/bin:$PATH
# 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"
# enable vi bindings
bindkey -v
bindkey -M viins 'jj' vi-cmd-mode
stty -ixon
#!/bin/zsh
# curl https://gist.github.com/prabirshrestha/279d8b179d9353fe8694/raw/babun-post-install | zsh
successfully() {
$* || (echo "\nfailed" 1>&2 && exit 1)
}
fancy_echo() {
echo "\n$1"
}
fancy_echo "Updating babun"
successfully pact update
fancy_echo "Updating ~/.zshrc"
successfully curl https://gist.github.com/prabirshrestha/279d8b179d9353fe8694/raw/.zshrc -o ~/.zshrc
fancy_echo "Installing tmux"
successfully pact install tmux
fancy_echo "Installing solarized dark theme and powerconsolas for mintty"
successfully curl https://gist.github.com/prabirshrestha/279d8b179d9353fe8694/raw/.minttyrc -o ~/.minttyrc
fancy_echo "Installing the_silver_searcher (ag)"
successfully pact install automake pkg-config libpcre-devel liblzma-devel
successfully git clone https://github.com/ggreer/the_silver_searcher ~/ag
successfully pushd ~/ag
successfully bash -x -o igncr ./build.sh && make install
successfully cd ..
successfully rm -rf ~/ag
successfully popd
fanyc_echo "Updating gitconfig"
successfully git config --global core.autocrlf true
successfully git config --global user.name "prabirshrestha"
successfully git config --global user.email "[email protected]"
echo "execute 'chere -i -t mintty' in admin mode to enable Zsh Prompt Here"
source ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment