Last active
June 27, 2016 04:09
-
-
Save jiapengjun/0b1047d668b9bc7b963c9bf80ecb93a6 to your computer and use it in GitHub Desktop.
setup VIM ~/.vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
set incsearch | |
set showmatch | |
set smartcase | |
set ignorecase | |
set number | |
set linebreak | |
set scrolloff=2 | |
set hlsearch | |
"set background=dark | |
set hidden | |
set showcmd | |
set ruler | |
set nrformats-=octal | |
set backspace=indent,eol,start | |
set autoindent | |
set smartindent | |
set expandtab | |
set shiftwidth=4 | |
set softtabstop=4 | |
set tabstop=4 | |
set shiftround | |
set foldmethod=marker | |
set foldmarker={{{,}}} | |
set timeout | |
set timeoutlen=1000 | |
set ttimeoutlen=100 | |
set backup | |
if &backupdir =~# '^\.,' | |
let &backupdir = "/Users/pengjun/Library/Vim/backup," . &backupdir | |
endif | |
set swapfile | |
if &directory =~# '^\.,' | |
let &directory = "/Users/pengjun/Library/Vim/swap," . &directory | |
endif | |
set wildmenu | |
set wildmode=full | |
set undofile | |
if &undodir =~# '^\.\%(,\|$\)' | |
let &undodir = "/Users/pengjun/Library/Vim/undo," . &undodir | |
endif | |
"set gdefault | |
colorscheme peachpuff | |
filetype plugin indent on | |
syntax on | |
"let mapleader="," | |
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exec "normal g'\"" | endif | |
augroup vimscript | |
autocmd! | |
autocmd BufWritePost $MYVIMRC source $MYVIMRC | |
augroup END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" C, java | |
autocmd FileType c set foldmethod=syntax | |
autocmd FileType java set foldmethod=syntax | |
" Python | |
autocmd FileType python set foldmethod=indent | |
" javascript | |
function! JavaScriptFold() | |
setl foldmethod=syntax | |
setl foldlevelstart=1 | |
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend | |
function! FoldText() | |
return substitute(getline(v:foldstart), '{.*', '{...}', '') | |
endfunction | |
setl foldtext=FoldText() | |
endfunction | |
autocmd FileType javascript call JavaScriptFold() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment