diff --git a/lua/one/plugins/filetype.lua b/lua/one/plugins/filetype.lua index 1059832..b46293a 100644 --- a/lua/one/plugins/filetype.lua +++ b/lua/one/plugins/filetype.lua @@ -1,67 +1,29 @@ -local M = { 'nathom/filetype.nvim', desc = 'filetype detection' } +local M = { 'filetype', desc = 'filetype detection' } function M.config(config) - local conf = config.filetype - - ---@diagnostic disable-next-line: different-requires, redundant-parameter - require('filetype').setup(conf) + vim.filetype.add(config.filetype) end M.defaultConfig = { 'filetype', { - overrides = { - - -- Set the filetype based on file extension - extensions = { - -- *.cocoascript files set filetype javascript - cocoascript = 'javascript', - bats = 'sh', - }, - - -- Set the filetype based on filename - literal = { bash_profile = 'sh', profile = 'sh' }, - - complex = { - -- Set the filetype of any full filename matching the regex to gitconfig - ['.*git/config'] = 'gitconfig', - ['Dockerfile*'] = 'dockerfile', - ['*.dockerfile'] = 'dockerfile', - }, + -- see :h vim.filetype.add - -- shebang = { - -- -- Set the filetype of files with a dash shebang to sh - -- dash = "sh", - -- }, - - -- The same as the ones above except the keys map to functions - -- function_extensions = { - -- cpp = function() - -- vim.bo.filetype = "cpp" - -- -- Remove annoying indent jumping - -- vim.bo.cinoptions = vim.bo.cinoptions .. "L0" - -- end, - - -- jsx = function() - -- vim.bo.filetype = "pdf" - -- -- Open in PDF viewer (Skim.app) automatically - -- vim.fn.jobstart( - -- "open -a skim " .. '"' .. vim.fn.expand("%") .. '"' - -- ) - -- end, - -- }, + -- Set the filetype based on file extension + extension = { + -- *.cocoascript files set filetype javascript + cocoascript = 'javascript', + bats = 'sh', + }, - -- function_literal = { - -- Brewfile = function() - -- vim.cmd("syntax off") - -- end, - -- }, + -- Set the filetype based on filename + filename = { bash_profile = 'sh', profile = 'sh' }, - -- function_complex = { - -- ["*.math_notes/%w+"] = function() - -- vim.cmd("iabbrev $ $$") - -- end, - -- }, + pattern = { + -- Set the filetype of any full filename matching the regex to gitconfig + ['.*git/config'] = 'gitconfig', + ['Dockerfile*'] = 'dockerfile', + ['*.dockerfile'] = 'dockerfile', }, },