Skip to content

Instantly share code, notes, and snippets.

@syui
Created November 3, 2013 09:06
Show Gist options
  • Save syui/7288263 to your computer and use it in GitHub Desktop.
Save syui/7288263 to your computer and use it in GitHub Desktop.
" GistPaste
" Gistへの投稿後、「:GistPaste」で投稿のHTMLタグを貼り付け
" http://nukino.github.com/blog/2012/01/16/gist_vim/
func! s:paste_gist_tag()
let mx = 'http[s]\?://gist.github.com/\([0-9]\+\)'
" +または"レジスタの中身を検索する
let regs = [@+,@"]
for r in regs
let mlist = matchlist(r, mx)
if ( len(mlist) > 2 )
"カーソル行に挿入
exe "normal! O<script src='https://gist.github.com/" . mlist[1] . ".js'></script>"
return
endif
endif
endfunc
command! -nargs=0 GistPaste call <sid>paste_gist_tag()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment