init.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. -- if not package.loaded['which-key'] then
  2. -- return
  3. -- end
  4. local status_ok, which_key = pcall(require, "which-key")
  5. if not status_ok then
  6. return
  7. end
  8. which_key.setup(O.plugin.which_key.setup)
  9. local opts = O.plugin.which_key.opts
  10. local vopts = O.plugin.which_key.vopts
  11. local mappings = O.plugin.which_key.mappings
  12. local vmappings = O.plugin.which_key.vmappings;
  13. -- if O.plugin.ts_playground.active then
  14. -- vim.api.nvim_set_keymap("n", "<leader>Th", ":TSHighlightCapturesUnderCursor<CR>", { noremap = true, silent = true })
  15. -- mappings[""] = "Highlight Capture"
  16. -- end
  17. if O.plugin.zen.active then
  18. vim.api.nvim_set_keymap("n", "<leader>z", ":ZenMode<CR>", { noremap = true, silent = true })
  19. mappings["z"] = "Zen"
  20. end
  21. if O.plugin.telescope_project.active then
  22. -- open projects
  23. vim.api.nvim_set_keymap(
  24. "n",
  25. "<leader>P",
  26. ":lua require'telescope'.extensions.project.project{}<CR>",
  27. { noremap = true, silent = true }
  28. )
  29. mappings["P"] = "Projects"
  30. end
  31. if O.plugin.lush.active then
  32. mappings["L"] = {
  33. name = "+Lush",
  34. l = { ":Lushify<cr>", "Lushify" },
  35. x = { ":lua require('lush').export_to_buffer(require('lush_theme.cool_name'))", "Lush Export" },
  36. t = { ":LushRunTutorial<cr>", "Lush Tutorial" },
  37. q = { ":LushRunQuickstart<cr>", "Lush Quickstart" },
  38. }
  39. end
  40. for k, v in pairs(O.user_which_key) do
  41. mappings[k] = v
  42. end
  43. local wk = require "which-key"
  44. wk.register(mappings, opts)
  45. wk.register(vmappings, vopts)