0
0

command-palette.lua 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. return {
  2. {
  3. dir = "../custom/command-palette",
  4. name = "command-palette",
  5. dependencies = { "nvim-telescope/telescope.nvim" },
  6. enabled = true,
  7. config = function(_, _)
  8. local palette = require("command-palette")
  9. palette.add({
  10. {
  11. "Manage project", "", {
  12. {
  13. "Close project",
  14. "Safely close the project and then close the associated tmux pane",
  15. function()
  16. vim.api.nvim_create_autocmd({ "VimLeave" }, {
  17. pattern = { "*" },
  18. group = vim.api.nvim_create_augroup(
  19. "tmux_close_group", { clear = true }),
  20. callback = function()
  21. vim.api.nvim_exec("!tmux kill-pane",
  22. false)
  23. end
  24. })
  25. vim.api.nvim_exec("qa", true)
  26. end
  27. }
  28. }
  29. }
  30. })
  31. vim.keymap.set("n", "sP", palette.open)
  32. vim.keymap.set("n", "sp", palette.open_full)
  33. vim.keymap.set("n", "sL", function()
  34. palette.open({}, "LSP Finders", {
  35. { "Treesitter", "", ":Telescope treesitter" },
  36. { "LSP References", "", ":Telescope lsp_references" },
  37. { "LSP Incoming Calls", "", ":Telescope lsp_incoming_calls" },
  38. { "LSP Outgoing Calls", "", ":Telescope lsp_outgoing_calls" },
  39. {
  40. "LSP Document Symbols", "",
  41. ":Telescope lsp_document_symbols"
  42. },
  43. {
  44. "LSP Workspace Symbols", "",
  45. ":Telescope lsp_workspace_symbols"
  46. }, {
  47. "LSP Dynamic Workspace Symbols", "",
  48. ":Telescope lsp_dynamic_workspace_symbols"
  49. }, { "Diagnostics", "", ":Telescope diagnostics" },
  50. {
  51. "LSP Implementations", "",
  52. ":Telescope lsp_implementations"
  53. }, { "LSP Definitions", "", ":Telescope lsp_definitions" },
  54. {
  55. "LSP Type Definitions", "",
  56. ":Telescope lsp_type_definitions"
  57. }
  58. })
  59. end)
  60. end
  61. }, {
  62. dir = "../../custom/bit-browser/",
  63. name = "bit-browser",
  64. enabled = true,
  65. dependencies = { "command-palette" },
  66. config = function(_, _)
  67. local bitbrowser = require("bit-browser")
  68. vim.keymap.set("n", "n", bitbrowser.next)
  69. vim.keymap.set("n", "N", bitbrowser.prev)
  70. vim.keymap.set("n", "sne", function()
  71. bitbrowser.set_target(1);
  72. bitbrowser.next()
  73. end)
  74. vim.keymap.set("n", "snw", function()
  75. bitbrowser.set_target(2);
  76. bitbrowser.next()
  77. end)
  78. vim.keymap.set("n", "sni", function()
  79. bitbrowser.set_target(3);
  80. bitbrowser.next()
  81. end)
  82. vim.keymap.set("n", "snd", function()
  83. bitbrowser.set_target(4);
  84. bitbrowser.next()
  85. end)
  86. vim.keymap.set("n", "sns", function()
  87. bitbrowser.set_target(5);
  88. bitbrowser.next()
  89. end)
  90. vim.keymap.set("n", "sng", function()
  91. bitbrowser.set_target(6);
  92. bitbrowser.next()
  93. end)
  94. end
  95. }, {
  96. dir = "../custom/save-formatter",
  97. name = "save-formatter",
  98. dependencies = { "nvim-telescope/telescope.nvim", "command-palette" },
  99. enabled = true,
  100. config = function(_, _)
  101. local formatter = require("save-formatter")
  102. formatter.setup()
  103. vim.keymap.set("n", "Sw",
  104. function() vim.api.nvim_exec("w", true) end)
  105. local palette = require("command-palette")
  106. palette.add({
  107. {
  108. "Save Formatter", "Automatic formatting on save", formatter
  109. .picker }
  110. })
  111. end
  112. }
  113. }