init.lua 3.1 KB

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