Skip to content

Instantly share code, notes, and snippets.

@wong2
Created September 18, 2015 08:41
Show Gist options
  • Save wong2/2336c8a3417c11ccd237 to your computer and use it in GitHub Desktop.
Save wong2/2336c8a3417c11ccd237 to your computer and use it in GitHub Desktop.
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
filetype off
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'mattn/emmet-vim'
Plugin 'ervandew/supertab'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
Plugin 'Markdown'
Plugin 'molokai'
Plugin 'Lokaltog/vim-powerline'
Plugin 'goldfeld/vim-seek'
Plugin 'pyflakes.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'lepture/vim-jinja'
Plugin 'majutsushi/tagbar'
Plugin 'digitaltoad/vim-jade'
Plugin 'groenewege/vim-less'
Plugin 'mxw/vim-jsx'
Plugin 'pangloss/vim-javascript'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdcommenter'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
call vundle#end() " required
filetype plugin indent on " required
" Indentation
set autoindent
set smartindent
set smarttab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
" jj => ESC
inoremap jj <ESC>
" remap : to ;
nnoremap ; :
" undo even after close the file
" set undofile
" ColorScheme
syntax enable
" nerd tree plugin
nnoremap <C-d> :NERDTreeToggle<CR>
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
" Show line number
set number
" show relative line number from current line
" set relativenumber
" handle cases in search
set ignorecase
set smartcase
" Incremental search
set incsearch
" highlight search
set hlsearch
" toggle between paste and normal: for 'safer' pasting from keyboard
set pastetoggle=<F4>
set nobackup
set nowritebackup
set noswapfile
set autoindent
set cindent
set cinoptions=:s,ps,ts,cs
set cinwords=if,else,while,do,for,switch,case
" map tab page navigations
map <C-S-Tab> :tabprevious<CR>
nmap <C-S-Tab> :tabprevious<CR>
imap <C-S-Tab> <ESC>:tabprevious<CR>i
map <C-Tab> :tabnext<CR>
nmap <C-Tab> :tabnext<CR>
imap <C-Tab> <ESC>:tabnext<CR>i
" Sudo write
comm! W exec 'w !sudo tee % > /dev/null' | e!
" change leader key
" let mapleader = ","
" reselect the text that was just pasted
nnoremap <leader>v V`]
" zencoding map
let g:user_emmet_leader_key = ","
" powerline
set nocompatible " Disable vi-compatibility
set laststatus=2 " Always show the statusline
set encoding=utf-8 " Necessary to show Unicode glyphs
set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
function! s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif
endif
endif
endfunction
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
au BufNewFile *.py 0r ~/.vim/python.skel | let IndentStyle = "python"
au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm set ft=jinja
nmap <F8> :TagbarToggle<CR>
let g:pymode_folding = 0
let g:jsx_ext_required = 0
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2
autocmd Filetype html setlocal ts=2 sts=2 sw=2
autocmd Filetype css setlocal ts=2 sts=2 sw=2
autocmd Filetype scss setlocal ts=2 sts=2 sw=2
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:NERDSpaceDelims=1
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:syntastic_javascript_checkers = ['eslint']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment