Saturday, December 5, 2020

Re: Autocommand bug when reloading file



On Friday, December 4, 2020 at 6:13:21 AM UTC-6 Paul wrote:
On Wed, Dec 02, 2020 at 03:56:17AM -0600, Felipe Contreras wrote:
>For a while I've configured the indentation preferences for many
>languages and different projects, similar to:
>
> au! FileType sh setl et ts=2
> au! BufRead,BufNewFile */project/*.sh setl noet ts=8

Filetype settings should really go under ~/.vim/after/ftplugin.

Yes, that's actually where I have the defaults ("setl et ts=2"), I just used "FileType sh" for simplifications purposes.
 
Try putting this into ~/.after/ftplugin/sh.vim:

if expand('%:p') =~# '/project/[^/]*'
setlocal noexpandtab tabstop=8
else
setlocal expandtab tabstop=2
endif

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}

And I'm pretty sure it used to work before. It's clearly a regression, and if not, it's still inconsistent and obviously a bug.
 
(Apologies for the HTML format; Google Groups doesn't seem to have a plain text only option)

Cheers.

--
--
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/2568acf8-f7d7-466d-a06a-e5dad3334b9en%40googlegroups.com.

No comments: