From 6b8bb7daf2b302721f0e2f88cb5a953cc7f34eb1 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 3 May 2022 09:08:49 +0100 Subject: [PATCH] feat(nvim): add Telescope default mappings Add an insert mode mapping for `which_key` and also one for insert and normal mode for toggling the previewer. --- roles/neovim/files/lua/opdavies/telescope/setup.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/neovim/files/lua/opdavies/telescope/setup.lua b/roles/neovim/files/lua/opdavies/telescope/setup.lua index eaf4bad6..ae4a7ebc 100644 --- a/roles/neovim/files/lua/opdavies/telescope/setup.lua +++ b/roles/neovim/files/lua/opdavies/telescope/setup.lua @@ -28,9 +28,21 @@ local new_maker = function(filepath, bufnr, opts) :sync() end +local action_layout = require 'telescope.actions.layout' +local actions = require 'telescope.actions' + telescope.setup { defaults = { buffer_previewer_maker = new_maker, + mappings = { + i = { + [""] = actions.which_key, + [""] = action_layout.toggle_preview, + }, + n = { + [""] = action_layout.toggle_preview, + }, + }, no_ignore = true, prompt_prefix = "$ ", },