Friday, October 4, 2019

cmdline regex ques

Hi,

Does anyone know what would be the vim regex for getcmdline() =~ for both 'q' and 'q!' ?
ie, something like:
cnoreabbrev <expr> q  (getcmdtype() == ':' && getcmdline() =~ '\s*q\s*$') ?  'call Quit()' : 'q'
cnoreabbrev <expr> q! (getcmdtype() == ':' && getcmdline() =~ '\s*q!\s*$') ? 'call QuitBang()' : 'q!'
But this clearly isn't right because the q! cmd is picked up by the q here.
I think we need an exact match on the string between whitespace ?

thx for everything vim,
-m

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/1420c08c-f339-4eb6-963e-41281cba7f61%40googlegroups.com.

No comments: