Skip to content

Commit 22eeb3a

Browse files
committed
Rename with ':Gist -e newname'. Close #177
1 parent 340638a commit 22eeb3a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

autoload/gist.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,10 @@ endfunction
483483
function! s:GistUpdate(content, gistid, gistnm, desc) abort
484484
let gist = { "id": a:gistid, "files" : {}, "description": "","public": function('webapi#json#true') }
485485
if exists('b:gist')
486+
if has_key(b:gist, 'filename') && len(a:gistnm) > 0
487+
let gist.files[b:gist.filename] = { "content": '', "filename": b:gist.filename }
488+
let b:gist.filename = a:gistnm
489+
endif
486490
if has_key(b:gist, 'private') && b:gist.private | let gist['public'] = function('webapi#json#false') | endif
487491
if has_key(b:gist, 'description') | let gist['description'] = b:gist.description | endif
488492
if has_key(b:gist, 'filename') | let filename = b:gist.filename | endif
@@ -761,8 +765,10 @@ function! gist#Gist(count, bang, line1, line2, ...) abort
761765
elseif arg =~# '^\(-d\|--delete\)$\C' && gistidbuf !=# ''
762766
let gistid = gistidbuf
763767
let deletepost = 1
764-
elseif arg =~# '^\(-e\|--edit\)$\C' && gistidbuf !=# ''
765-
let gistid = gistidbuf
768+
elseif arg =~# '^\(-e\|--edit\)$\C'
769+
if gistidbuf !=# ''
770+
let gistid = gistidbuf
771+
endif
766772
let editpost = 1
767773
elseif arg =~# '^\(+1\|--star\)$\C' && gistidbuf !=# ''
768774
let auth = s:GistGetAuthHeader()

0 commit comments

Comments
 (0)