mirror of
https://github.com/amix/vimrc
synced 2025-06-30 03:44:59 +08:00
Updated plugins
This commit is contained in:
@ -87,6 +87,10 @@ For the latest version please see https://github.com/mattn/vim-gist.
|
||||
|
||||
:Gist -l mattn
|
||||
|
||||
- Specify the number of gists listed:
|
||||
|
||||
:Gist -l -n 100
|
||||
|
||||
- List everyone's gists.
|
||||
|
||||
:Gist -la
|
||||
@ -188,6 +192,10 @@ You need to either set global git config:
|
||||
|
||||
$ git config --global github.user Username
|
||||
|
||||
If you want to list more than 30 gists per page (maximum is 100):
|
||||
|
||||
let g:gist_per_page_limit = 100
|
||||
|
||||
## License:
|
||||
|
||||
Copyright 2010 by Yasuhiro Matsumoto
|
||||
|
@ -171,7 +171,7 @@ endfunction
|
||||
|
||||
" Note: A colon in the file name has side effects on Windows due to NTFS Alternate Data Streams; avoid it.
|
||||
let s:bufprefix = 'gist' . (has('unix') ? ':' : '_')
|
||||
function! s:GistList(gistls, page) abort
|
||||
function! s:GistList(gistls, page, pagelimit) abort
|
||||
if a:gistls ==# '-all'
|
||||
let url = g:gist_api_url.'gists/public'
|
||||
elseif get(g:, 'gist_show_privates', 0) && a:gistls ==# 'starred'
|
||||
@ -196,9 +196,11 @@ function! s:GistList(gistls, page) abort
|
||||
exec 'silent noautocmd split' s:bufprefix.a:gistls
|
||||
endif
|
||||
endif
|
||||
|
||||
let url = url . '?per_page=' . a:pagelimit
|
||||
if a:page > 1
|
||||
let oldlines = getline(0, line('$'))
|
||||
let url = url . '?page=' . a:page
|
||||
let url = url . '&page=' . a:page
|
||||
endif
|
||||
|
||||
setlocal modifiable
|
||||
@ -527,7 +529,7 @@ function! s:GistListAction(mode) abort
|
||||
return
|
||||
endif
|
||||
if line =~# '^more\.\.\.$'
|
||||
call s:GistList(b:gistls, b:page+1)
|
||||
call s:GistList(b:gistls, b:page+1, g:gist_per_page_limit)
|
||||
return
|
||||
endif
|
||||
endfunction
|
||||
@ -761,6 +763,8 @@ function! gist#Gist(count, bang, line1, line2, ...) abort
|
||||
let editpost = 0
|
||||
let anonymous = get(g:, 'gist_post_anonymous', 0)
|
||||
let openbrowser = 0
|
||||
let setpagelimit = 0
|
||||
let pagelimit = g:gist_per_page_limit
|
||||
let listmx = '^\%(-l\|--list\)\s*\([^\s]\+\)\?$'
|
||||
let bufnamemx = '^' . s:bufprefix .'\(\zs[0-9a-f]\+\ze\|\zs[0-9a-f]\+\ze[/\\].*\)$'
|
||||
if strlen(g:github_user) == 0 && anonymous == 0
|
||||
@ -788,6 +792,14 @@ function! gist#Gist(count, bang, line1, line2, ...) abort
|
||||
elseif arg =~# '^\(-G\|--gitclone\)$\C' && gistidbuf !=# '' && g:gist_api_url ==# 'https://api.github.com/' && has_key(b:, 'gist') && has_key(b:gist, 'id')
|
||||
exe '!' printf('git clone git@github.com:%s', b:gist['id'])
|
||||
return
|
||||
elseif setpagelimit == 1
|
||||
let setpagelimit = 0
|
||||
let pagelimit = str2nr(arg)
|
||||
if pagelimit < 1 || pagelimit > 100
|
||||
echohl ErrorMsg | echomsg 'Page limit should be between 1 and 100: '.arg | echohl None
|
||||
unlet args
|
||||
return 0
|
||||
endif
|
||||
elseif arg =~# '^\(-la\|--listall\)$\C'
|
||||
let gistls = '-all'
|
||||
elseif arg =~# '^\(-ls\|--liststar\)$\C'
|
||||
@ -868,6 +880,14 @@ function! gist#Gist(count, bang, line1, line2, ...) abort
|
||||
endif
|
||||
elseif arg =~# '^\(-b\|--browser\)$\C'
|
||||
let openbrowser = 1
|
||||
elseif arg =~# '^\(-n\|--per-page\)$\C'
|
||||
if len(gistls) > 0
|
||||
let setpagelimit = 1
|
||||
else
|
||||
echohl ErrorMsg | echomsg 'Page limit can be set only for list commands'.arg | echohl None
|
||||
unlet args
|
||||
return 0
|
||||
endif
|
||||
elseif arg !~# '^-' && len(gistnm) == 0
|
||||
if gistdesc !=# ' '
|
||||
let gistdesc = matchstr(arg, '^\s*\zs.*\ze\s*$')
|
||||
@ -904,7 +924,7 @@ function! gist#Gist(count, bang, line1, line2, ...) abort
|
||||
endif
|
||||
|
||||
if len(gistls) > 0
|
||||
call s:GistList(gistls, 1)
|
||||
call s:GistList(gistls, 1, pagelimit)
|
||||
elseif len(gistid) > 0 && editpost == 0 && deletepost == 0
|
||||
call s:GistGet(gistid, clipboard)
|
||||
else
|
||||
|
@ -102,6 +102,8 @@ USAGE *:Gist* *vim-gist-usage*
|
||||
|
||||
:Gist -l
|
||||
:Gist --list
|
||||
:Gist -l -n 100
|
||||
:Gist --list --per-page 100
|
||||
<
|
||||
- List gists from user "mattn". >
|
||||
|
||||
@ -201,6 +203,10 @@ If you want to open gist list/buffer as vertical split: >
|
||||
|
||||
let g:gist_list_vsplit = 1
|
||||
|
||||
If you want to list more than 30 gists per page (maximum is 100):
|
||||
|
||||
let g:gist_per_page_limit = 100
|
||||
|
||||
If you want to modify filetype for the file on github, or add mapping of
|
||||
filetype/file-extension: >
|
||||
|
||||
|
@ -12,12 +12,13 @@ endif
|
||||
let g:loaded_gist_vim = 1
|
||||
|
||||
function! s:CompleteArgs(arg_lead,cmdline,cursor_pos)
|
||||
return filter(copy(["-p", "-P", "-a", "-m", "-e", "-s", "-d", "+1", "-1", "-f", "-c", "-l", "-la", "-ls", "-b",
|
||||
return filter(copy(["-p", "-P", "-a", "-m", "-e", "-s", "-d", "+1", "-1", "-f", "-c", "-l", "-la", "-ls", "-b", "-n",
|
||||
\ "--listall", "--liststar", "--list", "--multibuffer", "--private", "--public", "--anonymous", "--description", "--clipboard",
|
||||
\ "--rawurl", "--delete", "--edit", "--star", "--unstar", "--fork", "--browser"
|
||||
\ "--rawurl", "--delete", "--edit", "--star", "--unstar", "--fork", "--browser", "--per-page"
|
||||
\ ]), 'stridx(v:val, a:arg_lead)==0')
|
||||
endfunction
|
||||
|
||||
let g:gist_per_page_limit = get(g:, 'gist_per_page_limit', 30)
|
||||
command! -nargs=? -range=% -bang -complete=customlist,s:CompleteArgs Gist :call gist#Gist(<count>, "<bang>", <line1>, <line2>, <f-args>)
|
||||
|
||||
" vim:set et:
|
||||
|
Reference in New Issue
Block a user