Saturday, July 15, 2017

Re: How to continue the map when an error come out?

On Saturday, July 15, 2017 at 10:07:08 AM UTC-5, Zhe Lee wrote:
> nnoremap <leader>k :%s/\v^\s+//g<CR>:sort u<CR>:xa<CR>
>
>
> This is my map. When there is no match to the "^\s+", an error will come out, and the map will pause, the sort u, and the xa will not be executed. So how to continue the map when there is an error come out?

Add the 'e' flag to your substitute command to not throw an error for no matches.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: