summaryrefslogtreecommitdiff
path: root/lua/telescope/actions.lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2020-09-04 21:48:00 +0200
committerGitHub <noreply@github.com>2020-09-04 15:48:00 -0400
commit4abb5f7867fb087aa69bcd49d40537609a1e2e46 (patch)
tree03ba0f5fce14e218b80583bb115e4c4fd7c1b60e /lua/telescope/actions.lua
parentf5f127541127ca5a773a9b4ba8434d5b88871335 (diff)
Adds split and tabedit mappings. Adopted by fzf.vim (#29)
Diffstat (limited to 'lua/telescope/actions.lua')
-rw-r--r--lua/telescope/actions.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/lua/telescope/actions.lua b/lua/telescope/actions.lua
index dd47f4d..dc864d1 100644
--- a/lua/telescope/actions.lua
+++ b/lua/telescope/actions.lua
@@ -34,7 +34,7 @@ function actions.get_selected_entry(prompt_bufnr)
return actions.get_current_picker(prompt_bufnr):get_selection()
end
-function actions.goto_file_selection(prompt_bufnr)
+local function goto_file_selection(prompt_bufnr, command)
local picker = actions.get_current_picker(prompt_bufnr)
local entry = actions.get_selected_entry(prompt_bufnr)
@@ -71,7 +71,7 @@ function actions.goto_file_selection(prompt_bufnr)
vim.cmd(string.format([[bwipeout! %s]], prompt_bufnr))
a.nvim_set_current_win(picker.original_win_id or 0)
- vim.cmd(string.format(":e %s", filename))
+ vim.cmd(string.format(":%s %s", command, filename))
local bufnr = vim.api.nvim_get_current_buf()
a.nvim_buf_set_option(bufnr, 'buflisted', true)
@@ -83,6 +83,22 @@ function actions.goto_file_selection(prompt_bufnr)
end
end
+function actions.goto_file_selection_edit(prompt_bufnr)
+ goto_file_selection(prompt_bufnr, "e")
+end
+
+function actions.goto_file_selection_split(prompt_bufnr)
+ goto_file_selection(prompt_bufnr, "sp")
+end
+
+function actions.goto_file_selection_vsplit(prompt_bufnr)
+ goto_file_selection(prompt_bufnr, "vsp")
+end
+
+function actions.goto_file_selection_tabedit(prompt_bufnr)
+ goto_file_selection(prompt_bufnr, "tabe")
+end
+
actions.close = function(prompt_bufnr)
vim.cmd(string.format([[bwipeout! %s]], prompt_bufnr))
end