On 2022-02-28, SuperCuber wrote:
> 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
The filetype for bash files is sh. If Vim determines that it is
a bash file, then it sets b:is_bash = 1. (See
$VIMRUNTIME/autoload/dist/ft.vim.)
What I use for doing special things in fc buffers is this in my
~/.vim/after/ftplugin/sh.vim file:
if argv(0) =~ '^/tmp/bash-fc[-.]\w\+$'
" Stuff for fc buffers
endif
I use only bash, so I don't need to identify the shell or allow for
other shells.
Regards,
Gary
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220228192125.GB18373%40phoenix.