Skip to content

Instantly share code, notes, and snippets.

@echochamber
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save echochamber/0fc37f1c370a11e9bdb2 to your computer and use it in GitHub Desktop.
Save echochamber/0fc37f1c370a11e9bdb2 to your computer and use it in GitHub Desktop.
Vimrc and Bashrc
function color_my_prompt {
local __default_color="\[\033[37m\]"
local __text_color="\[\033[0;37m\]"
local __user_and_host="\[\033[0;32m\]\u @ \h$__default_color"
local __cur_location="\[\033[0;36m\]\w$__default_color"
local __git_branch_color="\[\033[1;31m\]"
git --version 2>&1 >/dev/null # improvement by tripleee
GIT_IS_AVAILABLE=$?
if [ $GIT_IS_AVAILABLE -eq 0 ]; then
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\\\\\1\/`'
local __git_branch_display=$__git_branch_color"branch: "$__git_branch$__default_color
else
__git_branch_display=$__git_branch_color"branch: git isn't installed"$__default_color
fi
local __prompt_tail="\[\033[01;34m\]$"$__default_color
local __last_color="\[\033[00m\]"
PS1="\n"$__default_color
PS1=$PS1"┌─["$__user_and_host"]-["$__cur_location]"\n"
PS1=$PS1"├─["$__git_branch_display"]\n"
PS1=$PS1"└─["$__prompt_tail"]>"$__last_color" "
export PS1;
}
color_my_prompt
mkdir ~/.vim/
mkdir ~/.vim/swap/
mkdir ~/.vim/backup
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible " Disable vi-compatibility
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Bundle 'gmarik/vundle'
" My Bundles
" Color Scheme
Bundle 'flazz/vim-colorschemes'
set background=light
"Nerdtree Folder Management
Bundle 'scrooloose/nerdtree'
"Powerline: Cool thing at bottom of screep
Bundle 'Lokaltog/powerline'
call vundle#end()
filetype plugin indent on
set t_Co=256
colorscheme xoria256
syntax enable
set guifont=Menlo\ 16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
set showmode " always show what mode we're currently editing in
set nowrap " don't wrap lines
set tabstop=4 " a tab is four spaces
set smarttab
set tags=tags
set softtabstop=4 " when hitting <BS>, pretend like a tab is removed, even if spaces
set expandtab " expand tabs by default (overloadable per file type later)
set shiftwidth=4 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
set timeout timeoutlen=200 ttimeoutlen=100
set visualbell " don't beep
set noerrorbells " don't beep
set autowrite "Save on buffer switch
set mouse=a
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
let g:mapleader = ",s"
" Down is really the next line
nnoremap j gj
nnoremap k gk
"Easy escaping to normal model
imap jj <esc>
"Auto change directory to match current file ,cd
nnoremap ,cd :cd %:p:h<CR>:pwd<CR>
"easier window navigation
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
" Make control C copy to the clipboard
nmap <C-c> "+y
nmap <C-n> :NERDTreeToggle<cr>
"Show (partial) command in the status line
set showcmd
" Create split below
nmap :sp :rightbelow sp<cr>
" Quickly go forward or backward to buffer
nmap :bp :BufSurfBack<cr>
nmap :bn :BufSurfForward<cr>
highlight Search cterm=underline
" Swap files out of the project root
set backupdir=~/.vim/backup/
set directory=~/.vim/swap/
" Auto-remove trailing spaces
autocmd BufWritePre *.php :%s/\s\+$//e
" Open splits
nmap vs :vsplit<cr>
nmap sp :split<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment