On Jul 13, 2013 12:44 AM, "Albert Netymk" <[email protected]> wrote: > > Background scenario: When I was debugging one VimScript, some code is not executed. The reason is that unmap raises one error and the VimScript exits on this error. Because one empty try-catch is place around the code, it's not very obvious what's the problem. After locating the problem finally, I begin to think maybe this default behavior is not very intuitive.
For a command called unmap this behavior is indeed intuitive: you asked to perform an action (*delete* mapping, *unmap*) and if action cannot be performed (no such mapping) reporting failure is expected. If it was mapclear and it accepted argument like unmap I would call *this* command's behavior counter-intuitive: you asked to clear the mapping and if it is already cleared it is perfectly fine. I do not think I would benefit from either behavior (especially with regex-based error capturing which looks brain-damaged after more modern languages) though. > try > unmap <non-exiting-map> > code-should-be-executed-but-not-due-to-previous-error > catch > endtry > > This is some simple code to illustrate that vim reports error on removing non existing mapping, experimentally. It will fail on the last line, saying sth like "E31: No such mapping". > > map <F10> :echo 'hello' > unmap <F10> > unmap <F10> > > What's the rational behind this design? Personally, I would consider removing non existing mappings perfectly OK, and it should continue as usual. > > PS: This question is asked in [SO]( http://stackoverflow.com/questions/17618707/vim-remove-non-existing-mapping?noredirect=1#comment25654399_17618707), and moved here as recommended. > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
