aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/telescope
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-01-31 09:44:13 +0100
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-01-31 09:44:13 +0100
commit669561e21073e6efafddda25ba3ace69fb43819e (patch)
treef94ebd60ad4cab480b5cbcb7e65dd2060696c339 /lua/alpha/telescope
parent5044c70e9f62cdd06ee91e754423b07c1c18c12d (diff)
downloadnvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.tar.gz
nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.zip
feat: apply stylua
Diffstat (limited to 'lua/alpha/telescope')
-rw-r--r--lua/alpha/telescope/actions.lua230
-rw-r--r--lua/alpha/telescope/init.lua210
-rw-r--r--lua/alpha/telescope/mappings.lua24
-rw-r--r--lua/alpha/telescope/setup.lua320
4 files changed, 388 insertions, 396 deletions
diff --git a/lua/alpha/telescope/actions.lua b/lua/alpha/telescope/actions.lua
index a3e41ec..e4bbd8e 100644
--- a/lua/alpha/telescope/actions.lua
+++ b/lua/alpha/telescope/actions.lua
@@ -1,20 +1,19 @@
local M = {}
-local action_state = require("telescope.actions.state")
-local actions = require("telescope.actions")
+local action_state = require "telescope.actions.state"
+local actions = require "telescope.actions"
M.create_plugin = function(prompt_bufnr)
- local new_plugin = action_state.get_current_line()
- actions.close(prompt_bufnr)
- vim.cmd(string.format("edit ~/.config/nvim/lua/plugins/%s.lua", new_plugin))
+ local new_plugin = action_state.get_current_line()
+ actions.close(prompt_bufnr)
+ vim.cmd(string.format("edit ~/.config/nvim/lua/plugins/%s.lua", new_plugin))
end
local get_disable_stm_node = function(bufnr, tree)
-
- vim.treesitter.set_query(
- "lua",
- "alpha_plugin_is_disabled",
- [[
+ vim.treesitter.set_query(
+ "lua",
+ "alpha_plugin_is_disabled",
+ [[
(return_statement
(expression_list
(table_constructor
@@ -26,26 +25,24 @@ local get_disable_stm_node = function(bufnr, tree)
)
)
]]
- )
-
- local query = vim.treesitter.get_query("lua", "alpha_plugin_is_disabled")
-
+ )
- for id, node in query:iter_captures(tree:root(), bufnr) do
- if query.captures[id] == "enabled" then
+ local query = vim.treesitter.get_query("lua", "alpha_plugin_is_disabled")
- return node
- end
+ for id, node in query:iter_captures(tree:root(), bufnr) do
+ if query.captures[id] == "enabled" then
+ return node
end
+ end
- return nil
+ return nil
end
local get_enabled_node = function(bufnr, tree)
- vim.treesitter.set_query(
- "lua",
- "alpha_plugin_has_enable_property",
- [[
+ vim.treesitter.set_query(
+ "lua",
+ "alpha_plugin_has_enable_property",
+ [[
(return_statement
(expression_list
(table_constructor
@@ -56,126 +53,121 @@ local get_enabled_node = function(bufnr, tree)
)
)
]]
- )
-
- local query = vim.treesitter.get_query("lua", "alpha_plugin_has_enable_property")
-
+ )
- for id, node in query:iter_captures(tree:root(), bufnr) do
- if query.captures[id] == "enabled" then
+ local query = vim.treesitter.get_query("lua", "alpha_plugin_has_enable_property")
- return node
- end
+ for id, node in query:iter_captures(tree:root(), bufnr) do
+ if query.captures[id] == "enabled" then
+ return node
end
+ end
- return nil
+ return nil
end
local get_return_node = function(bufnr, tree)
- vim.treesitter.set_query(
- "lua",
- "alpha_plugin_return_table_constructor",
- [[
+ vim.treesitter.set_query(
+ "lua",
+ "alpha_plugin_return_table_constructor",
+ [[
(return_statement
(expression_list
(table_constructor) @table_constructor
)
)
]]
- )
-
- local query = vim.treesitter.get_query("lua", "alpha_plugin_return_table_constructor")
-
+ )
- for id, node in query:iter_captures(tree:root(), bufnr) do
- if query.captures[id] == "table_constructor" then
+ local query = vim.treesitter.get_query("lua", "alpha_plugin_return_table_constructor")
- return node
- end
+ for id, node in query:iter_captures(tree:root(), bufnr) do
+ if query.captures[id] == "table_constructor" then
+ return node
end
+ end
- return nil
+ return nil
end
M.disable_plugin = function(prompt_bufnr)
- local entry = action_state.get_selected_entry()
- local uri = vim.uri_from_fname(entry.cwd .. entry[1])
- local bufnr = vim.uri_to_bufnr(uri)
- vim.fn.bufload(bufnr)
-
- local parsers = require("nvim-treesitter.parsers")
- local parser = parsers.get_parser(bufnr)
- if type(parser:parse()) ~= "table" then
- vim.notify("Expected table but got something else ???", vim.log.levels.ERROR, {})
- P(parser:parse())
- return
+ local entry = action_state.get_selected_entry()
+ local uri = vim.uri_from_fname(entry.cwd .. entry[1])
+ local bufnr = vim.uri_to_bufnr(uri)
+ vim.fn.bufload(bufnr)
+
+ local parsers = require "nvim-treesitter.parsers"
+ local parser = parsers.get_parser(bufnr)
+ if type(parser:parse()) ~= "table" then
+ vim.notify("Expected table but got something else ???", vim.log.levels.ERROR, {})
+ P(parser:parse())
+ return
+ end
+ local tree = unpack(parser:parse())
+
+ local disabled_stm_node = get_disable_stm_node(bufnr, tree)
+ if disabled_stm_node ~= nil then
+ vim.notify("Plugin is already disable", vim.log.levels.WARN, {})
+ return
+ end
+
+ local start_line
+ local end_line
+
+ local enable_node = get_enabled_node(bufnr, tree)
+ if enable_node == nil then
+ -- node does not exists need to assume line
+ local return_node = get_return_node(bufnr, tree)
+
+ if return_node == nil then
+ vim.notify("Can determine how to diable the plugin", vim.log.levels.ERROR, {})
+ return
end
- local tree = unpack(parser:parse())
- local disabled_stm_node = get_disable_stm_node(bufnr, tree)
- if disabled_stm_node ~= nil then
- vim.notify("Plugin is already disable", vim.log.levels.WARN, {})
- return
- end
-
- local start_line
- local end_line
-
- local enable_node = get_enabled_node(bufnr, tree)
- if enable_node == nil then
- -- node does not exists need to assume line
- local return_node = get_return_node(bufnr, tree)
-
- if return_node == nil then
- vim.notify("Can determine how to diable the plugin", vim.log.levels.ERROR, {})
- return
- end
-
- start_line = return_node:start() + 2
- end_line = start_line
- else
- start_line = enable_node:start()
- end_line = start_line + 1
- end
-
-
- vim.api.nvim_buf_set_lines(bufnr, start_line, end_line, false, { " enabled = false," })
- vim.notify("Plugin " .. entry[1] .. " Disabled", vim.log.levels.INFO, {})
- actions.close(prompt_bufnr)
- vim.api.nvim_buf_call(bufnr, function()
- vim.cmd("write")
- end)
+ start_line = return_node:start() + 2
+ end_line = start_line
+ else
+ start_line = enable_node:start()
+ end_line = start_line + 1
+ end
+
+ vim.api.nvim_buf_set_lines(bufnr, start_line, end_line, false, { " enabled = false," })
+ vim.notify("Plugin " .. entry[1] .. " Disabled", vim.log.levels.INFO, {})
+ actions.close(prompt_bufnr)
+ vim.api.nvim_buf_call(bufnr, function()
+ vim.cmd "write"
+ end)
end
-M.enable_plugin = function (prompt_bufnr)
- local entry = action_state.get_selected_entry()
- local uri = vim.uri_from_fname(entry.cwd .. entry[1])
- local bufnr = vim.uri_to_bufnr(uri)
- vim.fn.bufload(bufnr)
-
- local parsers = require("nvim-treesitter.parsers")
- local parser = parsers.get_parser(bufnr)
-
- if type(parser:parse()) == "table" then
- vim.notify("Expected number but got table ???", vim.log.levels.ERROR, {})
- P(parser:parse())
- return
- end
- local tree = unpack(parser:parse())
-
- local disabled_stm_node = get_disable_stm_node(bufnr, tree)
- if disabled_stm_node == nil then
- vim.notify("Plugin is already Enable", vim.log.levels.WARN, {})
- return
- end
-
- local enable_line = disabled_stm_node:start()
- vim.api.nvim_buf_set_lines(bufnr, enable_line, enable_line + 1, false, {})
- vim.notify("Plugin " .. entry[1] .. " Enabled", vim.log.levels.INFO, {})
- actions.close(prompt_bufnr)
- vim.api.nvim_buf_call(bufnr, function()
- vim.cmd("write")
- end)
+M.enable_plugin = function(prompt_bufnr)
+ local entry = action_state.get_selected_entry()
+ local uri = vim.uri_from_fname(entry.cwd .. entry[1])
+ local bufnr = vim.uri_to_bufnr(uri)
+ vim.fn.bufload(bufnr)
+
+ local parsers = require "nvim-treesitter.parsers"
+ local parser = parsers.get_parser(bufnr)
+
+ if type(parser:parse()) == "table" then
+ vim.notify("Expected number but got table ???", vim.log.levels.ERROR, {})
+ P(parser:parse())
+ return
+ end
+ local tree = unpack(parser:parse())
+
+ local disabled_stm_node = get_disable_stm_node(bufnr, tree)
+ if disabled_stm_node == nil then
+ vim.notify("Plugin is already Enable", vim.log.levels.WARN, {})
+ return
+ end
+
+ local enable_line = disabled_stm_node:start()
+ vim.api.nvim_buf_set_lines(bufnr, enable_line, enable_line + 1, false, {})
+ vim.notify("Plugin " .. entry[1] .. " Enabled", vim.log.levels.INFO, {})
+ actions.close(prompt_bufnr)
+ vim.api.nvim_buf_call(bufnr, function()
+ vim.cmd "write"
+ end)
end
return M
diff --git a/lua/alpha/telescope/init.lua b/lua/alpha/telescope/init.lua
index bfddbc3..b5087b3 100644
--- a/lua/alpha/telescope/init.lua
+++ b/lua/alpha/telescope/init.lua
@@ -1,174 +1,174 @@
SHOULD_RELOAD_TELESCOPE = true
local reloader = function()
- if SHOULD_RELOAD_TELESCOPE then
- RELOAD("plenary")
- RELOAD("telescope")
- RELOAD("alpha.telescope.setup")
- end
+ if SHOULD_RELOAD_TELESCOPE then
+ RELOAD "plenary"
+ RELOAD "telescope"
+ RELOAD "alpha.telescope.setup"
+ end
end
-local action_state = require("telescope.actions.state")
+local action_state = require "telescope.actions.state"
local fb_actions = require("telescope").extensions.file_browser.actions
-local actions = require("telescope.actions")
-local my_actions = require("alpha.telescope.actions")
+local actions = require "telescope.actions"
+local my_actions = require "alpha.telescope.actions"
local M = {}
function M.project_files()
- local opts = { show_untracked = true } -- define here if you want to define something
- local ok = pcall(require("telescope.builtin").git_files, opts)
- if not ok then
- require("telescope.builtin").find_files(opts)
- end
+ local opts = { show_untracked = true } -- define here if you want to define something
+ local ok = pcall(require("telescope.builtin").git_files, opts)
+ if not ok then
+ require("telescope.builtin").find_files(opts)
+ end
end
function M.branches()
- require("telescope.builtin").git_branches({
- attach_mappings = function(_, map)
- map("i", "<c-j>", actions.git_create_branch)
- map("n", "<c-j>", actions.git_create_branch)
- return true
- end,
- })
+ require("telescope.builtin").git_branches {
+ attach_mappings = function(_, map)
+ map("i", "<c-j>", actions.git_create_branch)
+ map("n", "<c-j>", actions.git_create_branch)
+ return true
+ end,
+ }
end
function M.search_config()
- require("telescope.builtin").git_files({
- prompt_title = "< Dotfiles >",
- cwd = "$HOME/.dotfiles",
- show_untracked = true,
- })
+ require("telescope.builtin").git_files {
+ prompt_title = "< Dotfiles >",
+ cwd = "$HOME/.dotfiles",
+ show_untracked = true,
+ }
end
M.find_nvim_config = function()
- require("telescope.builtin").find_files({
- prompt_title = "< Neovim >",
- cwd = "$HOME/.config/nvim/",
- })
+ require("telescope.builtin").find_files {
+ prompt_title = "< Neovim >",
+ cwd = "$HOME/.config/nvim/",
+ }
end
M.find_nvim_plugin = function()
- require("telescope.builtin").find_files({
- prompt_title = "< Plugins >",
- cwd = "$HOME/.config/nvim/lua/plugins/",
- attach_mappings = function(_, map)
- map("i", "<C-t>", my_actions.create_plugin)
- map("i", "<C-d>", my_actions.disable_plugin)
- map("i", "<C-e>", my_actions.enable_plugin)
-
- return true
- end,
- })
+ require("telescope.builtin").find_files {
+ prompt_title = "< Plugins >",
+ cwd = "$HOME/.config/nvim/lua/plugins/",
+ attach_mappings = function(_, map)
+ map("i", "<C-t>", my_actions.create_plugin)
+ map("i", "<C-d>", my_actions.disable_plugin)
+ map("i", "<C-e>", my_actions.enable_plugin)
+
+ return true
+ end,
+ }
end
function M.grep_string()
- vim.ui.input({ prompt = "Grep for > " }, function(input)
- if input == nil then
- return
- end
- require("telescope.builtin").grep_string({ search = input })
- end)
+ vim.ui.input({ prompt = "Grep for > " }, function(input)
+ if input == nil then
+ return
+ end
+ require("telescope.builtin").grep_string { search = input }
+ end)
end
function M.grep_word()
- require("telescope.builtin").grep_string({ search = vim.fn.expand("<cword>") })
+ require("telescope.builtin").grep_string { search = vim.fn.expand "<cword>" }
end
function M.find_symbol()
- vim.ui.input({ prompt = "Symbol for > " }, function(input)
- if input == nil then
- return
- end
- require("telescope.builtin").lsp_workspace_symbols({ query = input })
- end)
+ vim.ui.input({ prompt = "Symbol for > " }, function(input)
+ if input == nil then
+ return
+ end
+ require("telescope.builtin").lsp_workspace_symbols { query = input }
+ end)
end
function M.my_plugins()
- if vim.fn.isdirectory("~/code/plugins/") == 0 then
- vim.notify("Directory ~/code/plugins does not exists", vim.log.levels.WARN, { title = "Telescope Mappings" })
- return
- end
- require("telescope.builtin").find_files({
- cwd = "~/code/plugins/",
- })
+ if vim.fn.isdirectory "~/code/plugins/" == 0 then
+ vim.notify("Directory ~/code/plugins does not exists", vim.log.levels.WARN, { title = "Telescope Mappings" })
+ return
+ end
+ require("telescope.builtin").find_files {
+ cwd = "~/code/plugins/",
+ }
end
function M.projectionist()
- return require("telescope").extensions.projectionist.projectionist()
+ return require("telescope").extensions.projectionist.projectionist()
end
function M.laravel_commands()
- return require("telescope").extensions.laravel.laravel()
+ return require("telescope").extensions.laravel.laravel()
end
function M.api_specs()
- if vim.fn.isdirectory("./api-specification") == 0 then
- vim.notify("Directory api-specification does not exists", vim.log.levels.WARN, { title = "Telescope Mappings" })
- return
- end
- require("telescope.builtin").git_files({
- cwd = "./api-specification",
- show_untracked = true,
- })
+ if vim.fn.isdirectory "./api-specification" == 0 then
+ vim.notify("Directory api-specification does not exists", vim.log.levels.WARN, { title = "Telescope Mappings" })
+ return
+ end
+ require("telescope.builtin").git_files {
+ cwd = "./api-specification",
+ show_untracked = true,
+ }
end
function M.worktree()
- return require("telescope").extensions.git_worktree.git_worktrees()
+ return require("telescope").extensions.git_worktree.git_worktrees()
end
function M.worktree_create()
- return require("telescope").extensions.git_worktree.create_git_worktree()
+ return require("telescope").extensions.git_worktree.create_git_worktree()
end
function M.refactor()
- return require("telescope").extensions.refactoring.refactors()
+ return require("telescope").extensions.refactoring.refactors()
end
function M.file_browser_relative()
- return M.file_browser({ path = "%:p:h" })
+ return M.file_browser { path = "%:p:h" }
end
function M.gateway()
- return require("alpha.php.gateway").graphql_definitions({
- layout_config = {
- horizontal = {
- preview_width = function(_, cols, _)
- return math.floor(cols * 0.7)
- end,
- },
- },
- })
+ return require("alpha.php.gateway").graphql_definitions {
+ layout_config = {
+ horizontal = {
+ preview_width = function(_, cols, _)
+ return math.floor(cols * 0.7)
+ end,
+ },
+ },
+ }
end
function M.file_browser(opts)
- opts = opts or {}
+ opts = opts or {}
- opts = {
- path = opts.path,
- sorting_strategy = "ascending",
- scroll_strategy = "cycle",
- layout_config = {
- prompt_position = "top",
- },
+ opts = {
+ path = opts.path,
+ sorting_strategy = "ascending",
+ scroll_strategy = "cycle",
+ layout_config = {
+ prompt_position = "top",
+ },
- attach_mappings = function(_, map)
- map("i", "<c-y>", fb_actions.create)
+ attach_mappings = function(_, map)
+ map("i", "<c-y>", fb_actions.create)
- return true
- end,
- }
+ return true
+ end,
+ }
- return require("telescope").extensions.file_browser.file_browser(opts)
+ return require("telescope").extensions.file_browser.file_browser(opts)
end
return setmetatable({}, {
- __index = function(_, k)
- reloader()
- if M[k] then
- return M[k]
- else
- return require("telescope.builtin")[k]
- end
- end,
+ __index = function(_, k)
+ reloader()
+ if M[k] then
+ return M[k]
+ else
+ return require("telescope.builtin")[k]
+ end
+ end,
})
diff --git a/lua/alpha/telescope/mappings.lua b/lua/alpha/telescope/mappings.lua
index 0845110..7d0f697 100644
--- a/lua/alpha/telescope/mappings.lua
+++ b/lua/alpha/telescope/mappings.lua
@@ -1,21 +1,21 @@
TelescopeMapArgs = TelescopeMapArgs or {}
local map_tele = function(key, f, options, buffer, mode)
- mode = mode or "n"
+ mode = mode or "n"
- local rhs = function ()
- R('alpha.telescope')[f](options or {})
- end
+ local rhs = function()
+ R("alpha.telescope")[f](options or {})
+ end
- local map_options = {
- remap = false,
- silent = true,
- }
- if buffer then
- map_options.buffer = buffer
- end
+ local map_options = {
+ remap = false,
+ silent = true,
+ }
+ if buffer then
+ map_options.buffer = buffer
+ end
- vim.keymap.set(mode, key, rhs, map_options)
+ vim.keymap.set(mode, key, rhs, map_options)
end
-- not shure what this line does
diff --git a/lua/alpha/telescope/setup.lua b/lua/alpha/telescope/setup.lua
index 627eaed..5e4a562 100644
--- a/lua/alpha/telescope/setup.lua
+++ b/lua/alpha/telescope/setup.lua
@@ -1,165 +1,165 @@
-local actions = require("telescope.actions")
-local action_state = require("telescope.actions.state")
-local action_layout = require("telescope.actions.layout")
+local actions = require "telescope.actions"
+local action_state = require "telescope.actions.state"
+local action_layout = require "telescope.actions.layout"
local set_prompt_to_entry_value = function(prompt_bufnr)
- local entry = action_state.get_selected_entry()
- if not entry or not type(entry) == "table" then
- return
- end
+ local entry = action_state.get_selected_entry()
+ if not entry or not type(entry) == "table" then
+ return
+ end
- action_state.get_current_picker(prompt_bufnr):reset_prompt(entry.ordinal)
+ action_state.get_current_picker(prompt_bufnr):reset_prompt(entry.ordinal)
end
-require("telescope").setup({
- defaults = {
- prompt_prefix = "❯ ",
- selection_caret = "❯ ",
-
- winblend = 0,
-
- layout_strategy = "horizontal",
- layout_config = {
- width = 0.95,
- height = 0.85,
- -- preview_cutoff = 120,
- prompt_position = "bottom",
-
- horizontal = {
- preview_width = function(_, cols, _)
- if cols > 200 then
- return math.floor(cols * 0.5)
- else
- return math.floor(cols * 0.6)
- end
- end,
- },
-
- vertical = {
- width = 0.9,
- height = 0.95,
- preview_height = 0.5,
- },
-
- flex = {
- horizontal = {
- preview_width = 0.9,
- },
- },
- },
-
- selection_strategy = "reset",
- sorting_strategy = "descending",
- scroll_strategy = "cycle",
- color_devicons = true,
-
- mappings = {
- i = {
- ["<C-x>"] = false,
- ["<C-s>"] = actions.select_horizontal,
- ["<C-n>"] = "move_selection_next",
-
- ["<C-y>"] = set_prompt_to_entry_value,
-
- -- These are new :)
- ["<M-p>"] = action_layout.toggle_preview,
- ["<M-m>"] = action_layout.toggle_mirror,
- -- ["<M-p>"] = action_layout.toggle_prompt_position,
-
- -- ["<M-m>"] = actions.master_stack,
-
- -- ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
- -- ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
-
- -- This is nicer when used with smart-history plugin.
- ["<C-k>"] = actions.cycle_history_next,
- ["<C-j>"] = actions.cycle_history_prev,
-
- -- ["<c-space>"] = function(prompt_bufnr)
- -- local opts = {
- -- callback = actions.toggle_selection,
- -- loop_callback = actions.send_selected_to_qflist,
- -- }
- -- require("telescope").extensions.hop._hop_loop(prompt_bufnr, opts)
- -- end,
-
- -- ["<C-w>"] = function()
- -- vim.api.nvim_input("<c-s-w>")
- -- end,
- },
- },
-
- -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
- -- file_ignore_patterns = nil,
-
- file_previewer = require("telescope.previewers").vim_buffer_cat.new,
- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-
- history = {
- path = "~/.local/share/nvim/databases/telescope_history.sqlite3",
- limit = 100,
- },
- },
-
- pickers = {
- fd = {
- mappings = {
- n = {
- ["kj"] = "close",
- },
- },
- },
-
- git_branches = {
- mappings = {
- i = {
- ["<C-a>"] = false,
- },
- },
- },
- },
-
- extensions = {
- fzy_native = {
- override_generic_sorter = true,
- override_file_sorter = true,
- },
-
- fzf_writer = {
- use_highlighter = false,
- minimum_grep_characters = 6,
- },
-
- hop = {
- -- keys define your hop keys in order; defaults to roughly lower- and uppercased home row
- keys = { "a", "s", "d", "f", "g", "h", "j", "k", "l", ";" }, -- ... and more
-
- -- Highlight groups to link to signs and lines; the below configuration refers to demo
- -- sign_hl typically only defines foreground to possibly be combined with line_hl
- sign_hl = { "WarningMsg", "Title" },
-
- -- optional, typically a table of two highlight groups that are alternated between
- line_hl = { "CursorLine", "Normal" },
-
- -- options specific to `hop_loop`
- -- true temporarily disables Telescope selection highlighting
- clear_selection_hl = false,
- -- highlight hopped to entry with telescope selection highlight
- -- note: mutually exclusive with `clear_selection_hl`
- trace_entry = true,
- -- jump to entry where hoop loop was started from
- reset_selection = true,
- },
-
- ["ui-select"] = {
- require("telescope.themes").get_cursor({
- -- even more opts
- }),
- },
- },
-})
-_ = require("telescope").load_extension("notify")
-_ = require("telescope").load_extension("file_browser")
-_ = require("telescope").load_extension("ui-select")
-_ = require("telescope").load_extension("fzf")
+require("telescope").setup {
+ defaults = {
+ prompt_prefix = "❯ ",
+ selection_caret = "❯ ",
+
+ winblend = 0,
+
+ layout_strategy = "horizontal",
+ layout_config = {
+ width = 0.95,
+ height = 0.85,
+ -- preview_cutoff = 120,
+ prompt_position = "bottom",
+
+ horizontal = {
+ preview_width = function(_, cols, _)
+ if cols > 200 then
+ return math.floor(cols * 0.5)
+ else
+ return math.floor(cols * 0.6)
+ end
+ end,
+ },
+
+ vertical = {
+ width = 0.9,
+ height = 0.95,
+ preview_height = 0.5,
+ },
+
+ flex = {
+ horizontal = {
+ preview_width = 0.9,
+ },
+ },
+ },
+
+ selection_strategy = "reset",
+ sorting_strategy = "descending",
+ scroll_strategy = "cycle",
+ color_devicons = true,
+
+ mappings = {
+ i = {
+ ["<C-x>"] = false,
+ ["<C-s>"] = actions.select_horizontal,
+ ["<C-n>"] = "move_selection_next",
+
+ ["<C-y>"] = set_prompt_to_entry_value,
+
+ -- These are new :)
+ ["<M-p>"] = action_layout.toggle_preview,
+ ["<M-m>"] = action_layout.toggle_mirror,
+ -- ["<M-p>"] = action_layout.toggle_prompt_position,
+
+ -- ["<M-m>"] = actions.master_stack,
+
+ -- ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
+ -- ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
+
+ -- This is nicer when used with smart-history plugin.
+ ["<C-k>"] = actions.cycle_history_next,
+ ["<C-j>"] = actions.cycle_history_prev,
+
+ -- ["<c-space>"] = function(prompt_bufnr)
+ -- local opts = {
+ -- callback = actions.toggle_selection,
+ -- loop_callback = actions.send_selected_to_qflist,
+ -- }
+ -- require("telescope").extensions.hop._hop_loop(prompt_bufnr, opts)
+ -- end,
+
+ -- ["<C-w>"] = function()
+ -- vim.api.nvim_input("<c-s-w>")
+ -- end,
+ },
+ },
+
+ -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
+ -- file_ignore_patterns = nil,
+
+ file_previewer = require("telescope.previewers").vim_buffer_cat.new,
+ grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
+ qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
+
+ history = {
+ path = "~/.local/share/nvim/databases/telescope_history.sqlite3",
+ limit = 100,
+ },
+ },
+
+ pickers = {
+ fd = {
+ mappings = {
+ n = {
+ ["kj"] = "close",
+ },
+ },
+ },
+
+ git_branches = {
+ mappings = {
+ i = {
+ ["<C-a>"] = false,
+ },
+ },
+ },
+ },
+
+ extensions = {
+ fzy_native = {
+ override_generic_sorter = true,
+ override_file_sorter = true,
+ },
+
+ fzf_writer = {
+ use_highlighter = false,
+ minimum_grep_characters = 6,
+ },
+
+ hop = {
+ -- keys define your hop keys in order; defaults to roughly lower- and uppercased home row
+ keys = { "a", "s", "d", "f", "g", "h", "j", "k", "l", ";" }, -- ... and more
+
+ -- Highlight groups to link to signs and lines; the below configuration refers to demo
+ -- sign_hl typically only defines foreground to possibly be combined with line_hl
+ sign_hl = { "WarningMsg", "Title" },
+
+ -- optional, typically a table of two highlight groups that are alternated between
+ line_hl = { "CursorLine", "Normal" },
+
+ -- options specific to `hop_loop`
+ -- true temporarily disables Telescope selection highlighting
+ clear_selection_hl = false,
+ -- highlight hopped to entry with telescope selection highlight
+ -- note: mutually exclusive with `clear_selection_hl`
+ trace_entry = true,
+ -- jump to entry where hoop loop was started from
+ reset_selection = true,
+ },
+
+ ["ui-select"] = {
+ require("telescope.themes").get_cursor {
+ -- even more opts
+ },
+ },
+ },
+}
+_ = require("telescope").load_extension "notify"
+_ = require("telescope").load_extension "file_browser"
+_ = require("telescope").load_extension "ui-select"
+_ = require("telescope").load_extension "fzf"