config.lua 2.7 KB

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