which-key.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. local o = vim.opt
  2. local g = vim.g
  3. local wk = require("which-key")
  4. o.timeout = true
  5. o.timeoutlen = 300
  6. g.mapleader = " "
  7. wk.setup({})
  8. local mappings = {
  9. ["/"] = { "<cmd>Telescope live_grep<cr>", "Live Grep" },
  10. ["w"] = { "<cmd>update!<CR>", "Save" },
  11. ["q"] = { "<cmd>q!<CR>", "Quit" },
  12. b = { "<cmd>Telescope buffers<cr>", "Buffers" },
  13. f = {
  14. name = "File",
  15. f = { "<cmd>Telescope find_files<cr>", "Find File" },
  16. r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
  17. n = { "<cmd>enew<cr>", "New File" },
  18. },
  19. g = {
  20. name = "Git",
  21. s = { "<cmd>Neogit<CR>", "Status" },
  22. },
  23. k = { "<cmd>lua vim.lsp.buf.signature_help()<cr>", "Signature Help" },
  24. p = { "\"+p", "Paste from clipboard" },
  25. P = { "\"+P", "Paste from clipboard before cursor" },
  26. y = { "\"+y", "Yank to clipboard" },
  27. }
  28. local opts = {
  29. mode = "n", -- Normal mode
  30. prefix = "<leader>",
  31. buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
  32. silent = true, -- use `silent` when creating keymaps
  33. noremap = true, -- use `noremap` when creating keymaps
  34. nowait = false, -- use `nowait` when creating keymaps
  35. }
  36. local conf = {
  37. window = {
  38. border = "single", -- none, single, double, shadow
  39. position = "bottom", -- bottom, top
  40. },
  41. }
  42. wk.setup(conf)
  43. wk.register(mappings, opts)