nvim: improve Telescope man_pages
fix for macOS and FreeBSD
This commit makes sure that the fix from 681dd28
is only applied when
running on macOS Ventura (13.0) and upwards (i.e. Darwin >= 22.0) or
FreeBSD.
This commit is contained in:
parent
4b1588f253
commit
4c51020bac
1 changed files with 17 additions and 5 deletions
|
@ -59,6 +59,7 @@ telescope.setup {
|
||||||
keymaps = { prompt_title = ' Find keymaps ' },
|
keymaps = { prompt_title = ' Find keymaps ' },
|
||||||
live_grep = { prompt_title = ' 🔍 Grep ' },
|
live_grep = { prompt_title = ' 🔍 Grep ' },
|
||||||
vim_options = { prompt_title = ' Find options ' },
|
vim_options = { prompt_title = ' Find options ' },
|
||||||
|
man_pages = { prompt_title = ' Find man pages '},
|
||||||
},
|
},
|
||||||
|
|
||||||
extensions = {
|
extensions = {
|
||||||
|
@ -88,11 +89,22 @@ local custom = {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
man_pages = function()
|
man_pages = function()
|
||||||
builtin.man_pages {
|
-- Fix for macOS Ventura onwards (macOS 13.x <-> Darwin 22.x).
|
||||||
prompt_title = ' Find man pages ',
|
-- See: https://github.com/nvim-telescope/telescope.nvim/issues/2326#issuecomment-1407502328
|
||||||
sections = { 'ALL' },
|
local uname = vim.loop.os_uname()
|
||||||
man_cmd = { "apropos", ".*" }
|
local sysname = string.lower(uname.sysname)
|
||||||
}
|
if sysname == "darwin" then
|
||||||
|
local major_version = tonumber(vim.fn.matchlist(uname.release, [[^\(\d\+\)\..*]])[2]) or 0
|
||||||
|
if major_version >= 22 then
|
||||||
|
builtin.man_pages { sections = { 'ALL' }, man_cmd = { "apropos", "." } }
|
||||||
|
else
|
||||||
|
builtin.man_pages { sections = { 'ALL' }, man_cmd = { "apropos", " " } }
|
||||||
|
end
|
||||||
|
elseif sysname == "freebsd" then
|
||||||
|
builtin.man_pages { sections = { 'ALL' }, man_cmd = { "apropos", "." } }
|
||||||
|
else
|
||||||
|
builtin.man_pages { sections = { 'ALL' } }
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue