chrisbra / Recover.vim

A Plugin to show a diff, whenever recovering a buffer
http://www.vim.org/scripts/script.php?script_id=3068
247 stars 25 forks source link

Fix use of execute() to get swapname #69

Closed shanesmith closed 3 years ago

shanesmith commented 3 years ago

The output of execute('swapname') includes a leading newline character which makes the swapinfo() call later on fail. Fixed by trimming the output.

:echo execute('swapname')

/path/to/afile.swp
:echo swapinfo(execute('swapname'))
{'error': 'Cannot open file'}
:echo swapinfo(trim(execute('swapname')))
{'pid': 1234, [...]}
chrisbra commented 3 years ago

thanks!