Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Johnytran/a617b6e823252fdf00dbcba3f2ed0427 to your computer and use it in GitHub Desktop.
Save Johnytran/a617b6e823252fdf00dbcba3f2ed0427 to your computer and use it in GitHub Desktop.
vimrc
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Plugins
Plugin 'tpope/vim-fugitive'
Plugin 'Townk/vim-autoclose'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'bmatzelle/gow'
Plugin 'KabbAmine/vCoolor.vim'
Plugin 'mattn/emmet-vim'
plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
" Optional
Plugin 'honza/vim-snippets'
Plugin 'MarcWeber/vim-addon-mw-utils'
syntax on
set fdm=indent
set foldcolumn=4
set fdl=1
let NERDTreeQuitOnOpen=1
let g:user_emmet_leader_key = '<c-s>'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Tabulation settings
set tabstop=4
set softtabstop=4
set shiftwidth=4
" set noexpandtab
let mapleader = "b"
nmap <leader>ne :NERDTree<cr>
let g:NERDTreeChDirMode = 2
let g:ctrlp_working_path_mode = 'rw'
map <leader>r :NERDTreeFind<cr>
autocmd BufEnter * if &modifiable | NERDTreeFind | wincmd p | endif
" returns true iff is NERDTree open/active
function! rc:isNTOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
" calls NERDTreeFind iff NERDTree is active, current window contains a modifiable file, and we're not in vimdiff
function! rc:syncTree()
if &modifiable && rc:isNTOpen() && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
wincmd p
endif
endfunction
autocmd BufEnter * call rc:syncTree()
" Style for xml format
" Windows: $VIM/_vimrc (original)
" *n*x : ~/.vimrc
" www.pinkjuice.com/vim/vimrc.txt
" for more info check
" www.pinkjuice.com/vim/
" regarding XML related stuff check
" www.pinkjuice.com/howto/vimxml/
" email: tobiasreif pinkjuice com
" The following works for me with Vim 6.2 on Windows
" (most stuff also works on Linux),
" but I don't recommend to blindly copy and use it.
" (check the respective documentation)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" general
set nocompatible
highlight Normal guifg=Black guibg=#ffefd5
set formatoptions=t
set textwidth=70
set encoding=utf-8
set termencoding=latin1
set fileformat=unix
"set guifont=courier_new:h10
set guifont=Courier\ New:h10,Courier,Lucida\ Console,Letter\ Gothic,
\Arial\ Alternative,Bitstream\ Vera\ Sans\ Mono,OCR\ A\ Extended
set nowrap
set shiftwidth=2
set visualbell
set noerrorbells
set number
set autoindent
set ruler
set expandtab
set whichwrap=<,>,h,l
set guioptions=bgmrL
set backspace=2
set history=50
set backup
set wildmenu
set nrformats=
set foldlevelstart=99
if has("unix")
set shcf=-ic
endif
let mapleader = ","
let $ADDED = '~/.vim/added/'
if has("win32")
let $ADDED = $VIM.'/added/'
endif
map <Leader>cd :exe 'cd ' . expand ("%:p:h")<CR>
nmap <F1> :w<CR>
imap <F1> <ESC>:w<CR>a
map <F8> gg"+yG
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Installed
" www.vim.org/scripts/script.php?script_id=301
" $ADDED/xml.vim
" www.vim.org/scripts/script.php?script_id=39
" copied macros/matchit.vim to plugin/
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" XML
map <Leader>x :set filetype=xml<CR>
\:source $VIMRUNTIME/syntax/xml.vim<CR>
\:set foldmethod=syntax<CR>
\:source $VIMRUNTIME/syntax/syntax.vim<CR>
\:colors peachpuff<CR>
\:source $ADDED/xml.vim<CR>
\:iunmap <buffer> <Leader>.<CR>
\:iunmap <buffer> <Leader>><CR>
\:inoremap \> ><CR>
\:echo "XML mode is on"<CR>
" no imaps for <Leader>
"\:inoremap \. ><CR>
" catalog should be set up
nmap <Leader>l <Leader>cd:%w !xmllint --valid --noout -<CR>
nmap <Leader>r <Leader>cd:%w !rxp -V -N -s -x<CR>
nmap <Leader>d4 :%w !xmllint --dtdvalid
\ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
\ --noout -<CR>
vmap <Leader>px !xmllint --format -<CR>
nmap <Leader>px !!xmllint --format -<CR>
nmap <Leader>pxa :%!xmllint --format -<CR>
nmap <Leader>i :%!xsltlint<CR>
" todo:
" check
" http://mugca.its.monash.edu.au/~djkea2/vim/compiler/xmllint.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Ruby
" check
" www.rubygarden.org/ruby?VimExtensions
" config for gow plugin -- add copy item for nerdtree
let g:NERDTreeCopyCmd= 'cp -r'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment