From 2e0d6e1637b7ae633d9fc8b17ac59e340ff6694e Mon Sep 17 00:00:00 2001 From: Adam Poniatowski Date: Tue, 29 Apr 2025 17:45:34 +0200 Subject: [PATCH] further fixes and mods. still not really done yet --- lua/core/keymaps.lua | 1 + lua/options/settings.lua | 6 ++ lua/plugins/colorscheme.lua | 1 + lua/plugins/dadbod.lua | 1 + lua/plugins/init.lua | 1 + lua/plugins/leap.lua | 1 + lua/plugins/session.lua | 1 + lua/plugins/snacks/init.lua | 4 +- lua/plugins/which-key.lua | 164 +++++++++++++++++++++--------------- 9 files changed, 112 insertions(+), 68 deletions(-) diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua index b87c973e..5aaca131 100644 --- a/lua/core/keymaps.lua +++ b/lua/core/keymaps.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: undefined-global -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) diff --git a/lua/options/settings.lua b/lua/options/settings.lua index b7fa2948..0faa11df 100644 --- a/lua/options/settings.lua +++ b/lua/options/settings.lua @@ -59,6 +59,12 @@ vim.opt.list = true -- Use a vertical bar for tabs so ibl and listchars both show vertical guides vim.opt.listchars = { tab = '│ ', trail = '·', nbsp = '␣' } +-- Set tab size and convert tabs to spaces +vim.opt.tabstop = 2 -- Number of visual spaces per TAB +vim.opt.shiftwidth = 2 -- Number of spaces to use for each step of (auto)indent +vim.opt.softtabstop = 2 -- Number of spaces that a counts for while performing editing operations +vim.opt.expandtab = true -- Use spaces instead of tabs + -- Preview substitutions live, as you type! vim.opt.inccommand = 'split' diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 40f77dd4..5dc5d2b8 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: undefined-global return { -- You can easily change to a different colorscheme. -- Change the name of the colorscheme plugin below, and then -- change the command in the config to whatever the name of that colorscheme is. diff --git a/lua/plugins/dadbod.lua b/lua/plugins/dadbod.lua index b99ce4c1..6653504f 100644 --- a/lua/plugins/dadbod.lua +++ b/lua/plugins/dadbod.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: undefined-global -- Database explorer and query runner return { 'tpope/vim-dadbod', diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 26392782..49aa76a9 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: undefined-global local plugins = {} local plugin_files = vim.fn.globpath(vim.fn.stdpath('config') .. '/lua/plugins', '*.lua', false, true) diff --git a/lua/plugins/leap.lua b/lua/plugins/leap.lua index 9f8ef2c4..ec0a15d9 100644 --- a/lua/plugins/leap.lua +++ b/lua/plugins/leap.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: undefined-global -- Quick navigation plugin return { 'ggandor/leap.nvim', diff --git a/lua/plugins/session.lua b/lua/plugins/session.lua index bfe6be65..21addca8 100644 --- a/lua/plugins/session.lua +++ b/lua/plugins/session.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: undefined-global return { 'echasnovski/mini.sessions', version = '*', diff --git a/lua/plugins/snacks/init.lua b/lua/plugins/snacks/init.lua index 366e159b..10bd67c5 100644 --- a/lua/plugins/snacks/init.lua +++ b/lua/plugins/snacks/init.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: undefined-global -- Import all configurations local core = require("plugins.snacks.core") local display = require("plugins.snacks.display") @@ -27,7 +28,6 @@ return { "MunifTanjim/nui.nvim", "echasnovski/mini.nvim", }, - ---@type snacks.Config opts = merge_tables( core, display, @@ -44,6 +44,6 @@ return { end, init = function() -- Make snacks available globally for debugging - _G.Snacks = require("plugins.snacks") + _G.Snacks = require("plugins.snacks.init") end, } diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua index 1b532fe7..332f39a5 100644 --- a/lua/plugins/which-key.lua +++ b/lua/plugins/which-key.lua @@ -6,73 +6,105 @@ return { -- Useful plugin to show you pending keybinds. icons = { mappings = vim.g.have_nerd_font, keys = vim.g.have_nerd_font and {} or { - Up = ' ', Down = ' ', Left = ' ', Right = ' ', - C = ' ', M = ' ', D = ' ', S = ' ', - CR = ' ', Esc = ' ', ScrollWheelDown = ' ', - ScrollWheelUp = ' ', NL = ' ', BS = ' ', - Space = ' ', Tab = ' ', F1 = '', F2 = '', - F3 = '', F4 = '', F5 = '', F6 = '', - F7 = '', F8 = '', F9 = '', F10 = '', - F11 = '', F12 = '', + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', }, }, + + -- Document existing key chains + spec = { + { 'c', group = '[C]ode', desc = { + a = 'Code [A]ction', + f = '[F]ormat buffer', + }}, + { 'd', group = '[D]ocument', desc = { + x = 'Document [D]iagnostics', + s = 'Document [S]ymbols', + [''] = 'Show diagnostic under cursor', + }}, + { 's', group = '[S]earch', desc = { + h = '[H]elp', + k = '[K]eymaps', + f = '[F]iles', + s = '[S]elect Telescope', + w = 'Current [W]ord', + g = '[G]rep', + d = '[D]iagnostics', + r = '[R]esume last search', + ['/'] = 'Search in open files', + n = '[N]eovim config files', + }}, + { 'l', group = '[L]SP/Language' }, + { 'm', group = '[M]emory/Sessions' }, + { 'D', group = '[D]atabase' }, + { 't', group = '[T]oggle', desc = { + h = 'Toggle inlay [H]ints', + }}, + { 'w', group = '[W]orkspace', desc = { + s = '[S]ymbols', + }}, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + { 'g', group = '[G]it', desc = { + s = 'Status', + }}, + { 'f', group = '[F]ile Explorer', desc = { + e = 'Toggle explorer', + f = 'Focus explorer', + }}, + { 'n', group = '[N]otifications', desc = { + n = 'Toggle notifications', + h = 'Notification [H]istory', + c = '[C]lear notifications', + }}, + { 'p', group = 'Debug/[P]rofile', desc = { + b = 'Toggle [B]reakpoint', + c = '[C]ontinue debugging', + n = 'Step over ([N]ext)', + i = 'Step [I]nto', + o = 'Step [O]ut', + r = 'Open [R]EPL', + l = 'Run [L]ast debug session', + x = 'Toggle debug UI', + }}, + { 'b', group = '[B]uffer', desc = { + p = '[P]revious', + n = '[N]ext', + d = '[D]elete', + D = 'Force [D]elete', + }}, + { 'q', desc = 'Open diagnostic [Q]uickfix list' }, + { 'e', desc = 'Toggle file [E]xplorer' }, + { 'o', desc = 'F[o]cus file explorer' }, + { 'x', desc = 'Close buffer' }, + { 'X', desc = 'Force close buffer' }, + { '/', desc = 'Search in current buffer' }, + { '', desc = 'Find buffers' }, + }, }, - config = function(_, opts) - local wk = require('which-key') - wk.setup(opts) - wk.add({ - { "/", desc = "Search in current buffer" }, - { "", desc = "Find buffers" }, - { "X", desc = "Force close buffer" }, - { "b", group = "[B]uffer" }, - { "bD", desc = "Force [D]elete" }, - { "bd", desc = "Delete buffer" }, - { "bn", desc = "Next buffer" }, - { "bp", desc = "Previous buffer" }, - { "c", group = "[C]ode" }, - { "ca", desc = "Code Action" }, - { "cf", desc = "Format buffer" }, - { "d", desc = "Show diagnostic under cursor" }, - { "ds", desc = "Document symbols" }, - { "dx", desc = "Document diagnostics" }, - { "e", desc = "Toggle file explorer" }, - { "f", group = "[F]ile Explorer" }, - { "fe", desc = "Toggle explorer" }, - { "ff", desc = "Focus explorer" }, - { "g", group = "[G]it" }, - { "gs", desc = "Status" }, - { "h", group = "Git [H]unk" }, - { "n", group = "[N]otifications" }, - { "nc", desc = "Clear notifications" }, - { "nh", desc = "Notification history" }, - { "nn", desc = "Toggle notifications" }, - { "o", desc = "Focus file explorer" }, - { "p", group = "Debug/[P]rofile" }, - { "pb", desc = "Toggle breakpoint" }, - { "pc", desc = "Continue debugging" }, - { "pi", desc = "Step into" }, - { "pl", desc = "Run last debug session" }, - { "pn", desc = "Step over" }, - { "po", desc = "Step out" }, - { "pr", desc = "Open REPL" }, - { "px", desc = "Toggle debug UI" }, - { "q", desc = "Open diagnostic quickfix list" }, - { "s", group = "[S]earch" }, - { "s/", desc = "Search in open files" }, - { "sd", desc = "Diagnostics" }, - { "sf", desc = "Files" }, - { "sg", desc = "Grep" }, - { "sh", desc = "Help" }, - { "sk", desc = "Keymaps" }, - { "sn", desc = "Neovim config files" }, - { "sr", desc = "Resume last search" }, - { "ss", desc = "Select Telescope" }, - { "sw", desc = "Current word" }, - { "t", group = "[T]oggle" }, - { "th", desc = "Toggle inlay hints" }, - { "w", group = "[W]orkspace" }, - { "ws", desc = "Symbols" }, - { "x", desc = "Close buffer" }, - }) - end, }