diff --git a/lua/aquila/plugins/telescope.lua b/lua/aquila/plugins/telescope.lua index f80ab52..74bd28b 100644 --- a/lua/aquila/plugins/telescope.lua +++ b/lua/aquila/plugins/telescope.lua @@ -7,27 +7,6 @@ return { { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, }, config = function() - -- Dont Preview binaries - local previewers = require("telescope.previewers") - local Job = require("plenary.job") - local new_maker = function(filepath, bufnr, opts) - filepath = vim.fn.expand(filepath) - Job:new({ - command = "file", - args = { "--mime-type", "-b", filepath }, - on_exit = function(j) - local mime_type = vim.split(j:result()[1], "/")[1] - if mime_type == "text" then - previewers.buffer_previewer_maker(filepath, bufnr, opts) - else - vim.schedule(function() - vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" }) - end) - end - end - }):sync() - end - local telescope = require('telescope') local actions = require('telescope.actions') local themes = require('telescope.themes') @@ -37,7 +16,6 @@ return { telescope.setup({ defaults = { - buffer_previewer_maker = new_maker, mappings = { n = { ['q'] = actions.close @@ -46,65 +24,20 @@ return { }, }) - -- function AquilaRecentFiles() - -- -- require('telescope.builtin').oldfiles({ - -- -- cwd_only = true, - -- -- initial_mode = 'normal', - -- -- layout_strategy = 'vertical', - -- -- layout_corfig = { - -- -- vertical = { - -- -- height = 0.8, - -- -- preview_cutoff = 1, - -- -- preview_height = 0.3 - -- -- } - -- -- } - -- -- }) - -- local builtin = require('telescope.builtin') - -- local themes = require('telescope.themes') - -- local opts = themes.get_dropdown({ - -- winblend = 10, - -- previewer = false, - -- initial_mode = 'normal', - -- cwd_only = true, - -- }) - -- - -- builtin.oldfiles(opts) - -- end - -- - -- function AquilaFindFilesCommon() - -- local builtin = require('telescope.builtin') - -- local opts = { - -- winblend = 10, - -- layout_strategy = 'center', - -- layout_config = { - -- center = { - -- preview_cutoff = 1, - -- } - -- } - -- } - -- - -- builtin.find_files(opts) - -- end - - -- vim.keymap.set('n', 'ff', 'Telescope find_files', { desc = "Find files in cwd" }) - -- vim.keymap.set('n', '', - -- "lua AquilaFindFilesCommon()", - -- { desc = "Find files in cwd" }) - -- require('which-key').register({ - -- ["f"] = { name = "+telescope" } - -- }) - vim.keymap.set('n', 'fa', function() - builtin.find_files({ - no_ignore = true, - hidden = true, - }) - end, { desc = "Find all without respect anything" }) + builtin.find_files({ + no_ignore = true, + hidden = true, + }) + end, + { desc = "Find all without respect anything" } + ) vim.keymap.set("n", "fr", function() builtin.oldfiles({ initial_mode = 'normal' }) end, - { desc = "List previously open files all dir" }) + { desc = "List previously open files all dir" } + ) vim.keymap.set("n", "", function() builtin.oldfiles(themes.get_dropdown({ @@ -113,70 +46,82 @@ return { cwd_only = true, })) end, - { desc = 'List previously open files on cwd' }) + { desc = 'List previously open files on cwd' } + ) vim.keymap.set("n", "fs", function() builtin.live_grep() end, { desc = "Find string in cwd" }) vim.keymap.set("n", "fc", function() - builtin.grep_string() - end, { desc = "Find string under cursor in cwd" }) + builtin.grep_string() + end, + { desc = "Find string under cursor in cwd" } + ) - -- vim.keymap.set("n", "fb", function() - -- builtin.buffers({ initial_mode = 'normal' }) - -- end, - -- { desc = "list of buffers" }) + vim.keymap.set("n", "fb", function() + builtin.buffers({ initial_mode = 'normal' }) + end, + { desc = "list of buffers" } + ) - vim.keymap.set('n', "flr", - function() + vim.keymap.set('n', "flr", function() builtin.lsp_references({ initial_mode = 'normal' }) - end, { - desc = "List of references" - }) + end, + { desc = "List of references" } + ) - vim.keymap.set('n', "fls", - function() + vim.keymap.set('n', "fls", function() builtin.lsp_document_symbols() - end, { - desc = "List of symbols" - }) - -- vim.keymap.set('n', "flw", - -- " lua require('telescope.builtin').lsp_workspace_symbols({initial_mode = 'normal'}) ", { - -- desc = "List of workspace symbols" - -- }) - vim.keymap.set('n', "flS", - function() + end, + { desc = "List of symbols" } + ) + + vim.keymap.set('n', "flw", + " lua require('telescope.builtin').lsp_workspace_symbols({initial_mode = 'normal'}) ", { + desc = "List of workspace symbols" + } + ) + + vim.keymap.set('n', "flS", function() builtin.lsp_dynamic_workspace_symbols() - end, { - desc = "List of dynamic workspace symbols" - }) - vim.keymap.set('n', "fld", - function() + end, + { desc = "List of dynamic workspace symbols" } + ) + + vim.keymap.set('n', "fld", function() builtin.diagnostics({ bufnr = 0, initial_mode = 'normal' }) end, - { desc = "List of diagnostics document" }) + { desc = "List of diagnostics document" } + ) - -- vim.keymap.set('n', "flii", - -- " lua require('telescope.builtin').lsp_implementations({initial_mode = 'normal'}) ", { - -- desc = "List of implementations" - -- }) - -- vim.keymap.set('n', "fldD", - -- " lua require('telescope.builtin').lsp_type_definitions({initial_mode = 'normal'}) ", { - -- desc = "List of type definitions" - -- }) + vim.keymap.set('n', "flii", + " lua require('telescope.builtin').lsp_implementations({initial_mode = 'normal'}) ", { + desc = "List of implementations" + }) + + vim.keymap.set('n', "fldD", + " lua require('telescope.builtin').lsp_type_definitions({initial_mode = 'normal'}) ", { + desc = "List of type definitions" + } + ) vim.keymap.set("n", "fh", function() builtin.help_tags() end, - { desc = "List of help tags" }) + { desc = "List of help tags" } + ) vim.keymap.set('n', "f/", function() - builtin.resume() - end, { desc = "Resume last telescope" }) + builtin.resume() + end, + { desc = "Resume last telescope" } + ) vim.keymap.set('n', "fi", function() - builtin.highlights() - end, { desc = "Lists all available highlights" }) + builtin.highlights() + end, + { desc = "Lists all available highlights" } + ) end }