Skip to content

Commit

Permalink
把键盘映射、配置、AutoCommand 放到不同的文件里
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Apr 16, 2012
1 parent 6213556 commit 33d9237
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 75 deletions.
8 changes: 0 additions & 8 deletions plugin/NERD_tree.vim

This file was deleted.

1 change: 0 additions & 1 deletion plugin/ctrlp.vim

This file was deleted.

3 changes: 0 additions & 3 deletions plugin/hammer.vim

This file was deleted.

2 changes: 0 additions & 2 deletions plugin/localvimrc.vim

This file was deleted.

5 changes: 0 additions & 5 deletions plugin/php-doc.vim

This file was deleted.

4 changes: 0 additions & 4 deletions plugin/session.vim

This file was deleted.

16 changes: 16 additions & 0 deletions settings/autocmds.vim
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,16 @@
" Auto Commands
autocmd FileType php set omnifunc=phpcomplete#CompletePHP

" Deletes trailing space in file upon write
autocmd BufWritePre * :%s/\s\+$//e

" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
autocmd BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby

" md, markdown, and mk are markdown and define buffer-local preview
autocmd BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} set ft=markdown

" add json syntax highlighting
autocmd BufNewFile,BufRead *.json set ft=javascript


File renamed without changes.
74 changes: 74 additions & 0 deletions settings/settings.vim
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,74 @@
colorscheme darkblue "Default VIM colorscheme which works in terminals

syntax on "Enables syntax highlighting

let mapleader="," "Changes Leader key into a comma instead of a backslash

set nocompatible "Prefents VIM from being nerfed into acting like VI
set viminfo='1000,f1,:1000,/1000
set history=500
" Share clipboard with system
set clipboard=unnamedplus
set guioptions-=T "remove toolbar
"
"------ Visual Options ------
set nu "Enable Line Numbers
set nowrap "Disable word wrap
set vb "Visual bell instead of beeps
set ruler "Displays cursor position on bottom right of screen
set statusline=%<%f\ %h%m%r%=%{fugitive#statusline()}\ \ %-14.(%l,%c%V%)\ %P

"------ Behavior ------
set tabstop=4 "tab = 4 spaces
set shiftwidth=4 "Indent to four spaces
set softtabstop=4
set hidden "Switch between unsaved buffers w/o needing to save, preserves history
filetype indent on "Syntax Highlight
filetype plugin on "Needed for snipMate
set autoindent "Autoindent
set expandtab "Use spaces instead of tabs

"------ Searching ------
set incsearch "Search while typing
" set ignorecase "Case Insensitive Searching
set smartcase "Lowercase = case insensitive, any uppercase = case sensitive
set hlsearch "Highlight all search results

"Indent guide
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_guide_size=1

"Ignore these files when completing names
set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif

" F2 = Paste Toggle (in insert mode, pasting indented text behavior changes)
set pastetoggle=<F2>

"------ Plugins ------

" CtrtlP
let g:ctrlp_map = '<Leader>p'

" Hammer
" xdg_open does not work
let g:HammerBrowser = 'chromium'

" localvimrc
let g:localvimrc_ask=0

" NERDTree
let NERDTreeIgnore=['CVS']
let NERDTreeChDirMode=2 "setting root dir in NT also sets VIM's cd
let NERDTreeShowHidden=1

if has("gui_running")
autocmd vimenter * if !argc() | NERDTree | endif
endif

" php-doc
let g:pdv_cfg_Author="Meck <yesmeck@gmail.com>"
let g:pdv_cfg_Copyright="2011 Meck"
let g:pdv_cfg_License=""

" Session
let g:session_autosave = 'no'
55 changes: 3 additions & 52 deletions vimrc
Original file line number Original file line Diff line number Diff line change
@@ -1,60 +1,11 @@
runtime bundle/pathogen/autoload/pathogen.vim "Set runtime runtime bundle/pathogen/autoload/pathogen.vim "Set runtime
call pathogen#infect() "Executes the pathogen plugin, which loads other plugins call pathogen#infect() "Executes the pathogen plugin, which loads other plugins
let mapleader="," "Changes Leader key into a comma instead of a backslash
set nocompatible "Prefents VIM from being nerfed into acting like VI
set viminfo='1000,f1,:1000,/1000
set history=500
" Share clipboard with system
set clipboard=unnamedplus


au FileType php set omnifunc=phpcomplete#CompletePHP source $HOME/.vim/settings/settings.vim


"------ Visual Options ------ source $HOME/.vim/settings/autocmds.vim
set guioptions-=T "remove toolbar
syntax on "Enables syntax highlighting
set nu "Enable Line Numbers
set nowrap "Disable word wrap
set vb "Visual bell instead of beeps
set ruler "Displays cursor position on bottom right of screen
set statusline=%<%f\ %h%m%r%=%{fugitive#statusline()}\ \ %-14.(%l,%c%V%)\ %P


"------ Behavior ------ source $HOME/.vim/settings/keymap.vim
set tabstop=4 "tab = 4 spaces
set shiftwidth=4 "Indent to four spaces
set softtabstop=4
set hidden "Switch between unsaved buffers w/o needing to save, preserves history
filetype indent on "Syntax Highlight
filetype plugin on "Needed for snipMate
set autoindent "Autoindent
set expandtab "Use spaces instead of tabs
"Indent guide
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_guide_size=1
"Ignore these files when completing names
set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif

"------ Searching ------
set incsearch "Search while typing
" set ignorecase "Case Insensitive Searching
set smartcase "Lowercase = case insensitive, any uppercase = case sensitive
set hlsearch "Highlight all search results

" F2 = Paste Toggle (in insert mode, pasting indented text behavior changes)
set pastetoggle=<F2>

" Deletes trailing space in file upon write
autocmd BufWritePre * :%s/\s\+$//e

" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby

" md, markdown, and mk are markdown and define buffer-local preview
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} set ft=markdown

" add json syntax highlighting
au BufNewFile,BufRead *.json set ft=javascript

colorscheme darkblue "Default VIM colorscheme which works in terminals


if filereadable($HOME.'/.vimrc_local') if filereadable($HOME.'/.vimrc_local')
source $HOME/.vimrc_local source $HOME/.vimrc_local
Expand Down

0 comments on commit 33d9237

Please sign in to comment.