Saturday, December 5, 2020

Re: Autocommand bug when reloading file

On Sat, Dec 05, 2020 at 04:19:37AM -0800, Felipe Contreras wrote:
>Yeah, this works:
>
> if expand('%:p') =~# '/git-completion/.\+\.\(bash\|sh\|zsh\)'
>
>But that's a pretty far cry from what I had:
>
> */git-completion/*.{bash,sh,zsh}

You don't need to check the file extension. That this is in a ftplugin means it'll only run on those filetypes.

> if expand('%:p') =~# '/git-completion/.\+\.\(bash\|sh\|zsh\)'

I forgot a $:

if expand('%:p') =~# '/git-completion/[^/]*$'

But if you want to match anywhere under git-completion:

if expand('%:p') =~# '/git-completion/'

--
--
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/20201205133830.GA25752%40rainslide.net.

No comments: