mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(runtime): gO always says "Help TOC" #32971
Problem: gO always says "Help TOC". Solution: Use a generic title instead.
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
vim.keymap.set('n', 'gO', function()
|
vim.keymap.set('n', 'gO', function()
|
||||||
require('vim.treesitter._headings').show_toc()
|
require('vim.treesitter._headings').show_toc()
|
||||||
end, { buffer = 0, silent = true, desc = 'Show table of contents for current buffer' })
|
end, { buffer = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||||
|
|
||||||
vim.keymap.set('n', ']]', function()
|
vim.keymap.set('n', ']]', function()
|
||||||
require('vim.treesitter._headings').jump({ count = 1, level = 1 })
|
require('vim.treesitter._headings').jump({ count = 1, level = 1 })
|
||||||
|
@ -57,7 +57,7 @@ end
|
|||||||
|
|
||||||
vim.keymap.set('n', 'gO', function()
|
vim.keymap.set('n', 'gO', function()
|
||||||
require('vim.treesitter._headings').show_toc()
|
require('vim.treesitter._headings').show_toc()
|
||||||
end, { buffer = 0, silent = true, desc = 'Show table of contents for current buffer' })
|
end, { buffer = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||||
|
|
||||||
vim.keymap.set('n', ']]', function()
|
vim.keymap.set('n', ']]', function()
|
||||||
require('vim.treesitter._headings').jump({ count = 1 })
|
require('vim.treesitter._headings').jump({ count = 1 })
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
vim.keymap.set('n', 'gO', function()
|
vim.keymap.set('n', 'gO', function()
|
||||||
require('vim.treesitter._headings').show_toc()
|
require('vim.treesitter._headings').show_toc()
|
||||||
end, { buffer = 0, silent = true, desc = 'Show table of contents for current buffer' })
|
end, { buffer = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||||
|
|
||||||
vim.keymap.set('n', ']]', function()
|
vim.keymap.set('n', ']]', function()
|
||||||
require('vim.treesitter._headings').jump({ count = 1 })
|
require('vim.treesitter._headings').jump({ count = 1 })
|
||||||
|
@ -800,7 +800,7 @@ function M.show_toc()
|
|||||||
end
|
end
|
||||||
|
|
||||||
fn.setloclist(0, toc, ' ')
|
fn.setloclist(0, toc, ' ')
|
||||||
fn.setloclist(0, {}, 'a', { title = 'Man TOC' })
|
fn.setloclist(0, {}, 'a', { title = 'Table of contents' })
|
||||||
vim.cmd.lopen()
|
vim.cmd.lopen()
|
||||||
vim.w.qf_toc = bufname
|
vim.w.qf_toc = bufname
|
||||||
end
|
end
|
||||||
|
@ -87,7 +87,7 @@ local get_headings = vim.func._memoize(hash_tick, function(bufnr)
|
|||||||
return headings
|
return headings
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--- Show a table of contents for the help buffer in a loclist
|
--- Shows an Outline (table of contents) of the current buffer, in the loclist.
|
||||||
function M.show_toc()
|
function M.show_toc()
|
||||||
local bufnr = api.nvim_get_current_buf()
|
local bufnr = api.nvim_get_current_buf()
|
||||||
local headings = get_headings(bufnr)
|
local headings = get_headings(bufnr)
|
||||||
@ -104,7 +104,7 @@ function M.show_toc()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.fn.setloclist(0, headings, ' ')
|
vim.fn.setloclist(0, headings, ' ')
|
||||||
vim.fn.setloclist(0, {}, 'a', { title = 'Help TOC' })
|
vim.fn.setloclist(0, {}, 'a', { title = 'Table of contents' })
|
||||||
vim.cmd.lopen()
|
vim.cmd.lopen()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user