Detect when user cancels input field in Vim -


i'm writing custom function within vim , asking user choose file rename:

let b:newname = input('rename to: ', expand('%'))

however, should user decide not rename file , press esc, how 1 detect within vim function?

if use cancels operation, input returns empty value. can check directly empty():

if empty(b:newname)     " either cancelled or empty answer endif 

Comments