diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-31 09:44:13 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-31 09:44:13 +0100 |
| commit | 669561e21073e6efafddda25ba3ace69fb43819e (patch) | |
| tree | f94ebd60ad4cab480b5cbcb7e65dd2060696c339 /lua/alpha/telescope/setup.lua | |
| parent | 5044c70e9f62cdd06ee91e754423b07c1c18c12d (diff) | |
| download | nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.tar.gz nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.zip | |
feat: apply stylua
Diffstat (limited to 'lua/alpha/telescope/setup.lua')
| -rw-r--r-- | lua/alpha/telescope/setup.lua | 320 |
1 files changed, 160 insertions, 160 deletions
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" |