Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
Detecting whether vim is currently opened by fc shell builtin is nontrivial - there's some logic described in filetype.vim around it (for example to detect zsh's /tmp/zsh* file but not something like zsh.vim), as well as needing to support more than one shell.
Describe the solution you'd like
The filetype can reflect this information - for example filetype=fc.zsh and filetype=fc.bash (I haven't considered other shells but they should be similar).
Describe alternatives you've considered
An alternative is for whoever needs it to add their own detection.
Additional context
This could be useful to develop plugins that enhance the fc experience.
It should be simple to implement by extracting the relevant patterns into a separate autocommand that will set the more specific filetype.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Does this really require using a different filetype? When using "fc"
from bash, shouldn't the filetype be "bash"?
I would like to add the more specific filetype as well (as far as I can understand filetype=fc.zsh would trigger both of the filetypes) for making plugins when launched by fc specifically, not just for a generic shell script. (think for example one that would preview output of the command)
other shells
Zsh opens /tmp/zshXXXXXX where X is some random letters (which is correctly recognized as zsh).
Seems like sh doesn't have fc.
Ksh creates a /tmp/ast.XXXXXX file which doesn't get recognized as any filetype.
Tcsh doesn't have a fc builtin
Fish doesn't appear to either
Also it seems like bash's fc file gets recognized as sh even though https://github.com/vim/vim/blob/5de4c4372d4366bc85cb66efb3e373439b9471c5/runtime/filetype.vim#L2444 looks like it should set it to bash
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Not sure if "fc" should be a separate filetype. Matching the filename yourself is the other end.
How about setting "b:is_fc" when appropriate?
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()
How about setting "b:is_fc" when appropriate?
Seems reasonable to me.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()
So I'm looking through this https://github.com/vim/vim/blob/f6b0c79742727948edee78cb1a3a9a4e3be8b0fd/runtime/autoload/dist/ft.vim#L579 and I guess the b:is_fc = 1 should go somewhere there. I wonder how the information would be passed to the function though... Adding another argument doesn't look like the way to go to me (backwards compat). Maybe the flag should just be set right in filetype.vim? Or perhaps a new function SetFileTypeShellFC could be created.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Ah, I see. By the way, the pattern shouldn't include /tmp since this for example will fail to detect in Windows environments like mine :P
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()