-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfiletype.lua
24 lines (24 loc) · 904 Bytes
/
filetype.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- This file is automatically loaded by Neovim before any filetype is detected
vim.filetype.add({
extension = {
-- Neon is a YAML-like language
neon = "yaml",
-- AppleScript or JavaScript for Automation (JXA)
scpt = function(path, bufnr)
local content = vim.api.nvim_buf_get_lines(bufnr, 0, 1, false)[1] or ""
if
vim.regex([[^#!/usr/bin/osascript -l JavaScript]]):match_str(content) ~= nil
or vim.regex([[^#!/usr/bin/env osascript -l JavaScript]]):match_str(content) ~= nil
then
return "javascript"
else
return "applescript"
end
end,
},
filename = {
-- Config file for js-beautify
-- (used by Intelephense https://github.com/bmewburn/vscode-intelephense/issues/729)
[".jsbeautifyrc"] = "json",
},
})