diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/aotrix/plugins/telescope.lua | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/lua/aotrix/plugins/telescope.lua b/lua/aotrix/plugins/telescope.lua index 6fc4773..6639b07 100644 --- a/lua/aotrix/plugins/telescope.lua +++ b/lua/aotrix/plugins/telescope.lua @@ -5,7 +5,7 @@ return { dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope-live-grep-args.nvim', 'nvim-telescope/telescope-file-browser.nvim', - { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + {'nvim-telescope/telescope-fzf-native.nvim', build = 'make'}, 'nvim-telescope/telescope-ui-select.nvim' }, @@ -22,11 +22,22 @@ return { -- e.g. git_{create, delete, ...}_branch for the git_branches picker ["<esc>"] = actions.close } - } + }, + -- Layout settings + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + width = {padding = 0}, + height = {padding = 0}, + preview_width = 0.5 + } + }, + sorting_strategy = "ascending" }, extensions = { fzf = {}, - ['ui-select'] = { require('telescope.themes').get_dropdown() } + ['ui-select'] = {require('telescope.themes').get_dropdown()} } }) @@ -37,9 +48,9 @@ return { require("telescope").extensions.file_browser.file_browser() end) vim.keymap.set("n", "<leader>pf", - function() - require("telescope.builtin").find_files() - end) + function() + require("telescope.builtin").find_files() + end) require('aotrix.multigrep').setup() @@ -47,10 +58,10 @@ return { vim.keymap.del("n", "grr") vim.keymap.del("n", "grn") vim.keymap.del("n", "grt") - vim.keymap.del({ "n", "x" }, "gra") + vim.keymap.del({"n", "x"}, "gra") vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }), + group = vim.api.nvim_create_augroup('lsp-attach', {clear = true}), callback = function(event) -- NOTE: Remember that Lua is a real programming language, and as such it is possible -- to define small helper and utility functions so you don't have to repeat yourself. @@ -60,7 +71,7 @@ return { local map = function(keys, func, desc, mode) mode = mode or 'n' vim.keymap.set(mode, keys, func, - { buffer = event.buf, desc = 'LSP: ' .. desc }) + {buffer = event.buf, desc = 'LSP: ' .. desc}) end -- Jump to the definition of the word under your cursor. @@ -104,7 +115,7 @@ return { -- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', - { 'n', 'x' }) + {'n', 'x'}) -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. @@ -119,7 +130,7 @@ return { if vim.fn.has 'nvim-0.11' == 1 then return client:supports_method(method, bufnr) else - return client.supports_method(method, { bufnr = bufnr }) + return client.supports_method(method, {bufnr = bufnr}) end end @@ -130,28 +141,28 @@ return { -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) if client and client_supports_method(client, vim.lsp.protocol - .Methods - .textDocument_documentHighlight, - event.buf) then + .Methods + .textDocument_documentHighlight, + event.buf) then local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', - { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + {clear = false}) + vim.api.nvim_create_autocmd({'CursorHold', 'CursorHoldI'}, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight }) - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, - { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references - }) + vim.api.nvim_create_autocmd({'CursorMoved', 'CursorMovedI'}, + { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references + }) vim.api.nvim_create_autocmd('LspDetach', { group = vim.api.nvim_create_augroup('lsp-detach', - { clear = true }), + {clear = true}), callback = function(event2) vim.lsp.buf.clear_references() vim.api.nvim_clear_autocmds { @@ -168,8 +179,8 @@ return { -- This may be unwanted, since they displace some of your code if client and client_supports_method(client, vim.lsp.protocol.Methods - .textDocument_inlayHint, - event.buf) then + .textDocument_inlayHint, + event.buf) then map('<leader>th', function() vim.lsp.inlay_hint.enable( not vim.lsp.inlay_hint.is_enabled { |
