Skip to content

Commit

Permalink
Prompt to create alternate
Browse files Browse the repository at this point in the history
References #5.
  • Loading branch information
tpope committed Apr 30, 2015
1 parent f9859f8 commit a644b80
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion autoload/projectionist.vim
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,22 @@ function! s:edit_command(cmd, count, ...) abort
return 'echoerr '.string(matchstr(warning, 'replace %.*}').' in alternate projection')
endif
let file = get(filter(copy(alternates), '!empty(getftype(v:val))'), 0, '')
if empty(file)
if empty(alternates)
return 'echoerr "No alternate file"'
elseif empty(file)
let choices = ['Create alternate file?']
let i = 0
for alt in alternates
let i += 1
call add(choices, i.' '.alt)
endfor
let i = inputlist(choices)
if i > 0
let file = get(alternates, i-1, '')
endif
if empty(file)
return ''
endif
endif
endif
if !isdirectory(fnamemodify(file, ':h'))
Expand Down

0 comments on commit a644b80

Please sign in to comment.