diff --git a/ruby/command-t/lib/command-t/match_window.rb b/ruby/command-t/lib/command-t/match_window.rb index 87b39e9..406219a 100644 --- a/ruby/command-t/lib/command-t/match_window.rb +++ b/ruby/command-t/lib/command-t/match_window.rb @@ -154,9 +154,18 @@ module CommandT def buffer_number @@buffer && @@buffer.number - rescue Vim::DeletedBufferError + + # neovim-ruby @ 0.7.1 does not define a Vim::DeletedBufferError + rescue StandardError => e # Beware of people manually deleting Command-T's hidden, unlisted buffer. - @@buffer = nil + if ( + e.class.name == 'Vim::DeletedBufferError' || + e.message == 'Invalid buffer id' + ) + @@buffer = nil + else + raise e + end end def close