Skip to content

Instantly share code, notes, and snippets.

@dbani-dev
Forked from anonymous/.vimrc
Last active August 29, 2015 14:26
Show Gist options
  • Save dbani-dev/e31b924b4796bc1b83e7 to your computer and use it in GitHub Desktop.
Save dbani-dev/e31b924b4796bc1b83e7 to your computer and use it in GitHub Desktop.
"---------------------------------------------------"
" Author: Karl Brightman "
" Homepage: http://karlbrig.ht "
" Source: http://github.com/karlbright/vimrc "
"---------------------------------------------------"
" vim:set ts=2 sts=2 sw=2 expandtab:
autocmd!
filetype off "Turn off file type detection. Required for Vundle
set nocompatible " Disable vi compatibility
set hidden " Allow buffers to be hidden without writing to the disk
set history=10000 " Large command history
set encoding=utf-8 " Character encoding
set shell=/bin/zsh " Set shell to use zsh
set clipboard=unnamed " Allow yank and paste from system
set ch=1 " Number of lines to use for the command-line
set showcmd " Show incomplete commands in status line
set nolazyredraw " Redraw while executing macros
set nostartofline " Do not move cursor to first non blank in line
set shortmess+=I " Do not show the introduction screen
set wildmode=longest:full " Complete longest common string, then list alternatives
set wildmenu " Use menu for command line completion
set ignorecase smartcase " Ignore case until another other case is used
set switchbuf=useopen " Jump to first open window that contains specified buffer on open
set laststatus=2 " Always show status line
set cmdheight=1 " Use one line height for command
set showtabline=2 "Always show tab bar
set visualbell " Stop beeping
set cursorline " Highlight current line
set ruler " Show column and line
set number " Show line numbers
set guioptions-=T guioptions-=e guioptions-=L guioptions-=r " Remove toolbars, scrollbars etc if around
set showmatch " Briefly jump to matching bracket if insert one
set mat=5 " Time for showing matching bracket
set incsearch " Highlight match while typing search pattern
set hlsearch " Highlight search results
set expandtab " Use spaces for tabs
set tabstop=2 " Use 2 spaces for indenting here...
set shiftwidth=2 " here, and...
set softtabstop=2 " here
set autoindent " Take indentation from previous line
set splitright " Open new vertical splits to the right of the current buffer
set splitbelow " Open new horizontal splits below current buffer
set winwidth=80 " Minimal number of columns for current window
set t_ti= t_te= " Fix vim clobbering scrollback buffer (http://bit.ly/158EoqS)
set scrolloff=3 " Minimum number of lines to show above and below cursor
set nowrap " Do not wrap lines
set textwidth=0 " The text must flow (http://bit.ly/pWJOw)
set nowritebackup " We don't need backups...
set nobackup " when we have version control
set directory=~/.tmp,/var/tmp,/tmp " Set swap file directories with alternatives
set foldmethod=manual " Disable automatic folding
set nofoldenable " Always open folds when opening file
set backspace=indent,eol,start " Make backspace work as it should
" ******
" VUNDLE
" Automatically setting up Vundle, taken from
" http://www.erikzaadi.com/2012/03/19/auto-installing-vundle-from-your-vimrc/
" ******
let vundle_virgin=0
if !filereadable($HOME."/.vim/bundle/vundle/README.md")
" Clone vundle via github
echo "Installing Vundle..."
echo ""
silent !mkdir -p $HOME/.vim/bundle
silent !git clone https://github.com/gmarik/vundle $HOME/.vim/bundle/vundle
let vundle_virgin=1
endif
set rtp+=$HOME/.vim/bundle/vundle/ " Add vundle directory to runtime path
call vundle#rc() " Initialize vundle
" Include Vundle its self
Bundle 'gmarik/vundle'
" File finder
Bundle 'kien/ctrlp.vim'
let g:ctrlp_custom_ignore = 'node_modules\|bower_components\|DS_Store\|git'
" Ack replacement via the_silver_searcher (requires: brew install ag)
Bundle 'rking/ag.vim'
" File explorer replacement
Bundle 'scrooloose/nerdtree'
nmap <leader>nn :NERDTree<cr>
nmap <leader>nq :NERDTreeClose<cr>
nmap <leader>nf :NERDTreeFind<cr>
" Comment like a pro across file types
Bundle 'scrooloose/nerdcommenter'
" Quoting/paranthesizing/html-tagging made simple
Bundle 'tpope/vim-surround'
" Enable repeating supported plugin maps
Bundle 'tpope/vim-repeat'
" Align things because pretty code is good code
Bundle 'godlygeek/tabular'
" Vim syntax for LESS (dynamic CSS)
Bundle 'groenewege/vim-less'
" Syntax checker with Syntastic
" Bundle 'scrooloose/syntastic'
"set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['jsxhint']
" Coffeescript support
Bundle 'kchmck/vim-coffee-script'
" Go lang
Bundle 'fatih/vim-go'
let g:go_fmt_command = "goimports"
" Split join multiple line statements
Bundle 'splitjoin.vim'
nmap <leader>sj :SplitjoinSplit<cr>
nmap <leader>sl :SplitjoinJoin<cr>
" Tmux vim navigation
Bundle 'christoomey/vim-tmux-navigator'
Bundle 'benmills/vimux'
map <Leader>vp :VimuxPromptCommand<CR>
map <Leader>vl :VimuxRunLastCommand<CR>
map <Leader>vi :VimuxInspectRunner<CR>
map <Leader>vq :VimuxCloseRunner<CR>
map <Leader>vs :VimuxInterruptRunner<CR>
map <Leader>vc :VimuxClearRunnerHistory<CR>
map <Leader>vz :VimuxZoomRunner<CR>
" Import JS commonJS styles
Bundle 'trotzig/import-js'
" Dash keybindings for docs
Bundle 'rizzatti/dash.vim'
:nmap <silent> <leader>d <Plug>DashSearch
" Abolish - Substitution with coercion and keeping case
Bundle 'tpope/vim-abolish'
" Themes - I used to use tomorrow-night-bright but Hybrd is kinda nice!
" Bundle 'chriskempson/tomorrow-theme', {'rtp': 'vim'}
" Bundle 'w0ng/vim-hybrid'
Bundle 'chriskempson/base16-vim'
set t_Co=256 " Set 256 colors
let transparency=1 " A little bit of transparency never killed anyone..
set background=dark " Background should be dark like my coffee
let base16colorspace=256 " Use 256 color space
colorscheme base16-google " Make things pretty
if vundle_virgin == 1
" Install bundles if this is the first time vim has been run with this config
ech "Installing bundles..."
echo ""
:BundleInstall
source $HOME/.vimrc
:q
endif
syntax on " Enable syntax highlighting
filetype plugin indent on "Automatically detect file types
" Basic key mappings
imap <c-c> <esc>
nmap <space> :nohlsearch<cr>
nmap <leader><tab> :b#<cr>
nmap <leader>[ :cprev<cr>
nmap <leader>] :cnext<cr>
nnoremap <leader>= <C-W>=
nnoremap <leader>+ :exe "resize +10"<cr>
nnoremap <leader>- :exe "resize -10"<cr>
" Disable the arrow keys, its bad practice...
map <Left> <Nop>
map <Right> <Nop>
map <Up> <Nop>
map <Down> <Nop>
" Filetype settings
autocmd BufRead,BufNewFile {*.hbs} set filetype=html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment