From 64aae0abd83ac852c9751d4b42310f6a213c3fd1 Mon Sep 17 00:00:00 2001 From: tami5 <65782666+tami5@users.noreply.github.com> Date: Fri, 13 Nov 2020 18:14:40 +0300 Subject: [PATCH] feat: Add c-v, c-x, c-t to help_tags (#229) --- lua/telescope/builtin.lua | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua index d4030ae..45596fe 100644 --- a/lua/telescope/builtin.lua +++ b/lua/telescope/builtin.lua @@ -507,15 +507,36 @@ builtin.help_tags = function(opts) previewer = previewers.help.new(opts), sorter = conf.generic_sorter(opts), attach_mappings = function(prompt_bufnr, map) - local view_help = function() + local open = function(cmd) local selection = actions.get_selected_entry(prompt_bufnr) actions.close(prompt_bufnr) - vim.cmd("help " .. selection.value) + vim.cmd(cmd .. selection.value) end - - map('i', '', view_help) - map('n', '', view_help) + local nhelp = function() + return open("help ") + end + local vhelp = function() + return open("vert bo help ") + end + local hhelp = function() + return open("help ") + -- Not sure how explictly make horizontal + end + local thelp = function() + return open("tab help ") + end + -- Perhaps it would be a good idea to have vsplit,tab,hsplit open + -- a builtin action that accepts a command to be ran before creating + -- the split or tab + map('i', '', nhelp) + map('n', '', nhelp) + map('i', '', vhelp) + map('n', '', vhelp) + map('i', '', hhelp) + map('n', '', hhelp) + map('i', '', thelp) + map('n', '', thelp) return true end