Skip to content

Instantly share code, notes, and snippets.

@gerarldlee
Forked from prabirshrestha/.bash_profile
Last active March 22, 2021 06:43
Show Gist options
  • Save gerarldlee/b971176550f2f9b44bf6 to your computer and use it in GitHub Desktop.
Save gerarldlee/b971176550f2f9b44bf6 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.githubusercontent.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 sw=4 ts=4 sts=4 et tw=78 foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell:
" lua-windows: http://sourceforge.net/projects/luabinaries/files/5.2.3/Windows%20Libraries/Dynamic/
" must be first line
set nocompatible
" define and reset augroup used in vimrc
augroup vimrc
autocmd!
augroup END
" os sepecific {{{
let s:is_win = has('win32') || has('win64')
let s:is_cygwin = has('win32unix')
let s:is_mac = has('macunix') || (executable('uname') && system('uname') =~? '^darwin')
let s:is_sudo = $SUDO_USER != '' && $USER !=# $SUDO_USER
\ && $HOME !=# expand('~'.$USER)
\ && $HOME ==# expand('~'.$SUDO_USER)
if s:is_win
set shellslash " exchange path separator
endif
" }}}
" cache {{{
let $CACHE=expand('~/.vim')
if !isdirectory(expand($CACHE))
call mkdir(expand($CACHE), 'p')
endif
if !filereadable(expand('$CACHE/bundle/neobundle.vim/README.md'))
echo "Installing neobundle ..."
echo ""
execute printf('!git clone %s://github.com/Shougo/neobundle.vim',
\ (exists('$http_proxy') ? 'https' : 'git'))
\ expand('$CACHE/bundle/neobundle.vim')
endif
if has('vim_starting')
let &rtp=expand('$CACHE/bundle/neobundle.vim').','.&rtp
endif
" }}}
call neobundle#begin(expand('$CACHE/bundle'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/vimproc.vim'
NeoBundle 'ntpeters/vim-better-whitespace'
NeoBundleLazy 'mattn/webapi-vim'
" NeoBundle unite.vim {{{
NeoBundleLazy 'Shougo/unite.vim', { 'commands' : [{ 'name' : 'Unite', 'complete' : 'customlist,unite#complete_source'}], 'depends' : 'Shougo/neomru.vim', }
NeoBundleLazy 'Shougo/neocomplete.vim', { 'insert': 1, 'depends': 'Shougo/context_filetype.vim', }
NeoBundleLazy 'Shougo/neosnippet.vim', { 'insert': 1, 'filetypes': 'snippet', 'depends': ['Shougo/context_filetype.vim', 'Shougo/neosnippet-snippets'], 'unite_sources': ['neosnippet', 'neosnippet/user', 'neosnippet/runtime'], }
NeoBundle 'Shougo/neomru.vim'
NeoBundle 'Shougo/unite-session'
NeoBundleLazy 'prabirshrestha/unite-nuget', { 'depends': ['mattn/webapi-vim'] }
NeoBundleLazy 'prabirshrestha/unite-hackernews', { 'depends': ['mattn/webapi-vim'] }
NeoBundleLazy 'mattn/unite-remotefile'
NeoBundleLazy 'osyo-manga/unite-airline_themes'
NeoBundleLazy 'osyo-manga/unite-env'
NeoBundleLazy 'osyo-manga/unite-vimpatches'
NeoBundleLazy 'sgur/unite-qf'
NeoBundleLazy 'Shougo/unite-outline'
NeoBundleLazy 'tsukkee/unite-help'
NeoBundleLazy 'ujihisa/unite-colorscheme'
NeoBundleLazy 'ujihisa/unite-launch'
NeoBundleLazy 'mmisono/unite-compiler'
NeoBundleLazy 'osyo-manga/unite-fold'
NeoBundleLazy 'zhaocai/unite-scriptnames'
NeoBundleLazy 'pasela/unite-webcolorname'
NeoBundleLazy 'osyo-manga/unite-filetype'
NeoBundleLazy 'mackee/unite-httpstatus'
NeoBundleLazy 'mopp/unite-rss'
NeoBundleLazy 'shiena/unite-path'
NeoBundleLazy 'jbking/unite-spell-suggest'
NeoBundleLazy 'tacroe/unite-alias'
NeoBundleLazy 'Shougo/junkfile.vim', { 'unite_sources' : 'junkfile', }
NeoBundleLazy 'thinca/vim-ref', { 'unite_sources' : 'ref', }
NeoBundleLazy 'beans15/unite-maven', { 'unite_sources' : 'maven_search', 'depends': ['mattn/webapi-vim'], }
NeoBundleLazy 'thinca/vim-unite-history'
NeoBundleLazy 'tsukkee/unite-tag'
NeoBundleLazy 'rhysd/unite-mac-apps'
NeoBundleLazy 'choplin/unite-spotlight'
NeoBundleLazy 'junegunn/goyo.vim', { 'autoload': { 'commands': ['Goyo'] }, }
NeoBundleLazy 'junegunn/limelight.vim', { 'autoload': { 'commands': ['Limelight'] }, }
NeoBundleLazy 'Rykka/colorv.vim', {'autoload' : {
\ 'commands' : [
\ 'ColorV', 'ColorVView', 'ColorVPreview',
\ 'ColorVPicker', 'ColorVEdit', 'ColorVEditAll',
\ 'ColorVInsert', 'ColorVList', 'ColorVName',
\ 'ColorVScheme', 'ColorVSchemeFav',
\ 'ColorVSchemeNew', 'ColorVTurn2'],
\ }}
" NeoBundleLazy 'ujihisa/unite-font'
" NeoBundleLazy 'zoncoen/unite-autojump'
" NeoBundle 'tsukkee/unite-tag'
" NeoBundle 'tacroe/unite-mark'
" NeoBundle 'mattn/unite-gist'
" NeoBundle 'thinca/vim-unite-history'
" NeoBundle 'ryotakato/unite-outline-objc'
" NeoBundle 'soh335/unite-outline-go'
" NeoBundle 'ujihisa/unite-rake'
" NeoBundle 'kamichidu/vim-unite-javaimport'
" NeoBundle 'beans15/unite-maven'
" NeoBundle 'kamichidu/vim-unite-javadoc_viewer'
" NeoBundleLazy 'rhysd/unite-go-import.vim', {
" \ 'autoload' : {
" \ 'depends' : 'Shougo/unite.vim',
" \ 'unite_sources' : 'go/import',
" \ }
" \ }
" NeoBundle 'rhysd/unite-stackoverflow.vim'
" NeoBundle 'f110/vim-unite-jenkins'
" NeoBundle 'skeept/Ultisnips-neocomplete-unite'
" NeoBundle 'joker1007/unite-pull-request'
" NeoBundle 'mattn/unite-gist'
" NeoBundle 'rhysd/unite-ruby-require.vim'
" NeoBundle 'junkblocker/unite-codesearch'
" NeoBundle 'farseer90718/unite-workflow'
" }}}
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'jordwalke/flatlandia'
NeoBundle 'sickill/vim-monokai'
NeoBundle 'bling/vim-airline'
NeoBundleLazy 'xolox/vim-shell', { 'autoload': { 'commands': ['Fullscreen', 'Maximize', 'Open', 'MakeWithShell'] }, 'depends': ['xolox/vim-misc'], }
NeoBundle 'Shougo/vimfiler.vim'
NeoBundleLazy 'Shougo/vimshell.vim', { 'autoload': { 'commands': ['VimShell'] }, }
NeoBundle 'Yggdroot/indentLine'
NeoBundle 'jiangmiao/auto-pairs',{ 'insert': 1, }
NeoBundleLazy 'hail2u/vim-css3-syntax'
NeoBundleLazy 'tyru/open-browser.vim', { 'mappings' : '<Plug>', 'functions' : 'openbrowser#open', }
NeoBundleLazy 't9md/vim-choosewin', { 'mappings' : '<Plug>' }
NeoBundle 'yonchu/accelerated-smooth-scroll'
NeoBundleLazy 'godlygeek/csapprox', { 'terminal' : 1 }
NeoBundleLazy 'thinca/vim-guicolorscheme', { 'terminal' : 1 }
NeoBundleLazy 'tpope/vim-repeat', { 'mappings' : '.', }
NeoBundleLazy 'matchit.zip', { 'mappings' : [['nxo', '%', 'g%']] }
NeoBundleLazy 'jiangmiao/simple-javascript-indenter', { 'filetypes' : 'javascript', }
NeoBundleLazy 'jelera/vim-javascript-syntax', { 'filetypes' : 'javascript', }
NeoBundleLazy 'bkad/CamelCaseMotion', { 'mappings' : '<Plug>', }
NeoBundleLazy 'fatih/vim-go', { 'filetypes' : 'go', }
NeoBundleLazy 'lambdalisue/vim-fullscreen', { 'gui': 1, 'mappings': '<Plug>', }
NeoBundleLazy 'rcmdnk/vim-markdown', { 'filetypes' : ['markdown', 'mkd'], }
NeoBundleLazy 'junegunn/vim-easy-align', { 'mappings' : '<Plug>(EasyAlign)', }
NeoBundle 'DataWraith/auto_mkdir'
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'amirh/HTML-AutoCloseTag'
NeoBundleLazy 'elzr/vim-json' , { 'filetypes': ['json'], }
NeoBundle 'tpope/vim-fugitive'
NeoBundleLazy 'gregsexton/gitv', { 'autoload': { 'commands': 'Gitv'}, }
NeoBundle 'tpope/vim-commentary'
NeoBundle 'chrisbra/csv.vim'
NeoBundle 'leafgarland/typescript-vim'
NeoBundle 'airblade/vim-gitgutter', { 'autoload': { 'commands': ['GitGutterNextHunk', 'GitGutterPrevHunk' ] }, }
NeoBundleLazy 'ryanss/vim-hackernews', { 'autoload': { 'commands': ['HackerNews'] }}
NeoBundleLazy 'vim-scripts/loremipsum', { 'autoload' : { 'commands' : 'Loremipsum'}}
NeoBundleLazy 'mattn/emmet-vim', {'autoload': {'filetypes': ['html', 'xhttml', 'css', 'xml', 'xls', 'markdown']}}
call neobundle#end()
filetype plugin indent on
NeoBundleCheck
" encoding {{{
let &termencoding = &encoding
set encoding=utf-8
scriptencoding utf-8
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
"setglobal bomb
set fileencodings=ucs-bom,utf-8,latin1
endif
" }}}
set guifont=Consolas\ for\ Powerline\ FixedD:h11
set background=dark
" solarized {{{
colorscheme solarized
let g:solarized_termtrans=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
let g:solarized_underline=0
" }}}
" autocmd! BufWritePost vimrc source %
" autocmd! BufWritePost *.vimrc source ~/.vimrc
set shortmess+=fIlmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
syntax on
" mouse {{{
set mouse=a " Automatically enable mouse usage
set mousehide
" }}}
" clipboard {{{
if has('clipboard')
if has('unnamedplus') " When possible use + register for copy-paste
set clipboard=unnamed,unnamedplus
else " On mac and Windows, use * register for copy-paste
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>+
" }}}
let mapleader = ','
let maplocalleader = '\\'
" Remap fast jj to escape
inoremap jj <ESC>
inoremap jk <ESC>
inoremap kj <ESC>
" disable entering ex mode
map Q <Nop>
" Clear current search highlighting by fast //
nmap <silent> // :nohlsearch<CR>
" 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>
" }}}
" Quit {{{
inoremap <C-Q> <esc>:q<cr>
nnoremap <C-Q> :q<cr>
vnoremap <C-Q> <esc>
nnoremap <Leader>q :q<cr>
nnoremap <Leader>Q :qa!<cr>
" }}}
" Make Y behave like other capitals
nnoremap Y y$
" 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
" }}}
" reselect what was just pasted
nnoremap <leader>v V`]
" 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
" For when you forget to sudo.. Really Write the file.
cmap w!! w !sudo tee % >/dev/null
" No annoying sound on errors
" set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=
" 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
if !has ('gui_running') && !s:is_win
set spell " Spell checking on
set spelllang=en_us " Set en-us as default language
set spellsuggest=best,5
endif
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:.
set showbreak=···
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)
" Disable menu.vim
if has('gui_running')
set guioptions=Mc
endif
" easier split navigations: {{{
" http://robots.thoughtbot.com/vim-splits-move-faster-and-more-naturally
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" }}}
function! InitializeDirectories()
let parent = expand('$CACHE')
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()
" vim-airline {{{
set laststatus=2 " Show status line required for airline
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#fnamemod = ':t'
let g:Powerline_symbols="fancy"
let g:airline_symbols = {}
let g:airline_left_sep = "\u2b80" "use double quotes here
let g:airline_left_alt_sep = "\u2b81"
let g:airline_right_sep = "\u2b82"
let g:airline_right_alt_sep = "\u2b83"
let g:airline_symbols.branch = "\u2b60"
let g:airline_symbols.readonly = "\u2b64"
let g:airline_symbols.linenr = "\u2b61"
" }}}
" pseudokeys {{{
nnoremap [pseudokey] <Nop>
nmap <space> [pseudokey]
nnoremap <silent> [pseudokey]ev :<C-u>edit $MYVIMRC<CR>
nnoremap <silent> [pseudokey]p :<C-u>call ToggleOption('paste')<CR>
nnoremap <silent> [pseudokey]w :<C-u>call ToggleOption('wrap')<CR>
nnoremap <silent> [pseudokey]sp :<C-u>call ToggleOption('spelling')<CR>
nnoremap <silent> [pseudokey]ln :<C-u>call ToggleOption('relativenumber')<CR>
nnoremap <silent> [pseudokey]t2 :<C-u>setl shiftwidth=2 softtabstop=2<CR>
nnoremap <silent> [pseudokey]t4 :<C-u>setl shiftwidth=4 softtabstop=4<CR>
nnoremap <silent> [pseudokey]t8 :<C-u>setl shiftwidth=8 softtabstop=8<CR>
" Toggle options. " {
function! ToggleOption(option_name)
execute 'setlocal' a:option_name.'!'
execute 'setlocal' a:option_name.'?'
endfunction "}
" Toggle variables. "{
function! ToggleVariable(variable_name)
if eval(a:variable_name)
execute 'let' a:variable_name.' = 0'
else
execute 'let' a:variable_name.' = 1'
endif
echo printf('%s = %s', a:variable_name, eval(a:variable_name))
endfunction "}
" }}}
" unite.vim {{{
let g:unite_data_directory=expand('$CACHE/unite')
let g:unite_enable_start_insert = 1
let g:unite_split_rule = "botright"
let g:unite_force_overwrite_statusline = 0
let g:unite_winheight = 10
let g:unite_source_history_yank_enable = 1
let g:unite_update_time = 300
let g:unite_source_file_mru_limit = 100
let g:unite_source_session_enable_auto_save = 1
let g:unite_source_rec_max_cache_files = -1
let g:unite_prompt='» '
let g:unite_marked_icon = '✓'
call unite#custom_source('file_rec,file_rec/async,file_mru,file,buffer,grep',
\ 'ignore_pattern', join([
\ '\.git/',
\ 'tmp/',
\ 'node_modules/',
\ 'vendor/',
\ 'Vendor/',
\ 'bower_components/',
\ ], '\|'))
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
nnoremap <silent> [pseudokey]u :Unite<CR>
nnoremap <silent> [pseudokey]c :Unite command<CR>
nnoremap <C-P> :<C-u>Unite -buffer-name=files -auto-resize buffer -input= -resume file_rec file_mru:!<cr>
nnoremap <silent> [pseudokey]r :Unite file_mru<CR>
nnoremap <silent> [pseudokey]f :Unite file_rec/git -buffer-name=git -auto-resize -input= -resume<CR>
nnoremap <silent> [pseudokey]ft :Unite filetype<CR>
nnoremap <silent> [pseudokey]cs :Unite colorscheme<CR>
nnoremap <silent> [pseudokey]fo :Unite fold<CR>
nnoremap <silent> [pseudokey]o :Unite outline<CR>
nnoremap <silent> [pseudokey]y :Unite yank<CR>
nnoremap <silent> [pseudokey]s :Unite session<CR>
nnoremap <silent> [pseudokey]hs :Unite httpstatus<CR>
nnoremap <silent> [pseudokey]/ :<C-u>Unite -no-quit -buffer-name=search grep:.<cr>
nnoremap <silent> [pseudokey]b :<C-u>Unite -buffer-name=bookmark bookmark:<cr>
nnoremap <silent> [pseudokey]x :<C-u>UniteBookmarkAdd<cr>
nnoremap <silent> [pseudokey]h :<C-u>Unite -no-split -buffer-name=help help:<cr>
autocmd FileType unite call s:unite_settings()
function! s:unite_settings()
let b:SuperTabDisabled=1
" exit with esc
nmap <buffer> <ESC> <Plug>(unite_exit)
imap <buffer> <ESC> <Plug>(unite_exit)
" exit with ctrl-c
imap <buffer> <c-c> <Plug>(unite_exit)
nmap <buffer> <c-c> <Plug>(unite_exit)
" Ctrl jk mappings
imap <buffer> <c-j> <Plug>(unite_insert_leave)
imap <buffer> <c-k> <Plug>(unite_insert_leave)
nmap <buffer> <c-j> <Plug>(unite_loop_cursor_down)
nmap <buffer> <c-k> <Plug>(unite_loop_cursor_up)
" jj becuase you're lazy, and leave insert mode
imap <buffer> jj <Plug>(unite_insert_leave)
" qq `` becuase you're lazy, and quit unite
imap <buffer> qq <Plug>(unite_exit)
imap <buffer> `` <Plug>(unite_exit)
" refresh unite
nmap <buffer> <C-r> <Plug>(unite_redraw)
imap <buffer> <C-r> <Plug>(unite_redraw)
" choose action
nmap <buffer> <C-a> <Plug>(unite_choose_action)
imap <buffer> <C-a> <Plug>(unite_choose_action)
" split control
inoremap <silent><buffer><expr> <C-s> unite#do_action('split')
nnoremap <silent><buffer><expr> <C-s> unite#do_action('split')
inoremap <silent><buffer><expr> <C-v> unite#do_action('vsplit')
nnoremap <silent><buffer><expr> <C-v> unite#do_action('vsplit')
imap <buffer> <Tab> <Plug>(unite_complete)
imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
endfunction
" }}}
" vim-better-whitespace {{{
let g:better_whitespace_filetypes_blacklist = ['unite', 'vimfiler']
" }}}
" vim-easymotion {{{
" Bi-directional find motion
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
let g:EasyMotion_keys='hklyuiopnm,qwertzxcvbasdgjf'
nmap s <Plug>(easymotion-s)
" }}}
" vim-shell {{{
let g:shell_fullscreen_message = 0
let g:shell_fullscreen_always_on_top = 0
nmap <C-CR> :Fullscreen<CR>
imap <C-CR> <Esc>:Fullscreen<CR>a
" }}}
" git/fugitive {{{
nnoremap <Leader>gn :Unite output:echo\ system("git\ init")<CR>
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>
" }}}
" gitv {{{
nnoremap <silent> <leader>gk :Gitv<CR>
" }}}
" vim-gitgutter {{{
nmap gh <Plug>GitGutterNextHunk
nmap gph <Plug>GitGutterPrevHunk
" }}}
" goyo.vim {{{
function! s:goyo_enter()
if has('gui_running')
set fullscreen
set linespace=7
elseif exists('$TMUX')
silent !tmux set status off
endif
set scrolloff=999
Limelight
endfunction
function! s:goyo_leave()
if has('gui_running')
set nofullscreen
set linespace=0
elseif exists('$TMUX')
silent !tmux set status on
endif
set scrolloff=5
Limelight!
endfunction
autocmd! User GoyoEnter
autocmd! User GoyoLeave
autocmd User GoyoEnter nested call <SID>goyo_enter()
autocmd User GoyoLeave nested call <SID>goyo_leave()
nnoremap <Leader>G :Goyo<CR>
nnoremap <silent> [pseudokey]g :<C-u>:Goyo<CR>
" }}}
" go {{{
let g:go_fmt_command="goimports"
" }}}
" neocomplete {{{
let g:neocomplete#data_directory = expand('$CACHE/neocomplete')
"Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#enable_refresh_always = 1
let g:neocomplete#sources#syntax#min_keyword_length = 1
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
let g:neocomplete#enable_auto_select = 0
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : ''
\ }
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return neocomplete#close_popup() . "\<CR>"
" For no inserting <CR> key.
"return pumvisible() ? neocomplete#close_popup() : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"
" For cursor moving in insert mode(Not recommended)
"inoremap <expr><Left> neocomplete#close_popup() . "\<Left>"
"inoremap <expr><Right> neocomplete#close_popup() . "\<Right>"
"inoremap <expr><Up> neocomplete#close_popup() . "\<Up>"
"inoremap <expr><Down> neocomplete#close_popup() . "\<Down>"
" Or set this.
"let g:neocomplete#enable_cursor_hold_i = 1
" Or set this.
"let g:neocomplete#enable_insert_char_pre = 1
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
" Enable omni completion {{{
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" }}}
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
" }}}
" neosnippet {{{
let g:neosnippet#snippets_directory=expand('~/vim/snippets')
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif
" }}}
" vim.filer {{{
" Enable file operation commands.
let g:vimfiler_safe_mode_by_default = 0
let g:vimfiler_as_default_explorer = 1
nnoremap <silent> <Leader>e :<C-U>VimFiler -buffer-name=explorer -split -simple -winwidth=35 -toggle -no-quit<CR>
nnoremap <silent> <Leader>E :<C-U>VimFiler<CR>
" }}}
" vimshell {{{
let g:vimshell_user_prompt = 'fnamemodify(getcwd(), ":~")'
let g:vimshell_prompt = '$ '
nnoremap <silent> <Leader>s :<C-U>VimShell -buffer-name=shell -toggle<CR>
" }}}
" Commentary {{{
nmap <Leader>c <Plug>CommentaryLine
xmap <Leader>c <Plug>Commentary
" }}}
au BufRead,BufNewFile web.config set filetype=xml
" Use local vimrc if available {{{
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
" }}}}
# curl https://gist.githubusercontent.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.githubusercontent.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.githubusercontent.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.githubusercontent.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