Skip to content

Instantly share code, notes, and snippets.

@liuhenry
Last active October 6, 2015 11:28
Show Gist options
  • Select an option

  • Save liuhenry/2987010 to your computer and use it in GitHub Desktop.

Select an option

Save liuhenry/2987010 to your computer and use it in GitHub Desktop.
Current vim config
" Vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle - required
Bundle 'gmarik/vundle'
" Bundles and sources - comments after Bundle command are not allowed
" Colorscheme, Fonts
Bundle 'altercation/vim-colors-solarized'
Bundle 'kien/rainbow_parentheses.vim'
" Code tools
Bundle 'majutsushi/tagbar'
Bundle 'scrooloose/syntastic'
Bundle 'closetag.vim'
" Language specific
Bundle 'tpope/vim-haml'
Bundle 'kchmck/vim-coffee-script'
Bundle 'vim-ruby/vim-ruby'
Bundle 'jpalardy/vim-slime'
Bundle 'tpope/vim-rails'
" Navigation, Status, and Repository
Bundle 'scrooloose/nerdtree'
Bundle 'bufexplorer.zip'
Bundle 'Obvious-Mode'
Bundle 'Lokaltog/vim-powerline'
Bundle 'tpope/vim-fugitive'
Bundle 'kien/ctrlp.vim'
Bundle 'mileszs/ack.vim'
Bundle 'sjl/gundo.vim'
Bundle 'YankRing.vim'
" Snippets
Bundle 'msanders/snipmate.vim'
Bundle 'scrooloose/snipmate-snippets'
"Bundle 'ervandew/supertab'
Bundle 'Valloric/YouCompleteMe'
" Editing
Bundle 'scrooloose/nerdcommenter'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
Bundle 'tsaleh/vim-matchit'
Bundle 'kana/vim-textobj-user'
Bundle 'nelstrom/vim-textobj-rubyblock'
Bundle 'tomtom/tcomment_vim'
Bundle 'myusuf3/numbers.vim'
Bundle 'scratch.vim'
"----------------------------------------------------------
" Syntax highlighting, filetype detection, colorscheme, and font
set shell=/bin/sh
filetype plugin indent on
syntax on
colorscheme solarized
set background=dark
set gfn=Menlo\ Regular\ for\ Powerline:h12
let g:Powerline_symbols = 'fancy'
"if has('gui_running')
"set background=light
"else
"set background=dark
"endif
"
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let NERDTreeShowHidden = 1
let NERDTreeIgnore = ['\~$', '\.sw.\{1}']
let g:ctrlp_show_hidden = 1
runtime macros/matchit.vim
let g:syntastic_python_checker = "flake8"
let g:syntastic_python_checker_args = "--ignore=E501 --max-complexity=10"
"let g:syntastic_python_checker_args = "--disable=C0301,E1101"
let g:ctrlp_map = '<c-\>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_custom_ignore = '\v\~$|\.(o|swp|pyc|wav|mp3|ogg|blend)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|__init__\.py'
"let g:SuperTabDefaultCompletionType = "context"
"let g:SuperTabMappingForward = '<c-space>'
"let g:SuperTabMappingBackward = '<s-c-space>'
autocmd FileType * nested :call tagbar#autoopen(0)
nnoremap <F3> :GundoToggle<CR>
nnoremap <F4> :YRShow<CR>
nnoremap <F6> :NERDTreeToggle<CR>
nnoremap <F8> :TagbarToggle<CR>
nnoremap <D-F> :Ack<space>
"----------------------------------------------------------
" Essential options
" RVM compatiblity
set shell=zsh
" Switch from unsaved buffer without saving first, keep undo history for
" multiple files.
set hidden
" Better command-line completion
set wildmenu
" Show partial commands in last line of the screen
set showcmd
" Highlight searches
set hlsearch
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
" Map F3 to relative/absolute line numbering toggle
nnoremap <F2> :NumbersToggle<CR>
" Use Control-C for Esc
imap <c-c> <esc>
" Modelines have historically been a source of security vulnerabilities. As
" such, it may be a good idea to disable them and use the securemodelines
" script, <http://www.vim.org/scripts/script.php?script_id=1876>.
" set nomodeline
" Auto save on loss of focus
au FocusLost * :wa
"----------------------------------------------------------
" Usability options
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks, and start of insert action
set backspace=indent,eol,start
" Keep the same indent as current line when opening a new line and no file-
" type specific indenting is enabled
set autoindent
" Stop certain movements from always going to the first character of a line
set nostartofline
" Display cursor position on last line of screen or status line of window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking to save changed files
set confirm
" Use visual bell instead of beeping when doing something wrong
set visualbell
" Reset the terminal code for visual bell. If visualbell is set, and this
" line is also included, vim will neither flash nor beep. If visualbell is
" unset, this does nothing.
set t_vb=
" Enable use of mouse for all modes
set mouse=a
" Set the command window hiehg to 2 lines
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
nnoremap <F11> :set invpaste paste?<CR>
set pastetoggle=<F11>
set showmode
"----------------------------------------------------------
" Indentation options
" Indentation for spaces instead of tabs. Do not change 'tabstop' from 8
set shiftwidth=2
set softtabstop=2
set expandtab
" Indentation for CoffeeScript
au BufNewFile,BufReadPost *.coffee setl shiftwidth=2 softtabstop=2 expandtab
" Indentation settings for using hard tabs for indent.
"set shiftwidth=4
"set tabstop=4
"----------------------------------------------------------
" Useful mappings
" May Y to act like D and C (yank until EOL), rather than act as default yy
map Y y$
"----------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment