summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authortami5 <65782666+tami5@users.noreply.github.com>2020-11-13 18:14:40 +0300
committerGitHub <noreply@github.com>2020-11-13 10:14:40 -0500
commit64aae0abd83ac852c9751d4b42310f6a213c3fd1 (patch)
tree021fa79898d6ee5e35551c584882a475ae293356 /lua
parentd8befe243752bd1b295d84e35a53d16a0de55aa9 (diff)
feat: Add c-v, c-x, c-t to help_tags (#229)
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/builtin.lua31
1 files 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', '<CR>', view_help)
- map('n', '<CR>', 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', '<CR>', nhelp)
+ map('n', '<CR>', nhelp)
+ map('i', '<C-v>', vhelp)
+ map('n', '<C-v>', vhelp)
+ map('i', '<C-x>', hhelp)
+ map('n', '<C-x>', hhelp)
+ map('i', '<C-t>', thelp)
+ map('n', '<C-t>', thelp)
return true
end