moved telescope to own config
This commit is contained in:
parent
8a006681eb
commit
013d8189a6
|
|
@ -1,6 +1,3 @@
|
||||||
local execute = vim.api.nvim_command
|
|
||||||
local fn = vim.fn
|
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.fn.system(
|
vim.fn.system(
|
||||||
|
|
@ -19,23 +16,6 @@ vim.opt.rtp:prepend(lazypath)
|
||||||
local quick_prompts = {
|
local quick_prompts = {
|
||||||
["Code actions"] = true
|
["Code actions"] = true
|
||||||
}
|
}
|
||||||
local selectX = function(n)
|
|
||||||
return function(bufnr)
|
|
||||||
local a = require("telescope.actions")
|
|
||||||
local s = require("telescope.actions.state")
|
|
||||||
local picker_name = s.get_current_picker(bufnr).prompt_title
|
|
||||||
if not quick_prompts[picker_name] then
|
|
||||||
-- Disable quick prompts to not press by accident
|
|
||||||
-- TODO: Still type the number
|
|
||||||
return
|
|
||||||
end
|
|
||||||
a.move_to_top(bufnr)
|
|
||||||
for _ = 1, n - 1 do
|
|
||||||
a.move_selection_next(bufnr)
|
|
||||||
end
|
|
||||||
a.select_default(bufnr)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lazy").setup(
|
require("lazy").setup(
|
||||||
{
|
{
|
||||||
|
|
@ -110,44 +90,7 @@ require("lazy").setup(
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
local dropdown_configs = {
|
require("plugins/telescope")
|
||||||
layout_config = {
|
|
||||||
prompt_position = "top",
|
|
||||||
vertical = {
|
|
||||||
width = 80,
|
|
||||||
height = 12
|
|
||||||
}
|
|
||||||
},
|
|
||||||
border = {}
|
|
||||||
}
|
|
||||||
require("telescope").setup {
|
|
||||||
file_ignore_patterns = {"package-lock.json"},
|
|
||||||
extensions = {
|
|
||||||
["ui-select"] = {
|
|
||||||
require("telescope.themes").get_dropdown(dropdown_configs)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
defaults = {
|
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
["<Esc>"] = "close",
|
|
||||||
["n"] = {require("telescope.actions").move_selection_next, type = "action"},
|
|
||||||
["1"] = {selectX(1), type = "action"},
|
|
||||||
["2"] = {selectX(2), type = "action"},
|
|
||||||
["3"] = {selectX(3), type = "action"},
|
|
||||||
["4"] = {selectX(4), type = "action"},
|
|
||||||
["5"] = {selectX(5), type = "action"},
|
|
||||||
["6"] = {selectX(6), type = "action"},
|
|
||||||
["7"] = {selectX(7), type = "action"},
|
|
||||||
["8"] = {selectX(8), type = "action"},
|
|
||||||
["9"] = {selectX(9), type = "action"},
|
|
||||||
["0"] = {selectX(10), type = "action"}
|
|
||||||
},
|
|
||||||
n = {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
require("telescope").load_extension("ui-select")
|
|
||||||
end,
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/popup.nvim",
|
"nvim-lua/popup.nvim",
|
||||||
|
|
@ -217,7 +160,9 @@ require("lazy").setup(
|
||||||
{
|
{
|
||||||
"supermaven-inc/supermaven-nvim",
|
"supermaven-inc/supermaven-nvim",
|
||||||
config = function()
|
config = function()
|
||||||
require("supermaven-nvim").setup({})
|
if not (vim.fn.has_key(vim.fn.environ(), "LOAD_SUPERMAVEN") == 0) then
|
||||||
|
require("supermaven-nvim").setup({})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
local selectX = function(n)
|
||||||
|
return function(bufnr)
|
||||||
|
local a = require("telescope.actions")
|
||||||
|
local s = require("telescope.actions.state")
|
||||||
|
local picker_name = s.get_current_picker(bufnr).prompt_title
|
||||||
|
if not quick_prompts[picker_name] then
|
||||||
|
-- Disable quick prompts to not press by accident
|
||||||
|
-- TODO: Still type the number
|
||||||
|
return
|
||||||
|
end
|
||||||
|
a.move_to_top(bufnr)
|
||||||
|
for _ = 1, n - 1 do
|
||||||
|
a.move_selection_next(bufnr)
|
||||||
|
end
|
||||||
|
a.select_default(bufnr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local dropdown_configs = {
|
||||||
|
layout_config = {
|
||||||
|
prompt_position = "top",
|
||||||
|
vertical = {
|
||||||
|
width = 80,
|
||||||
|
height = 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
border = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
require("telescope").setup {
|
||||||
|
file_ignore_patterns = {"package-lock.json"},
|
||||||
|
extensions = {
|
||||||
|
["ui-select"] = {
|
||||||
|
require("telescope.themes").get_dropdown(dropdown_configs)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<Esc>"] = "close",
|
||||||
|
["1"] = {selectX(1), type = "action"},
|
||||||
|
["2"] = {selectX(2), type = "action"},
|
||||||
|
["3"] = {selectX(3), type = "action"},
|
||||||
|
["4"] = {selectX(4), type = "action"},
|
||||||
|
["5"] = {selectX(5), type = "action"},
|
||||||
|
["6"] = {selectX(6), type = "action"},
|
||||||
|
["7"] = {selectX(7), type = "action"},
|
||||||
|
["8"] = {selectX(8), type = "action"},
|
||||||
|
["9"] = {selectX(9), type = "action"},
|
||||||
|
["0"] = {selectX(10), type = "action"}
|
||||||
|
},
|
||||||
|
n = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
require("telescope").load_extension("ui-select")
|
||||||
Loading…
Reference in New Issue