tpope / vim-repeat

repeat.vim: enable repeating supported plugin maps with "."
http://www.vim.org/scripts/script.php?script_id=2136
2.59k stars 81 forks source link

Prevent stack trace of search errors. #47

Closed orlp closed 9 years ago

orlp commented 9 years ago

Solves https://github.com/tpope/vim-repeat/issues/38 , at least for searching (I tried to be conservative in filtering error messages - more can be added).

orlp commented 9 years ago

It might be also correct (and even better) to pattern match on Vim(normal), I just took the most conservative route possible.

tpope commented 9 years ago

Can you change call repeat#run to exe repeat#run and the end of the function to look like:

catch ...
  let v:errmsg = ...
  return 'echoerr v:errmsg'
endtry
return ''

This makes the error more like a real Vim error.

orlp commented 9 years ago

@tpope Ok. Do you think I should use the conservative (but possibly incomplete) E-numbers just for searching, or Vim(normal) to catch?

Also, it seems not necessary to set v:errmsg ourselves.

tpope commented 9 years ago

I think Vim(normal) is fine.

Setting v:errmsg is just a convenient global to make it available in the outer scope.

orlp commented 9 years ago

I'm not too familiar with Vim's scoping rules, but everything works fine by default - v:errmsg is already set.

Are you suggesting I should do let v:errmsg = v:errmsg?

tpope commented 9 years ago

In the past I recall having to explicitly massage v:exception to get a suitable v:errmsg. But if you can get away without it, go for it.

orlp commented 9 years ago

@tpope Done.

orlp commented 9 years ago

@tpope It's been a while now, can this be merged or do I need to change something?

orlp commented 9 years ago

@tpope Thanks!