diff --git a/init.lua b/init.lua index f8d9383f..46472298 100644 --- a/init.lua +++ b/init.lua @@ -195,7 +195,7 @@ require('lazy').setup({ -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.debug', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping @@ -203,7 +203,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] @@ -214,7 +214,7 @@ require('lazy').setup({ vim.o.hlsearch = false -- Make line numbers default -vim.wo.number = true +vim.wo.relativenumber = true -- Enable mouse mode vim.o.mouse = 'a' @@ -248,6 +248,10 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true +-- Whichkey initialize + +local wk = require("which-key") + -- [[ Basic Keymaps ]] -- Keymaps for better default experience @@ -256,7 +260,7 @@ vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) -- Remap for dealing with word wrap vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true}) -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` @@ -284,6 +288,11 @@ require('telescope').setup { -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') +wk.register({ + s = { + name = "search", + }, + }, {prefix = ""}) -- See `:help telescope.builtin` vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) @@ -384,6 +393,11 @@ local on_attach = function(_, bufnr) -- -- In this case, we create a function that lets us more easily define mappings specific -- for LSP related items. It sets the mode, buffer and description for us each time. +wk.register({ + l = { + name = "LSP", + }, + }, {prefix = ""}) local nmap = function(keys, func, desc) if desc then desc = 'LSP: ' .. desc @@ -392,15 +406,16 @@ local on_attach = function(_, bufnr) vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) end - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + nmap('lr', vim.lsp.buf.rename, '[L] [R]ename') + nmap('lc', vim.lsp.buf.code_action, '[L] Code [A]ction') + nmap('lf', vim.lsp.buf.format, '[L] [F]ormat') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + nmap('ls', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('lw', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') -- See `:help K` for why this keymap nmap('K', vim.lsp.buf.hover, 'Hover Documentation') diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7fc783fa..229d095f 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -41,14 +41,21 @@ return { 'delve', }, } + local wk = require("which-key") + +wk.register({ + d = { + name = "debug", + }, +}, { prefix = "" }) -- Basic debugging keymaps, feel free to change to your liking! vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) - vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) - vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) - vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) - vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) - vim.keymap.set('n', 'B', function() + vim.keymap.set('n', 'de', dap.step_into, { desc = 'Debug: Step Into' }) + vim.keymap.set('n', 'dr', dap.step_over, { desc = 'Debug: Step Over' }) + vim.keymap.set('n', 'do', dap.step_out, { desc = 'Debug: Step Out' }) + vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) + vim.keymap.set('n', 'dB', function() dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, { desc = 'Debug: Set Breakpoint' })