From ca19762e58533c6d7c7b25d7fcc41dc7ea898b3e Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 18 Sep 2015 10:25:07 +0900 Subject: [PATCH] Exit status 130 when fzf is terminated by the user Related: #345 --- plugin/fzf.vim | 5 +++-- src/constants.go | 7 ++++--- src/terminal.go | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index e6aecf4..d9ced8e 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -228,10 +228,11 @@ function! s:execute(dict, command, temps) execute 'silent !'.command redraw! if v:shell_error - " Do not print error message on exit status 1 - if v:shell_error > 2 + " Do not print error message on exit status 1 (no match) or 130 (interrupt) + if v:shell_error == 2 echohl ErrorMsg echo 'Error running ' . command + echohl None endif return [] else diff --git a/src/constants.go b/src/constants.go index 9a4fc29..1cc4f81 100644 --- a/src/constants.go +++ b/src/constants.go @@ -49,7 +49,8 @@ const ( ) const ( - exitOk = 0 - exitNoMatch = 1 - exitError = 2 + exitOk = 0 + exitNoMatch = 1 + exitError = 2 + exitInterrupt = 130 ) diff --git a/src/terminal.go b/src/terminal.go index 5e8300f..9a92ba4 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -791,7 +791,7 @@ func (t *Terminal) Loop() { exit(exitNoMatch) case reqQuit: C.Close() - exit(exitError) + exit(exitInterrupt) } } t.placeCursor()