Skip to content

Instantly share code, notes, and snippets.

@nukino
Created January 13, 2012 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukino/1606941 to your computer and use it in GitHub Desktop.
Save nukino/1606941 to your computer and use it in GitHub Desktop.
[20120114-0021]_vimrc/OctopressにGist-tag貼り付け
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{% gist " . mlist[1] . " %}"
return
endif
endif
endfunc
"コマンド
command! -nargs=0 PasteGist call <SID>paste_gist_tag()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment