forked from neovim/neovim
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(runtime): modify vim.filetype.match to only return filetype
Also write a lua version of dist#ft#FTtf and use it in filetype.lua Work on neovim#18241
- Loading branch information
Showing
3 changed files
with
34 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
local M = {} | ||
|
||
-- Determine if a *.tf file is TF mud client or terraform | ||
function M.tf(_, bufnr) | ||
number_of_lines = vim.api.nvim_buf_line_count(bufnr) | ||
for _,line in ipairs(vim.api.nvim_buf_get_lines(bufnr, 0, number_of_lines, true)) do | ||
if not line:find("^[;/ ]") then | ||
return "terraform" | ||
end | ||
end | ||
|
||
return "tf" | ||
end | ||
|
||
return M |