init.lua 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. local actions = require "telescope.actions"
  2. -- if O.plugin.trouble.active then
  3. -- local trouble = require("trouble.providers.telescope")
  4. -- end
  5. -- Global remapping
  6. ------------------------------
  7. -- '--color=never',
  8. require("telescope").setup {
  9. defaults = {
  10. find_command = {
  11. "rg",
  12. "--no-heading",
  13. "--with-filename",
  14. "--line-number",
  15. "--column",
  16. "--smart-case",
  17. },
  18. prompt_prefix = " ",
  19. selection_caret = " ",
  20. entry_prefix = " ",
  21. initial_mode = "insert",
  22. selection_strategy = "reset",
  23. sorting_strategy = "descending",
  24. layout_strategy = "horizontal",
  25. layout_config = {
  26. width = 0.75,
  27. prompt_position = "bottom",
  28. preview_cutoff = 120,
  29. horizontal = { mirror = false },
  30. vertical = { mirror = false },
  31. },
  32. file_sorter = require("telescope.sorters").get_fzy_sorter,
  33. file_ignore_patterns = {},
  34. generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
  35. shorten_path = true,
  36. winblend = 0,
  37. border = {},
  38. borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
  39. color_devicons = true,
  40. use_less = true,
  41. set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
  42. file_previewer = require("telescope.previewers").vim_buffer_cat.new,
  43. grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
  44. qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
  45. -- Developer configurations: Not meant for general override
  46. buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
  47. mappings = {
  48. i = {
  49. ["<C-c>"] = actions.close,
  50. ["<C-j>"] = actions.move_selection_next,
  51. ["<C-k>"] = actions.move_selection_previous,
  52. -- ["<c-t>"] = trouble.open_with_trouble,
  53. ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
  54. -- To disable a keymap, put [map] = false
  55. -- So, to not map "<C-n>", just put
  56. -- ["<c-x>"] = false,
  57. -- ["<esc>"] = actions.close,
  58. -- Otherwise, just set the mapping to the function that you want it to be.
  59. -- ["<C-i>"] = actions.select_horizontal,
  60. -- Add up multiple actions
  61. ["<CR>"] = actions.select_default + actions.center,
  62. -- You can perform as many actions in a row as you like
  63. -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
  64. },
  65. n = {
  66. ["<C-j>"] = actions.move_selection_next,
  67. ["<C-k>"] = actions.move_selection_previous,
  68. -- ["<c-t>"] = trouble.open_with_trouble,
  69. ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
  70. -- ["<C-i>"] = my_cool_custom_action,
  71. },
  72. },
  73. },
  74. extensions = {
  75. fzy_native = {
  76. override_generic_sorter = false,
  77. override_file_sorter = true,
  78. },
  79. },
  80. }
  81. -- require'telescope'.load_extension('project')