论坛首页 Ruby版 ruby

Aptana Rails IDE可用了

浏览 26120 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
最后更新时间:2007-04-23
"-----------------------------------------------------------------------------
" folding
"-----------------------------------------------------------------------------
set foldenable          " turn on folding
set foldmethod=indent   " make folding indent sensitive
set foldlevel=20       " don't autofold anything, but can still fold manually
set foldopen -=search   " don't open folds when you search into them
set foldopen -=undo     " don't open folds when you undo stuff

"nmap <M-l>  zo
"nmap <M-h>  zc

" Toggle fold state between closed and opened. 
"
" If there is no fold at current line, just moves forward.
" If it is present, reverse it's state.
fun! ToggleFold()
 if foldlevel('.') == 0 
  normal! l
 else
  if foldclosed('.') < 0
   . foldclose
  else
   . foldopen
  endif
 endif
 " Clear status line
 echo
endfun

" Map this function to Space key.
"noremap <space> :call ToggleFold()<CR>




"-----------------------------------------------------------------------------
":make设置
"-----------------------------------------------------------------------------
"set shellpipe=>%s\ 2>&1\ \|\ tee
"set shellpipe=2>&1\|\ tee

"keymapping
map <M-n> :cn<CR>
map <M-p> :cp<CR>
nmap <C-l> :cl<CR>
nmap <S-M-l> :copen<CR>
"nmap <F5> :update<CR><Esc>:make %<CR><CR>:crewind<CR>:cl<CR>
"imap <F5> <ESC>:update<CR><Esc>:make<CR><CR>:crewind<CR>:cl<CR>
nmap <F5> :make %<CR><CR>:crewind<CR>:cl<CR>
imap <F5> <Esc>:make %<CR><CR>:crewind<CR>:cl<CR>


"-----------------------------------------------------------------------------
" html
"-----------------------------------------------------------------------------
if has('autocmd')
    autocmd FileType html,javascript,xml set guifont:新宋体:h10:cGB2312
endif
autocmd FileType html,xhtml nmap <buffer> ;test :0r $VIM/vimfiles/skeleton/html_test.html<CR>
au BufNewFile,BufRead *.xml,*.htm,*.html so $VIM/vimfiles/scripts/XMLFolding.vim


"-----------------------------------------------------------------------------
" plugin - FencView.vim
"-----------------------------------------------------------------------------
if has('autocmd')
    "autocmd BufReadPost * FencAutoDetect
endif

"-----------------------------------------------------------------------------
" plugin - mru.vim (most recently used files)
"-----------------------------------------------------------------------------
let MRU_File = $VIMDATA.'/_vim_mru_files'  " which file to save mru entries
let MRU_Max_Entries = 20                   " max mru entries in _vim_mru_files


"-----------------------------------------------------------------------------
" plugin - favmenu.vim
"-----------------------------------------------------------------------------
let $FAVOURITES = $VIMDATA.'/_vim_fav_files'  " which file to save favorite items

"-----------------------------------------------------------------------------
" plugin - calendar.vim
"-----------------------------------------------------------------------------
let g:calendar_diary = $VIMDATA.'/diary'

"-----------------------------------------------------------------------------
" plugin - sketch.vim
"-----------------------------------------------------------------------------
"noremap <F1> :call ToggleSketch()<CR>
command! Sketch :call ToggleSketch()<CR>


"-----------------------------------------------------------------------------
" plugin - lookupfile.vim
"-----------------------------------------------------------------------------
if filereadable($VIMDATA."/_lookupfile_tags.tag")                "设置tag文件的名字
    let g:LookupFile_TagExpr = '$VIMDATA."/_lookupfile_tags.tag"'
endif
"let g:LookupFile_MinPatLength = 2               "最少输入2个字符才开始查找
"let g:LookupFile_ShowFiller = 0
"let g:LookupFile_PreserveLastPattern = 0        "不保存上次查找的字符串
let g:LookupFile_PreservePatternHistory = 1     "保存查找历史
let g:LookupFile_AllowNewFiles = 0              "不允许创建不存在的文件
let g:LookupFile_AlwaysAcceptFirst = 1         "回车打开第一个匹配项目
" Don't display binary files
let g:LookupFile_FileFilter = '\.class$\|\.o$\|\.obj$\|\.exe$\|\.jar$\|\.zip$\|\.war$\|\.ear$'
"command! WalkPySpace LUWalk D:/Projectes/PythonSpace/
"nmap <C-h><C-p> :WalkPySpace<CR>
nmap <C-h><C-p> :exec "LUWalk"<CR>
command! WalkCur :exec "LUWalk" expand('%:p:h').'/'
nmap <C-h><C-c> :WalkCur<CR>
nmap <C-h><C-b> :LUBufs<CR>


"-----------------------------------------------------------------------------
" plugin - minibufexpl.vim
"-----------------------------------------------------------------------------
let g:miniBufExplTabWrap = 1               " make tabs show complete (no broken on two lines)
let g:miniBufExplModSelTarget = 1


"-----------------------------------------------------------------------------
" plugin - BufExplorer.vim
"-----------------------------------------------------------------------------
nmap <F4> :BufExplorer<CR>



"-----------------------------------------------------------------------------
" plugin - taglist.vim
"-----------------------------------------------------------------------------
let Tlist_Ctags_Cmd = 'D:/Soft/EditTools/ctags56/ctags.exe'
":nmap <silent><F8> :Tlist<cr>
:nmap <silent><F8> :TlistToggle<cr>
let Tlist_Show_Menu=1

let Tlist_Sort_Type = "name"               "order by
let Tlist_Use_Right_Window = 1             "把函数列在右边
let Tlist_Compart_Format = 1               "show small meny
let Tlist_Exist_OnlyWindow = 1             "if you are the last, kill yourself
let Tlist_File_Fold_Auto_Close = 1         "当前不被编辑的文件的方法列表自动折叠起来
let Tlist_Enable_Fold_Column = 0           "do not show folding tree
let Tlist_Show_One_File = 1                "只显示一个文件中的tag

"-----------------------------------------------------------------------------
" plugin - WindowsManager.vim
"-----------------------------------------------------------------------------
nmap <C-F8> :WMToggle<cr>
imap <C-F8> <Esc>:WMToggle<cr>

"-----------------------------------------------------------------------------
" plugin - NERD_tree.vim
"-----------------------------------------------------------------------------
nmap <C-S-F8> :NERDTreeToggle<cr>
imap <C-S-F8> <Esc>:NERDTreeToggle<cr>


"-----------------------------------------------------------------------------
" plugin - Project.vim
"-----------------------------------------------------------------------------
"let loaded_project = 1
"默认项目文件的路径
let g:proj_def_file=$VIMDATA.'_vimprojects'
let g:proj_flags='imstcFg'


"-----------------------------------------------------------------------------
" plugin - Mark.vim
"-----------------------------------------------------------------------------
"nmap <silent> <leader>m <Plug>MarkSet
"vmap <silent> <leader>m <Plug>MarkSet
"nmap <silent> <leader>um <Plug>MarkClear
"vmap <silent> <leader>um <Plug>MarkClear
"nmap <silent> <leader>mr <Plug>MarkRegex
"vmap <silent> <leader>mr <Plug>MarkRegex

"-----------------------------------------------------------------------------
" plguin - NERD_comments.vim    version 1.69.2
"-----------------------------------------------------------------------------
"let NERD_mapleader = ',,'
let g:NERDUncomLineMap=',u'
"let g:NERD_com_line_map=',c'
"let g:NERD_com_line_sexy_map=',cs'



"Automatic jumping to classes
"  set path+=D:/Projectes/RubySpace/depot/app/**
"  set path+=D:/Projectes/RubySpace/depot/lib/**
"  set suffixesadd=.rb
"  set includeexpr+=substitute(v:fname,'s$','','g')
  " or you can add substitution pattern s/ies$/y/g, s/ves$/f/g like this:
  " set includeexpr+=substitute(substitute(substitute(v:fname,'s$','','g'),'ie$','y','g'),'ve$','f','g')


" 轻松编辑相同目录下的文件 vim_tips(2,64)
function! CHANGE_CURR_DIR()
	let _dir = expand("%:p:h")
	exec "cd " . _dir
	unlet _dir
endfunction

autocmd BufEnter * call CHANGE_CURR_DIR()

"if has("unix")
    "map ,e :e <C-R>=expand("%:p:h") . "/" <CR>
"else
    "map ,e :e <C-R>=expand("%:p:h") . "\\" <CR>
"endif


"----------------rails


" This section returns to the last place you were in a file
" When you repoen it. Comment out to disable this behavior
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  \| execute "normal g'\"" | endif
endif

"set textwidth=0     " Don't wrap lines by default
"set pastetoggle=<F6> " F6 will toggle between paste and normal
                      " Insert mode

" Extra For Rails
let g:rubycomplete_rails = 1

" set background=dark " If you have a dark background, uncomment this

" For our local plugins and files
"set runtimepath+=~/.vim

"-------------END rails

"vim ruby omni completion
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading=1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_gloabl = 1

autocmd Filetype ruby source $VIM/vimfiles/scripts/ruby-macros.vim


"source $VIM/vimfiles/scripts/make-element.vim

"au Filetype rhtml,jsp,htm,html,xml,xsl source $VIM/vimfiles/scripts/closetag.vim


"-----------------------------------------------------------------------------
"热键设置KeyBindings,KeyMappings
"-----------------------------------------------------------------------------
:imap <C-s> <ESC>:w<CR>a

"map 

"按ALT+空格最大化当前窗口
nmap <Space> <C-W>\|<C-W>_

" 切换标签栏
:nmap <C-S-tab> :tabprevious<cr>
:nmap <C-tab> :tabnext<cr>
:map <C-S-tab> :tabprevious<cr>
:map <C-tab> :tabnext<cr>
:imap <C-S-tab> <ESC>:tabprevious<cr>i
:imap <C-tab> <ESC>:tabnext<cr>i
":nmap <C-t> :tabnew<cr>
":imap <C-t> <ESC>:tabnew<cr>

" Vim reStructured Text 
"source $VIM/vimfiles/vst.vim

" F12: Call external browser
"map <F12> :silent! !"C:\Program Files\Mozilla Firefox\firefox.exe" % <CR>
"map <A-F12> :silent! !"C:\Program Files\Opera\Opera.exe" %:p <CR>
"map <F12> :silent! !"D:\Soft\Maxthon\Maxthon.exe" %:p <CR>
"map <C-F12> :silent! !"C:\Program Files\Internet Explorer\IEXPLORE.EXE" % <CR>

imap <M-.> <C-n>
imap <M-,> <C-p>
"imap ( ()<LEFT>
"imap [ []<LEFT>
"autocmd FileType java,javascript,html,xhtml imap {<CR> {<CR>}<UP><CR>

"移动行(类似eclipse) 
"from   http://edyfox.codecarver.org/html/_vimrc.html,滇狐,2007-04-12
nmap <M-Down> :<C-U>move .+1<CR>
nmap <M-Up> :<C-U>move .-2<CR>
imap <M-Down> <C-o>:<C-u>move .+1<CR>
imap <M-Up> <C-o>:<C-u>move .-2<CR>
vmap <M-Down> :move '>+1<CR>gv
vmap <M-Up> :move '<-2<CR>gv


"删除行尾多余空格
":nmap <F12> %s= *$==<cr>

"替换反斜杠
amenu &MyCommand.反转斜杠 :%s=\\=/=gc<cr>
amenu &MyCommand.删除行尾空格 :%s= *$==<CR>
"amenu &MyCommand.删除行尾空格 :%s/\s+$//<CR>
"显示当前变量的定义
nmap <silent> <F3>  [I
"查找本函数调用的函数
"nmap <silent> <F7>  :cs find d <C-R>=expand("<cword>")<CR><CR>
"查找调用指定函数的函数
"nmap <silent> <F8>  :cs find c <C-R>=expand("<cword>")<CR><CR>


" 自动改变工作目录  use :h autochdir"
set autochdir

"按HOME键时光标移动到第一个非空字符
imap <HOME> <ESC>^i
nmap <HOME> ^
vmap <HOME> ^

"command OpenWithTC !"D:\Soft\Totalcmd6.51\TOTALCMD.EXE /O /T /R=%"



"--------------------Java [START]--------------------
"autocmd BufRead *.java set include=^#\s*import
"autocmd BufRead *.java set includeexpr=substitute(v:fname,'\\.','/','g')
autocmd FileType java setlocal include=^#\s*import
autocmd FileType java setlocal includeexpr=substitute(v:fname,'\\.','/','g')



""-----------------------------------------------------------------------------
"" plugin - vjde.vim
""-----------------------------------------------------------------------------
"let java_class_path_myjava = '.;..;D:\JavaLib\Servlet\servlet-api.jar;D:\JavaLib\Servlet\jsp-api.jar'
"let java_class_path_myjava += 'C:\jdk1.6.0\jre\lib\ext\jai_codec.jar'
"let java_class_path_myjava += 'C:\jdk1.6.0\jre\lib\ext\jai_core.jar'
"let java_class_path_myjava += 'C:\jdk1.6.0\jre\lib\ext\jai_imageio.jar'
""vjed设置
"let java_highlight_all=1
"let java_highlight_functions="style"
""let java_allow_cpp_keywords=1
""启用或者禁用java在用户输入括号后自动提示参数
"let g:vjde_cfu_java_para=1
"let g:vjde_show_paras = 1
""启用或者禁用 用户在用<c-x> <c-u>时显示预览
"let g:vjde_show_preview=0
""启用或者禁用 在用户输入 . 时自动提示后面的部分
""let g:vjde_cfu_java_dot=0
""启用或才禁用 使用一个图形化的提示窗口.(不推荐,太难看)
""let g:vjde_preview_gui=1
""以下做为c++使用
""let g:vjde_iab_exts='.cpp;.c;.vim;.rb'
""
"""对指定名字的窗口进行调整,如下表示:
"""对以__Tag_List__为标题的窗口,在垂直方向变化,进入时40宽,离开后变成20宽
"""对以.prj为标题的窗口,在垂直方向变化,进入时24宽,离开后变为1
""let g:floatingwindows="'__Tag_List__',1,40,20;'.prj',1,24,1;'.vimproject',1,24,1;"
""
"let g:vjde_completion_key='<C-M-.>'
"autocmd FileType java setlocal cfu=VjdeCompletionFun
""
""if !exists('g:vjde_iab_refs')
""   let g:vjde_iab_refs={}
""endif
""if !has_key(g:vjde_iab_refs,'jsp')
""   let g:vjde_iab_refs['jsp']=[ 'java', 'html' ]
""endif
""if !has_key(g:vjde_iab_refs,'cpp')
""   let g:vjde_iab_refs['cpp']=[ 'c' ]
""endif
"""javadoc
"let g:vjde_javadoc_path='C:/jdk1.5.0/docs/api'
"let g:vjde_lib_path=java_class_path_myjava
""--------------------Java [END]--------------------


""-----------------------------------------------------------------------------
"" plugin - javacomplete.vim
""-----------------------------------------------------------------------------
"if has("autocmd")
    "autocmd FileType java setlocal omnifunc=javacomplete#Complete
"endif
"let g:java_classpath = java_class_path_myjava


"-----------------------------------------------------------------------------
" plugin - html.zip
"-----------------------------------------------------------------------------
let g:do_xhtml_mappings='yes'
let g:no_html_toolbar = 'yes'   "不显示工具栏
let g:no_html_tab_mapping='yes'
let g:html_tag_case = "lowercase"    "标签为小写
let g:html_template='D:\Soft\EditTools\Vim\vimfiles\skeleton\template.html'
let g:html_authorname  = 'yfmine'
let g:html_authoremail = 'test@ttttt.com'
let g:html_charset='GBK'
let g:html_internet_explorer='D:\Soft\Maxthon\Maxthon.exe'


"--------------------python START--------------------
let g:pydoc_cmd='E:/Python24/Lib/pydoc.py'  "pydoc.vim

if has("autocmd")
    autocmd BufWinLeave *.py mkview
    autocmd BufWinEnter *.py silent loadview
    "设置python的万能补全
    autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
    "设置pydiction(python的字典)
    "autocmd FileType python setlocal complete+=k$VIM/vimfiles/scripts/pydiction
    "设置Python_Calltips插件
    autocmd FileType python setlocal iskeyword+=.,(
    "autocmd FileType python setlocal iskeyword+=.
    "设置输入点(.)时,自动弹出函数菜单
    autocmd FileType python imap <buffer> . .<C-X><C-O><C-P>
    "设置gf,]I等命令时的文件名后缀
    autocmd FileType python setlocal suffixesadd+=.py
"  set includeexpr+=substitute(v:fname,'s$','','g') "设置如何转换路径
    "autocmd FileType python set expandtab       "输入tab时自动将其转化为空格

    autocmd BufWrite *.py setlocal fileencoding=utf-8

  " Python Unittest 的一些设置
  " 可以让我们在编写 Python 代码及 unittest 测试时不需要离开 vim
  " 键入 :make 或者点击 gvim 工具条上的 make 按钮就自动执行测试用例
    autocmd BufNewFile,BufRead test*.py,*test.py,*Test.py <buffer> compiler pyunit
  "autocmd FileType python setlocal makeprg=python\ ./alltests.py
  "autocmd BufNewFile,BufRead test*.py setlocal makeprg=python\ %
  "autocmd FileType python compiler pyunit
    autocmd FileType python compiler python
    "autocmd FileType python setlocal makeprg=python\ %

    "the last line: \%-G%.%# is meant to suppress some
    "late error messages that I found could occur e.g.
    "with wxPython and that prevent one from using :clast
    "to go to the relevant file and line of the traceback.
  "autocmd FileType python  setlocal errorformat=
        "\%A\ \ File\ \"%f\"\\\,\ line\ %l\\\,%m,
        "\%C\ \ \ \ %.%#,
        "\%+Z%.%#Error\:\ %.%#,
        "\%A\ \ File\ \"%f\"\\\,\ line\ %l,
        "\%+C\ \ %.%#,
        "\%-C%p^,
        "\%Z%m,
        "\%-G%.%#
  
  " 自动使用新文件模板(0r表示读取文件到第一行)
  autocmd BufNewFile test*.py 0r $VIM/vimfiles/skeleton/test.py
  autocmd BufNewFile alltests.py 0r $VIM/vimfiles/skeleton/alltests.py
  autocmd BufNewFile *.py 0r $VIM/vimfiles/skeleton/skeleton.py
    "在普通模式下按下,py热键时,在文件中插入模板
  autocmd FileType python nmap ,py :0r $VIM/vimfiles/skeleton/skeleton.py<CR>
    


  "autocmd BufRead *.py set errorformat=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m 
  autocmd FileType python nmap <buffer> <S-F5> :!start python %<cr>
  autocmd FileType python amenu &Python.&Run<tab>Shift-F5 :!start python %<cr>
    autocmd FileType python noremap <buffer><M-F5> :call CheckPythonSyntax()<CR>:cl<CR>
    autocmd FileType python amenu <silent>&Python.Check\ Syntax<Tab>ALT+F5 <M-F5>
  "autocmd FileType python nmap <buffer> <F5>  :w<esc>mwG:r!python %<CR>`.
  autocmd FileType python setlocal tabstop=4

endif

function! CheckPythonSyntax()
  let curfile = bufname("%")
  exec ":make " . "-c " . "\"import py_compile; py_compile.compile(r'" . bufname("%") . "')\""
endfunction

"--------------------Python [END]--------------------


"-----------------------------------------------------------------------------
" FreeMarker
"-----------------------------------------------------------------------------
au BufNewFile,BufRead *.ftl     setf ftl


"-----------------------------------------------------------------------------
" plugin - savevers.vim
"-----------------------------------------------------------------------------
"set patchmode=.clean
"exe "set backupskip+=*" . &patchmode
"exe "set suffixes+=" . &patchmode
"exe "set wildignore+=*" . &patchmode
"let savevers_max = 99
"let savevers_types="*.html,*.js,*.java,*.py,_vimrc,*.vim"
"let savevers_dirs = $VIMDATA.'/old_versions'


"快速打开常用文件
:nmap ,vc :tabnew $VIM/_vimrc<CR>
:nmap ,ho :tabnew C:\WINDOWS\system32\drivers\etc\hosts<CR>
:nmap ,t6 :tabnew D:\Tomcat6\conf\server.xml<CR>
:nmap ,t5 :tabnew D:\Tomcat5.5\conf\server.xml<CR>

"set path+="D:/EclipseWorkSpace/Eclipse3.1/yyweb"


"时间戳
iab xdate <c-r>=strftime("%c")<cr>

"set warp时,使用上下方向可以直接移动vim_tips_38

nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk

"tags
let Tmenu_ctags_cmd  = 'D:/Soft/EditTools/ctags56/ctags.exe'
let TE_Ctags_Path  = 'D:/Soft/EditTools/ctags56/ctags.exe'
set tags +=$VIMDATA/tags/java1.5.tags

"光标颜色
"set guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver15-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175/Cursor

"-----------------------------------------------------------------------------
" plugin - matchit.vim
"-----------------------------------------------------------------------------
let b:match_ignorecase = 1


"-----------------------------------------------------------------------------
" plugin - timestamp.vim
"-----------------------------------------------------------------------------
let g:timestamp_regexp = '\v\C%(<Last %([cC]hanged?|[Mm]odified):\s+)@<=.*$'
let g:timestamp_rep = '%w %Y-%m-%d %H:%M:%S #u@#h:#f'
let g:timestamp_username='yfmine'
augroup TimeStampHtml
  au filetype html let b:timestamp_regexp = '\v\C%(\<!-- Timestamp:\s{-1,})@<=.{-}%(\s*--\>)@='
  au filetype html let b:timestamp_rep = '%a %d/%m/%Y %r #u@#h:#f'
augroup END


"-----------------------------------------------------------------------------
" SnippetsEmu.vim
"-----------------------------------------------------------------------------
let g:snip_set_textmate_cp = 1
let g:snip_start_tag = "%{"
let g:snip_end_tag = "}"
hi SnippetHighlight term=reverse cterm=bold ctermfg=7 ctermbg=1 guifg=#000000 guibg=#E3E3E3


""-----------------------------------------------------------------------------
"" EnhancedCommentify.vim
""-----------------------------------------------------------------------------
"let g:EnhCommentifyUserMode = 'Yes'     "避免'g:EnhCommentifyTraditionalMode中自动猜测注释与反注释

""样式选项
"let g:EnhCommentifyRespectIndent = 'Yes'  "设置注释跟随缩进
""let g:EnhCommentifyPretty = 'Yes'  "让注释更好看,比如在/*后加一个空格
"let g:EnhCommentifyUseBlockIndent = 'Yes'    "缩进注释中的代码?
"let g:EnhCommentifyAlignRight = 'Yes'   "注释的右边对齐

""热键选项
""let g:EnhCommentifyUseAltKeys = 'Yes'   "设置<M-C>代替<Leader>C,如:ALT+C ==> \c
"let g:EnhCommentifyBindInNormal = 'Yes'
"let g:EnhCommentifyBindInInsert = 'Yes'
"let g:EnhCommentifyBindInVisual = 'Yes'

""key-bindings
""nmap ,c <Plug>Comment
""nmap ,u <Plug>DeComment
""vmap ,c <Plug>Comment
""vmap ,u <Plug>DeComment
""imap <M-c> <Esc><Plug>Commenti
""imap <M-u> <Esc><Plug>DeCommenta


""-----------------------------------------------------------------------------
"" plugin - tabbar.vim
""-----------------------------------------------------------------------------
""Tabbar窗口最大为1行
"let g:Tb_MaxSize=1
""总是打开Tabbar
"let g:Tb_MoreThanOne=0
""鼠标单击打开Tabbar
"let g:Tb_UseSingleClick=1


"
""--------------------EvalSelection.vim [START]------------------------------
""使用说明
""\eyp把当前选择的文本作为python(y)代码运行,并print(p)出来.
""\xl运行当前选择的文本(根据filetype自动确定语言),并输出到日志(l)
"":h EvalSelection-KeyBindings
"let g:evalSelectionRubyDir=$VIM."/vimfiles/ruby/"
"let g:evalSelectionAutoLeader     = '<Leader>xx'
""--------------------EvalSelection.vim [END]------------------------------

""--------------------TVO.vim(otl) [START]------------------------------
"let g:otl_install_menu = 0  "不安装TVO的菜单,当前会报错,BUG?
""let g:otl_map_tabs = 1  "使用<TAB>,<S-TAB>来升降等级
"autocmd FileType otl let maplocalleader = ","
""--------------------TVO.vim(otl) [END]--------------------------------



"html里删除&bsp;
augroup Foo
  autocmd FileType html,xhtml,xml
   \ inoremap <Buffer> <BS> x<Esc>:call SmartBS('&[^ \t;]*;')<CR>a<BS><BS>
augroup END
fun! SmartBS(pat)
  let init = strpart(getline("."), 0, col(".")-1)
  let len = strlen(matchstr(init, a:pat . "$")) - 1
  if len > 0
    execute "normal!" . len . "X"
  endif
endfun

"-----------------------------------------------------------------------------
"常用单词纠错
"-----------------------------------------------------------------------------
iabbrev sytle style

   
0 请登录后投票
最后更新时间:2007-04-23
太棒了,这句不要colorscheme myeditplus,换成喜欢的配色方案就好了。
   
0 请登录后投票
最后更新时间:2007-04-23
myeditplus是自己仿造editplus的配色搞出来的,但是只做了GUI部分,等哪天完善一下发上来。。。
   
0 请登录后投票
最后更新时间:2007-04-25
呵呵 ,俺的,都忘了从那复制的了.自己也稍微的修改了下.常用的插件的话,到vim.org上去找就行了,嘿嘿.

" vim:shiftwidth=2:tabstop=8:expandtab

if has('autocmd')
  " Remove ALL autocommands for the current group


  " Mark .asm files MASM-type assembly
  au BufNewFile,BufReadPre *.asm let b:asmsyntax='masm'
endif

"pydiction
if has('autocmd')
  autocmd FileType python set complete+=k/usr/share/vim/vim70/tools/pydiction iskeyword+=.,(
endif

if has('gui_running')
  let do_syntax_sel_menu=1
endif

if has('gui_running') && $LANG !~ '\.'
  set encoding=utf-8
endif

set nocompatible
source $VIMRUNTIME/vimrc_example.vim

set autoindent
set nobackup
set showmatch
set formatoptions+=mM
set fileencodings=ucs-bom,utf-8,gbk
set statusline=%<%f\ %h%m%r%=%k[%{(&fenc==\"\")?&enc:&fenc}%{(&bomb?\",BOM\":\"\")}]\ %-14.(%l,%c%V%)\ %P
if has('mouse')
  set mouse=a
endif
if has('multi_byte') && v:version > 601
  if v:lang =~? '^\(zh\)\|\(ja\)\|\(ko\)'
    set ambiwidth=double
  endif
endif

" Key mappings to ease browsing long lines
noremap <C-J> gj
noremap <C-K> gk
noremap <Down> gj
noremap <Up> gk
inoremap <Down> <C-O>gj
inoremap <Up> <C-O>gk

" Key mappings for quick arithmetic inside Vim
nnoremap <silent> <Leader>ma yypV:!calcu '<C-R>"'<CR>k$
vnoremap <silent> <Leader>ma yo<ESC>pV:!calcu '<C-R>"'<CR>k$
nnoremap <silent> <Leader>mr yyV:!calcu '<C-R>"'<CR>$
vnoremap <silent> <Leader>mr ygvmaomb:r !calcu '<C-R>"'<CR>"ay$dd`bv`a"ap

" Key mapping to stop the search highlight
nmap <silent> <F2> :nohlsearch<CR>
imap <silent> <F2> <C-O>:nohlsearch<CR>

" Key mapping for the taglist.vim plugin
nmap <F9> :Tlist<CR>
imap <F9> <C-O>:Tlist<CR>

" Key mappings for the quickfix commands
nmap <F11> :cn<CR>
nmap <F12> :cp<CR>

" Non-GUI setting
if !has('gui_running')
  " Do not increase the windows width in the taglist.vim plugin
  if has('eval')
    let Tlist_Inc_Winwidth=0
  endif

  " Set text-mode menu
  if has('wildmenu')
    set wildmenu
    set cpoptions-=<
    set wildcharm=<C-Z>
    nmap <F10> :emenu <C-Z>
    imap <F10> <C-O>:emenu <C-Z>
  endif
endif


if has('autocmd')
  function! SetFileEncodings(encodings)
    let b:my_fileencodings_bak=&fileencodings
    let &fileencodings=a:encodings
  endfunction

  function! RestoreFileEncodings()
    let &fileencodings=b:my_fileencodings_bak
    unlet b:my_fileencodings_bak
  endfunction

  function! CheckFileEncoding()
    if &modified && &fileencoding != ''
      exec 'e! ++enc=' . &fileencoding
    endif
  endfunction

  function! ConvertHtmlEncoding(encoding)
    if a:encoding ==? 'gb2312'
      return 'gbk' " GB2312 imprecisely means GBK in HTML
    elseif a:encoding ==? 'iso-8859-1'
      return 'latin1' " The canonical encoding name in Vim
    elseif a:encoding ==? 'utf8'
      return 'utf-8' " Other encoding aliases should follow here
    else
      return a:encoding
    endif
  endfunction

 function! DetectHtmlEncoding()
    if &filetype != 'html'
      return
    endif
    normal m`
    normal gg
    if search('\c<meta http-equiv=\("\?\)Content-Type\1 content="text/html; charset=[-A-Za-z0-9_]\+">') != 0
      let reg_bak=@"
      normal y$
      let charset=matchstr(@", 'text/html; charset=\zs[-A-Za-z0-9_]\+')
      let charset=ConvertHtmlEncoding(charset)
      normal ``
      let @"=reg_bak
      if &fileencodings == ''
        let auto_encodings=',' . &encoding . ','
      else
        let auto_encodings=',' . &fileencodings . ','
      endif
      if charset !=? &fileencoding &&
            \(auto_encodings =~ ',' . &fileencoding . ',' || &fileencoding == '')
        silent! exec 'e ++enc=' . charset
      endif
    else
      normal ``
    endif
  endfunction

  function! GnuIndent()
    setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
    setlocal shiftwidth=2
    setlocal tabstop=8
  endfunction

  function! RemoveTrailingSpace()
    if $VIM_HATE_SPACE_ERRORS != '0' &&
          \(&filetype == 'c' || &filetype == 'cpp' || &filetype == 'vim')
      normal m`
      silent! :%s/\s\+$//e
      normal ``
    endif
  endfunction

  " Highlight space errors in C/C++ source files (Vim tip #935)
  if $VIM_HATE_SPACE_ERRORS != '0'
    let c_space_errors=1
  endif

  " Use Canadian spelling convention in engspchk (Vim script #195)
  let spchkdialect='can'

  " Show syntax highlighting attributes of character under cursor (Vim
  " script #383)
  map <Leader>a :call SyntaxAttr()<CR>

  " Automatically find scripts in the autoload directory
  au FuncUndefined * exec 'runtime autoload/' . expand('<afile>') . '.vim'

  " File type related autosetting
  au FileType c,cpp setlocal cinoptions=:0,g0,(0,w1 shiftwidth=4 tabstop=4
  au FileType diff setlocal shiftwidth=4 tabstop=4
  au FileType html setlocal autoindent indentexpr=
  au FileType changelog setlocal textwidth=76

  "python plugin
  au FileType python source /usr/share/vim/vim70/plugin/python.vim

  " Text file encoding autodetection
  au BufReadPre *.gb call SetFileEncodings('gbk')
  au BufReadPre *.big5 call SetFileEncodings('big5')
  au BufReadPre *.nfo call SetFileEncodings('cp437')
  au BufReadPost *.gb,*.big5,*.nfo call RestoreFileEncodings()
  au BufWinEnter *.txt call CheckFileEncoding()

  " Detect charset encoding in an HTML file
  au BufReadPost *.htm* nested call DetectHtmlEncoding()

  " Recognize standard C++ headers
  au BufEnter /usr/include/c++/* setf cpp
  au BufEnter /usr/include/g++-3/* setf cpp

  " Setting for files following the GNU coding standard
  au BufEnter /usr/* call GnuIndent()

  " Remove trailing spaces for C/C++ and Vim files
  au BufWritePre * call RemoveTrailingSpace()
endif
"me add
"autocmd BufNewFile *.c exec append(0,"/* */")|exec append(1,"#include <stdio.h>") |exec append(2,"int main(void)")|exec append(3,"{")|exec append(5," return 0;")|exec append(6,"}")| exec ':0'
autocmd BufNewFile *.pl exec append(0,"#!/usr/bin/perl -w") | exec append(1,"use strict;") | exec append(2,"use warnings;") | exec ':$'
"autocmd BufNewFile *.py 0r ~/.vim/skeleton/skeleton.py
map <F3> ^i#<ESC>
map <F4> ^x
set viminfo='200,\"500
set history=500
set number
   
0 请登录后投票
最后更新时间:2007-04-25
感觉和radrails差不多,代码提示也还没有。
   
0 请登录后投票
最后更新时间:2007-04-25
还是不如netbeans。在netbeans下 你打个3.按Ctrl+\所有的方法都出来了,还有例子。在netbeans下还有实时的语法分析。错了的会指出来。目前netbeans一是不稳定,二是对rhtml支持不好。期待netbeans 6.0的最终版。只要好用就是多加2G的内存又算得了什么。vim适合对rails已经很了解的人。
   
0 请登录后投票
最后更新时间:2007-04-27
不如先使用着Radrails,发现这个新的IDE在RHTML过份复杂时,并不能用RHTML编辑器来显示,而且还没有代码辅助,要使用Rails时,还要下插件升级,显示的是超级Alpha版,:)
   
0 请登录后投票
最后更新时间:2007-05-15
使用了下,发现新建rails工程只会生成.loadpath和.project文件,rhtml的支持还是老样子,貌似今天使用时提示我有升级,但是网络不好,没更新成功。

看来暂时还是只能使用radrails。netbeans要2G内存吗?

还有,大家在编辑rhtml时,默认没有html标签的自动提示,大家是怎么设置的?
   
0 请登录后投票
最后更新时间:2007-05-16
好像RADRAILS的插件已经到0.8了,代码提示默认的是ctrl+space,和输入法热键有些冲突,需要设置一下,改成习惯的alt+/的方式。
   
0 请登录后投票
最后更新时间:2007-05-17
你们也是这样啊,我新建rails工程也只生成.loadpath和.project文件
原来是想jruby的.现在应该不是这个问题了
   
0 请登录后投票
论坛首页 Ruby版 ruby

跳转论坛:
JavaEye推荐