diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2017-03-01 14:55:29 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2017-03-01 14:55:29 +0300 |
| commit | 0fd41540d1d55bdc22ff53bd2c2801b6d2d8fd4a (patch) | |
| tree | 5ae6d44fcfa2185d11d3b0ae35fffb06809488dd | |
| parent | eace7e04246c6b56aed1edd78c3f8c9fb7cf4853 (diff) | |
rc: Don't print errors when no buffer backup exist
| -rw-r--r-- | rc/extra/autorestore.kak | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rc/extra/autorestore.kak b/rc/extra/autorestore.kak index 3c6d4720..7bec90ee 100644 --- a/rc/extra/autorestore.kak +++ b/rc/extra/autorestore.kak @@ -8,7 +8,7 @@ def autorestore-restore-buffer -docstring "Restore the backup for the current fi buffer_dirname=$(dirname "${kak_buffile}") ## Find the name of the latest backup created for the buffer that was open - backup_path=$(ls -1t ."${kak_bufname}".kak.* | head -n 1) + backup_path=$(ls -1t ."${kak_bufname}".kak.* 2>/dev/null | head -n 1) if [ -z "${backup_path}" ]; then exit @@ -25,7 +25,7 @@ def autorestore-restore-buffer -docstring "Restore the backup for the current fi hook -group autorestore buffer BufWritePost '${kak_buffile}' %{ nop %sh{ if [ \"\${kak_opt_autorestore_purge_restored}\" = true ]; then - ls -1 '${buffer_dirname}'/.'${buffer_basename}'.kak.* | while read -r f; do + ls -1 '${buffer_dirname}'/.'${buffer_basename}'.kak.* 2>/dev/null | while read -r f; do rm -f \"\${f}\" done fi @@ -45,7 +45,7 @@ def autorestore-purge-backups -docstring "Remove all the backups of the current buffer_basename="${kak_bufname##*/}" buffer_dirname=$(dirname "${kak_bufname}") - ls -1 "${buffer_dirname}"/."${buffer_basename}".kak.* | while read -r f; do + ls -1 "${buffer_dirname}"/."${buffer_basename}".kak.* 2>/dev/null | while read -r f; do rm -f "${f}" done } |
