Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Vim:E492: Not an editor command: dist#ft#SetFileTypeSH("bash") #68

Closed
ttys3 opened this issue Jan 26, 2022 · 4 comments
Closed

Vim:E492: Not an editor command: dist#ft#SetFileTypeSH("bash") #68

ttys3 opened this issue Jan 26, 2022 · 4 comments

Comments

@ttys3
Copy link

ttys3 commented Jan 26, 2022

Error detected while processing BufReadPost Autocommands for "*":
E5108: Error executing lua ...r/start/filetype.nvim/lua/filetype/mappings/function.lua:568: Vim:E492: Not an editor command: dist#ft#SetFileTypeSH("bash")
stack traceback:
        [C]: in function 'cmd'
        ...r/start/filetype.nvim/lua/filetype/mappings/function.lua:568: in function 'name'
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:17: in function 'set_filetype'
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:52: in function 'try_regex'
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:171: in function 'resolve'
        [string ":lua"]:1: in main chunk
Press ENTER or type command to contin
@punowo
Copy link

punowo commented Jan 28, 2022

Also happens to me when I open .bash_profile.

@ObserverOfTime
Copy link

ObserverOfTime commented Feb 4, 2022

Update: sourcing dist#ft breaks the plugin. Do this instead:

local function bash_literal()
    vim.bo.filetype = 'sh'
    vim.b.is_bash = true
end

require('filetype').setup {
    overrides = {
        function_literal = {
            ['.bashrc'] = bash_literal,
            ['.bash_profile'] = bash_literal,
            ['.bash_history'] = bash_literal,
            ['.bash_logout'] = bash_literal,
            ... -- more overrides
        },
        ... -- even more overrides
    }
}

Here's a bandaid for packer.nvim users:

    use {
        'nathom/filetype.nvim',
        setup = [[vim.cmd('runtime! autoload/dist/ft.vim')]],
        ... -- config and whatever else
    }

This command should probably be included in the plugin. (related to #9)

@foundObjects
Copy link

I'm also experiencing this with any .bash* file. The band-aid above works with a single complex rule as a workaround:

require('filetype').setup {
	overrides = {
		complex = {
			['.*/.bash.*'] = bash_literal,
		},
	},
}

@evanpurkhiser
Copy link

evanpurkhiser commented Feb 5, 2023

I am seeing this now in the nighly neovim builds.

I suspect because of this bullet

filetype.vim is removed in favor of lua-filetype (Note that filetype logic and tests still align with Vim, so additions or changes need to be contributed there first.) See neovim/neovim#20674.

I believe what I'm seeing is the same as #91

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants