"pathogen
execute pathogen#infect()
syntax on
filetype plugin indent on
"pathogen end
syntax on
"color darkblue
filetype indent on
filetype plugin on
filetype plugin indent on
set autoindent
set nobackup
set nowb
set noswapfile
set showmatch
set fileencodings=utf-8,gbk,gb2312,gb18030
set encoding=utf-8
set termencoding=utf-8
set number
set ruler
set noerrorbells
set nocompatible
set cindent
set smartindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set incsearch
set hlsearch
set autoread
set hidden "you can have unwritten changes to a file and open a new file using :e, without being forced to write or undo your changes first
set scs "cscope
set lbr
set laststatus=2
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c
function! CurDir()
let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")
return curdir
endfunction
function! HasPaste()
if &paste
return 'PASTE MODE '
else
return ''
endif
endfunction
set statusline+=\ \ [
set statusline+=%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{&fileformat}] " file format
set statusline+=%= " right align
set statusline+=0x%-8B " current char
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
"Delete trailing white space, useful for Python ;)
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufRead * silent! %s/[\r \t]\+$//
autocmd FileType c,cpp setlocal cinoptions=:0,g0,(0,w1 shiftwidth=4 tabstop=4
autocmd FileType html,xhtml,haml setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2 autoindent
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab
autocmd FileType css setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab
autocmd FileType java,jsp, setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2 autoindent
set nu
set ignorecase
set nowrapscan
set mouse=a
nmap <F8> :TagbarToggle<CR>
set nocompatible
if has('mouse')
set mouse=a
endif
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
set number
set nowrap
set mousemodel=popup
set guioptions+=b
set expandtab
set sw=4
set tabstop=4 " 怕檔案裡頭仍有 \t
set softtabstop=4
"plugin syntax
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
"end plugin syntax
nmap <leader>s :TagbarToggle<CR>
execute pathogen#infect()
syntax on
filetype plugin indent on
set smartindent
set incsearch
"let mapleader=","
"nerdtree settings
nmap <leader><F7> :NERDTree<CR>
"close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
"end nerdtree settings