diff options
Diffstat (limited to 'runtime/lua')
-rw-r--r-- | runtime/lua/man.lua | 16 | ||||
-rw-r--r-- | runtime/lua/nvim/health.lua | 11 | ||||
-rw-r--r-- | runtime/lua/vim/_init_packages.lua | 9 | ||||
-rw-r--r-- | runtime/lua/vim/filetype.lua | 6 | ||||
-rw-r--r-- | runtime/lua/vim/treesitter/language.lua | 12 |
5 files changed, 36 insertions, 18 deletions
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index 732a4ab92e..0956022ac6 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -149,15 +149,21 @@ local function highlight_line(line, linenr) if overstrike then local last_hl = hls[#hls] if char == prev_char then - if char == '_' and attr == UNDERLINE and last_hl and last_hl.final == byte then - -- This underscore is in the middle of an underlined word - attr = UNDERLINE + if char == '_' and attr == ITALIC and last_hl and last_hl.final == byte then + -- This underscore is in the middle of an italic word + attr = ITALIC else attr = BOLD end elseif prev_char == '_' then - -- char is underlined - attr = UNDERLINE + -- Even though underline is strictly what this should be. <bs>_ was used by nroff to + -- indicate italics which wasn't possible on old typewriters so underline was used. Modern + -- terminals now support italics so lets use that now. + -- See: + -- - https://unix.stackexchange.com/questions/274658/purpose-of-ascii-text-with-overstriking-file-format/274795#274795 + -- - https://cmd.inp.nsk.su/old/cmd2/manuals/unix/UNIX_Unleashed/ch08.htm + -- attr = UNDERLINE + attr = ITALIC elseif prev_char == '+' and char == 'o' then -- bullet (overstrike text '+^Ho') attr = BOLD diff --git a/runtime/lua/nvim/health.lua b/runtime/lua/nvim/health.lua index b76106f241..f11899434e 100644 --- a/runtime/lua/nvim/health.lua +++ b/runtime/lua/nvim/health.lua @@ -156,13 +156,10 @@ local function check_performance() health.report_ok(buildtype) else health.report_info(buildtype) - health.report_warn( - 'Non-optimized ' .. (has('debug') and '(DEBUG) ' or '') .. 'build. Nvim will be slower.', - { - 'Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.', - suggest_faq, - } - ) + health.report_warn('Non-optimized debug build. Nvim will be slower.', { + 'Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.', + suggest_faq, + }) end -- check for slow shell invocation diff --git a/runtime/lua/vim/_init_packages.lua b/runtime/lua/vim/_init_packages.lua index 0c4ee8636d..e3a442af5e 100644 --- a/runtime/lua/vim/_init_packages.lua +++ b/runtime/lua/vim/_init_packages.lua @@ -42,8 +42,11 @@ function vim._load_package(name) return nil end --- Insert vim._load_package after the preloader at position 2 -table.insert(package.loaders, 2, vim._load_package) +-- TODO(bfredl): dedicated state for this? +if vim.api then + -- Insert vim._load_package after the preloader at position 2 + table.insert(package.loaders, 2, vim._load_package) +end -- builtin functions which always should be available require('vim.shared') @@ -78,6 +81,6 @@ function vim.empty_dict() end -- only on main thread: functions for interacting with editor state -if not vim.is_thread() then +if vim.api and not vim.is_thread() then require('vim._editor') end diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 9293c828b8..8144731b09 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -226,6 +226,7 @@ local extension = { hook = function(path, bufnr) return M.getlines(bufnr, 1) == '[Trigger]' and 'conf' end, + nmconnection = 'confini', mklx = 'context', mkiv = 'context', mkii = 'context', @@ -331,6 +332,7 @@ local extension = { am = 'elf', exs = 'elixir', elm = 'elm', + lc = 'elsa', elv = 'elvish', ent = function(path, bufnr) return require('vim.filetype.detect').ent(bufnr) @@ -383,6 +385,7 @@ local extension = { ['m4gl'] = 'fgl', ['4gl'] = 'fgl', ['4gh'] = 'fgl', + fir = 'firrtl', fish = 'fish', focexec = 'focexec', fex = 'focexec', @@ -567,6 +570,7 @@ local extension = { libsonnet = 'jsonnet', jsp = 'jsp', jl = 'julia', + kdl = 'kdl', kv = 'kivy', kix = 'kix', kts = 'kotlin', @@ -1461,6 +1465,7 @@ local filename = { ['Pipfile.lock'] = 'json', ['.firebaserc'] = 'json', ['.prettierrc'] = 'json', + ['.stylelintrc'] = 'json', ['.babelrc'] = 'jsonc', ['.eslintrc'] = 'jsonc', ['.hintrc'] = 'jsonc', @@ -1696,6 +1701,7 @@ local filename = { fglrxrc = 'xml', ['/etc/blkid.tab'] = 'xml', ['/etc/blkid.tab.old'] = 'xml', + ['.clangd'] = 'yaml', ['.clang-format'] = 'yaml', ['.clang-tidy'] = 'yaml', ['/etc/zprofile'] = 'zsh', diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua index c92d63b8c4..8634e53b7b 100644 --- a/runtime/lua/vim/treesitter/language.lua +++ b/runtime/lua/vim/treesitter/language.lua @@ -6,7 +6,7 @@ local M = {} --- --- Parsers are searched in the `parser` runtime directory, or the provided {path} --- ----@param lang string Language the parser should parse +---@param lang string Language the parser should parse (alphanumerical and `_` only) ---@param path (string|nil) Optional path the parser is located at ---@param silent (boolean|nil) Don't throw an error if language not found ---@param symbol_name (string|nil) Internal symbol name for the language to load @@ -16,13 +16,19 @@ function M.require_language(lang, path, silent, symbol_name) return true end if path == nil then - local fname = 'parser/' .. vim.fn.fnameescape(lang) .. '.*' + if not (lang and lang:match('[%w_]+') == lang) then + if silent then + return false + end + error("'" .. lang .. "' is not a valid language name") + end + + local fname = 'parser/' .. lang .. '.*' local paths = a.nvim_get_runtime_file(fname, false) if #paths == 0 then if silent then return false end - error("no parser for '" .. lang .. "' language, see :help treesitter-parsers") end path = paths[1] |