plugins.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. -- file/buffer/etc picker
  2. require('telescope').setup({
  3. defaults = {
  4. mappings = {
  5. i = {
  6. ['jj'] = 'close',
  7. ['<C-j>'] = 'move_selection_next',
  8. ['<C-k>'] = 'move_selection_previous',
  9. },
  10. },
  11. layout_config = {
  12. prompt_position = 'top',
  13. },
  14. sorting_strategy = 'ascending',
  15. },
  16. pickers = {
  17. buffers = {
  18. sort_lastused = true,
  19. sort_mru = true,
  20. },
  21. find_files = {
  22. find_command = { "fd", "--type", "f", "--strip-cwd-prefix" }
  23. },
  24. },
  25. })
  26. -- use native sorter for better performance
  27. require('telescope').load_extension('fzf')
  28. -- custom picker to fallback to files if no git
  29. local telescope_builtin = require('telescope.builtin')
  30. _G.project_files = function()
  31. local opts = {}
  32. local ok = pcall(telescope_builtin.git_files, opts)
  33. if not ok then telescope_builtin.find_files(opts) end
  34. end
  35. -- shows added/removed/changed lines
  36. require('gitsigns').setup()
  37. require('mini.statusline').setup({
  38. content = {
  39. -- copy-pasted from default, we just want to remove the icon
  40. active = function()
  41. local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
  42. local git = MiniStatusline.section_git({ trunc_width = 75, icon = '' })
  43. local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75, icon = '' })
  44. local filename = MiniStatusline.section_filename({ trunc_width = 140 })
  45. local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
  46. local location = MiniStatusline.section_location({ trunc_width = 75 })
  47. return MiniStatusline.combine_groups({
  48. { hl = mode_hl, strings = { mode } },
  49. { hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics } },
  50. '%<', -- Mark general truncate point
  51. { hl = 'MiniStatuslineFilename', strings = { filename } },
  52. '%=', -- End left alignment
  53. { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } },
  54. { hl = mode_hl, strings = { location } },
  55. })
  56. end
  57. },
  58. })
  59. -- delete buffer while preserving layout
  60. require('mini.bufremove').setup()
  61. -- shows a line indicating the current indentation scope
  62. require('mini.indentscope').setup()
  63. -- comment actions
  64. require('mini.comment').setup()
  65. -- LSP completion and function signature display
  66. require('mini.completion').setup({
  67. delay = {
  68. -- disable autocomplete
  69. completion = 100000000,
  70. info = 100,
  71. signature = 50,
  72. },
  73. lsp_completion = {
  74. source_func = 'omnifunc',
  75. auto_setup = false,
  76. },
  77. });
  78. -- Use Treesitter for syntax highlighting
  79. require('nvim-treesitter.configs').setup({
  80. highlight = {
  81. enable = true,
  82. },
  83. textobjects = {
  84. select = {
  85. enable = true,
  86. keymaps = {
  87. ['i,'] = '@parameter.inner',
  88. ['a,'] = '@parameter.outer',
  89. },
  90. },
  91. swap = {
  92. enable = true,
  93. swap_next = {
  94. ['>,'] = '@parameter.inner',
  95. },
  96. swap_previous = {
  97. ['<,'] = '@parameter.inner',
  98. },
  99. },
  100. },
  101. })