Skip to content

Commit

Permalink
Merge pull request ma6174#37 from androidyue/support_ruby
Browse files Browse the repository at this point in the history
Auto add ruby hashbang when creating .rb files
  • Loading branch information
ma6174 committed Aug 19, 2014
2 parents c5826f4 + 509f3f8 commit 32b1310
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ nmap tt :%s/\t/ /g<CR>
"""""新文件标题
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java,*.py exec ":call SetTitle()"
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.rb,*.java,*.py exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
"如果文件类型为.sh文件
Expand All @@ -121,7 +121,13 @@ func SetTitle()
elseif &filetype == 'python'
call setline(1,"#!/usr/bin/env python")
call append(line("."),"# coding=utf-8")
call append(line(".")+1, "")
call append(line(".")+1, "")

elseif &filetype == 'ruby'
call setline(1,"#!/usr/bin/env ruby")
call append(line("."),"# encoding: utf-8")
call append(line(".")+1, "")

" elseif &filetype == 'mkd'
" call setline(1,"<head><meta charset=\"UTF-8\"></head>")
else
Expand Down

0 comments on commit 32b1310

Please sign in to comment.