config.lua 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. O.plugin.which_key = {
  2. active = false,
  3. setup = {
  4. plugins = {
  5. marks = true, -- shows a list of your marks on ' and `
  6. registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
  7. -- the presets plugin, adds help for a bunch of default keybindings in Neovim
  8. -- No actual key bindings are created
  9. presets = {
  10. operators = false, -- adds help for operators like d, y, ...
  11. motions = false, -- adds help for motions
  12. text_objects = false, -- help for text objects triggered after entering an operator
  13. windows = true, -- default bindings on <c-w>
  14. nav = true, -- misc bindings to work with windows
  15. z = true, -- bindings for folds, spelling and others prefixed with z
  16. g = true, -- bindings for prefixed with g
  17. },
  18. spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints
  19. },
  20. icons = {
  21. breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
  22. separator = "➜", -- symbol used between a key and it's label
  23. group = "+", -- symbol prepended to a group
  24. },
  25. window = {
  26. border = "single", -- none, single, double, shadow
  27. position = "bottom", -- bottom, top
  28. margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
  29. padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
  30. },
  31. layout = {
  32. height = { min = 4, max = 25 }, -- min and max height of the columns
  33. width = { min = 20, max = 50 }, -- min and max width of the columns
  34. spacing = 3, -- spacing between columns
  35. },
  36. hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
  37. show_help = true, -- show help message on the command line when the popup is visible
  38. },
  39. opts = {
  40. mode = "n", -- NORMAL mode
  41. prefix = "<leader>",
  42. buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
  43. silent = true, -- use `silent` when creating keymaps
  44. noremap = true, -- use `noremap` when creating keymaps
  45. nowait = true, -- use `nowait` when creating keymaps
  46. },
  47. vopts = {
  48. mode = "v", -- VISUAL mode
  49. prefix = "<leader>",
  50. buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
  51. silent = true, -- use `silent` when creating keymaps
  52. noremap = true, -- use `noremap` when creating keymaps
  53. nowait = true, -- use `nowait` when creating keymaps
  54. },
  55. -- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode.
  56. -- see https://neovim.io/doc/user/map.html#:map-cmd
  57. vmappings ={
  58. ["/"] = { ":CommentToggle<CR>", "Comment" },
  59. },
  60. mappings = {
  61. ["w"] = { "<cmd>w!<CR>", "Save" },
  62. ["q"] = { "<cmd>q!<CR>", "Quit" },
  63. ["/"] = { "<cmd>CommentToggle<CR>", "Comment" },
  64. ["c"] = { "<cmd>BufferClose<CR>", "Close Buffer" },
  65. ["e"] = { "<cmd>lua require'lv-nvimtree'.toggle_tree()<CR>", "Explorer" },
  66. ["f"] = { "<cmd>Telescope find_files<CR>", "Find File" },
  67. ["h"] = { '<cmd>let @/=""<CR>', "No Highlight" },
  68. [";"] = { "<cmd>Dashboard<CR>", "Dashboard" },
  69. p = {
  70. name = "Packer",
  71. c = { "<cmd>PackerCompile<cr>", "Compile" },
  72. i = { "<cmd>PackerInstall<cr>", "Install" },
  73. r = { "<cmd>lua require('lv-utils').reload_lv_config()<cr>", "Reload" },
  74. s = { "<cmd>PackerSync<cr>", "Sync" },
  75. u = { "<cmd>PackerUpdate<cr>", "Update" },
  76. },
  77. -- " Available Debug Adapters:
  78. -- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
  79. -- " Adapter configuration and installation instructions:
  80. -- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
  81. -- " Debug Adapter protocol:
  82. -- " https://microsoft.github.io/debug-adapter-protocol/
  83. -- " Debugging
  84. g = {
  85. name = "Git",
  86. j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
  87. k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
  88. l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
  89. p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
  90. r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
  91. R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
  92. s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
  93. u = {
  94. "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
  95. "Undo Stage Hunk",
  96. },
  97. o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
  98. b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
  99. c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
  100. C = {
  101. "<cmd>Telescope git_bcommits<cr>",
  102. "Checkout commit(for current file)",
  103. },
  104. },
  105. l = {
  106. name = "LSP",
  107. a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
  108. d = {
  109. "<cmd>Telescope lsp_document_diagnostics<cr>",
  110. "Document Diagnostics",
  111. },
  112. w = {
  113. "<cmd>Telescope lsp_workspace_diagnostics<cr>",
  114. "Workspace Diagnostics",
  115. },
  116. f = { "<cmd>FormatWrite<cr>", "Format" },
  117. i = { "<cmd>LspInfo<cr>", "Info" },
  118. j = { "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>", "Next Diagnostic" },
  119. k = { "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>", "Prev Diagnostic" },
  120. q = { "<cmd>Telescope quickfix<cr>", "Quickfix" },
  121. r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
  122. s = { "<cmd> Telescope lsp_document_symbols<cr>", "Document Symbols" },
  123. S = {
  124. "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
  125. "Workspace Symbols",
  126. },
  127. },
  128. s = {
  129. name = "Search",
  130. b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
  131. c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
  132. f = { "<cmd>Telescope find_files<cr>", "Find File" },
  133. h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
  134. M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
  135. r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
  136. R = { "<cmd>Telescope registers<cr>", "Registers" },
  137. t = { "<cmd>Telescope live_grep<cr>", "Text" },
  138. k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
  139. C = { "<cmd>Telescope commands<cr>", "Commands" },
  140. },
  141. T = {
  142. name = "Treesitter",
  143. i = { ":TSConfigInfo<cr>", "Info" },
  144. },
  145. },
  146. }