1
0

plugins.lua 3.1 KB

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