Skip to content

Commit

Permalink
feat(api): New function ft_get().
Browse files Browse the repository at this point in the history
This should make identifying the buffer's filetype
easier for the end-user.
  • Loading branch information
DrKJeff16 committed May 30, 2024
1 parent 15bf1b0 commit 8e8ecaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/user/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ local M = {
::continue::
end
end,
ft_get = function(scope)
scope = (is_str(scope) and vim.tbl_contains({ 'local', 'global' })) and scope or 'local'

return vim.api.nvim_get_option_value('ft', { scope = scope })
end,
}

return M
1 change: 1 addition & 0 deletions lua/user/types/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
---@field highlight UserHl
---@field opts UserOpts
---@field types UserTypes
---@field ft_get fun(scope: ('local'|'global')?): string

---@type UserTypes
local M = {
Expand Down

0 comments on commit 8e8ecaa

Please sign in to comment.