diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/news.txt | 2 | ||||
-rw-r--r-- | runtime/doc/options.txt | 2 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 1 | ||||
-rw-r--r-- | runtime/ftplugin/c.lua | 1 | ||||
-rw-r--r-- | runtime/ftplugin/calender.lua | 1 | ||||
-rw-r--r-- | runtime/ftplugin/css.lua | 1 | ||||
-rw-r--r-- | runtime/ftplugin/indent.lua | 1 | ||||
-rw-r--r-- | runtime/ftplugin/xdefaults.lua | 1 | ||||
-rw-r--r-- | runtime/lua/vim/_inspector.lua | 22 |
9 files changed, 20 insertions, 12 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 7b71b53b29..3ef6451ef9 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -66,6 +66,8 @@ The following changes may require adaptations in user config or plugins. change is that language-specific highlight groups need to be renamed from `@foo.help` to `@foo.vimdoc`. +• The default value of 'commentstring' is now empty instead of "/*%s*/". + ============================================================================== NEW FEATURES *news-features* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 36c02fa3cb..096b334cda 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1390,7 +1390,7 @@ A jump table for the options with a short description can be found at |Q_op|. insert a space. *'commentstring'* *'cms'* *E537* -'commentstring' 'cms' string (default "/*%s*/") +'commentstring' 'cms' string (default "") local to buffer A template for a comment. The "%s" in the value is replaced with the comment text. Currently only used to add markers for folding, see diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index cd93e4d17a..d6ad9107b3 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -34,6 +34,7 @@ Defaults *nvim-defaults* - 'backspace' defaults to "indent,eol,start" - 'backupdir' defaults to .,~/.local/state/nvim/backup// (|xdg|), auto-created - 'belloff' defaults to "all" +- 'commentstring' defaults to "" - 'compatible' is always disabled - 'complete' excludes "i" - 'directory' defaults to ~/.local/state/nvim/swap// (|xdg|), auto-created diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/c.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/calender.lua b/runtime/ftplugin/calender.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/calender.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/css.lua b/runtime/ftplugin/css.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/css.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/indent.lua b/runtime/ftplugin/indent.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/indent.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/xdefaults.lua b/runtime/ftplugin/xdefaults.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/xdefaults.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/lua/vim/_inspector.lua b/runtime/lua/vim/_inspector.lua index 92d380b08c..05983d3f0d 100644 --- a/runtime/lua/vim/_inspector.lua +++ b/runtime/lua/vim/_inspector.lua @@ -81,6 +81,12 @@ function vim.inspect_pos(bufnr, row, col, filter) end end + -- namespace id -> name map + local nsmap = {} + for name, id in pairs(vim.api.nvim_get_namespaces()) do + nsmap[id] = name + end + --- Convert an extmark tuple into a map-like table --- @private local function to_map(extmark) @@ -90,6 +96,8 @@ function vim.inspect_pos(bufnr, row, col, filter) col = extmark[3], opts = resolve_hl(extmark[4]), } + extmark.ns_id = extmark.opts.ns_id + extmark.ns = nsmap[extmark.ns_id] or '' extmark.end_row = extmark.opts.end_row or extmark.row -- inclusive extmark.end_col = extmark.opts.end_col or (extmark.col + 1) -- exclusive return extmark @@ -104,17 +112,9 @@ function vim.inspect_pos(bufnr, row, col, filter) end -- all extmarks at this position - local extmarks = {} - for ns, nsid in pairs(vim.api.nvim_get_namespaces()) do - local ns_marks = vim.api.nvim_buf_get_extmarks(bufnr, nsid, 0, -1, { details = true }) - ns_marks = vim.tbl_map(to_map, ns_marks) - ns_marks = vim.tbl_filter(is_here, ns_marks) - for _, mark in ipairs(ns_marks) do - mark.ns_id = nsid - mark.ns = ns - end - vim.list_extend(extmarks, ns_marks) - end + local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, -1, 0, -1, { details = true }) + extmarks = vim.tbl_map(to_map, extmarks) + extmarks = vim.tbl_filter(is_here, extmarks) if filter.semantic_tokens then results.semantic_tokens = vim.tbl_filter(function(extmark) |