diff --git a/nvchad/.config/nvim/lua/chadrc.lua b/nvchad/.config/nvim/lua/chadrc.lua index bfc8b76..f3ea34e 100644 --- a/nvchad/.config/nvim/lua/chadrc.lua +++ b/nvchad/.config/nvim/lua/chadrc.lua @@ -15,22 +15,4 @@ M.ui = { hl_add = highlights.add, } -M.plugins = "plugins" - --- Get the mappings -M.mappings = require "mappings" - --- Load the mapping because the devs are retarded and changed it from a good system to a bad one -local function set_mappings(mode, key, value) - local opts = value.opts or {} - opts.desc = value[2] - vim.keymap.set(mode, key, value[1], opts) -end - -for mode, mode_mappings in pairs(M.mappings.general) do - for key, mapping in pairs(mode_mappings) do - set_mappings(mode, key, mapping) - end -end - return M diff --git a/nvchad/.config/nvim/lua/mappings.lua b/nvchad/.config/nvim/lua/mappings.lua index 48c32b6..48b99b7 100644 --- a/nvchad/.config/nvim/lua/mappings.lua +++ b/nvchad/.config/nvim/lua/mappings.lua @@ -1,38 +1,25 @@ ---@type MappingsTable -local M = {} -M.general = { - n = { - [";"] = { ":", "enter command mode", opts = { nowait = true } }, +require "nvchad.mappings" - -- format with conform - ["fm"] = { - function() - require("conform").format() - end, - "formatting", - }, - }, +local map = vim.keymap.set - v = { - -- Indentation - [">"] = { ">gv", "indent" }, - -- Move selection up/down with K/J - ["J"] = { ":m '>+1gv=gv", "move selection down" }, - ["K"] = { ":m '<-2gv=gv", "move selection up" }, - }, +-- General +map("n", ";", ":", { desc = "enter command mode", nowait = true }) - i = { - [""] = { - function() - vim.fn.feedkeys(vim.fn["copilot#Accept"](), "") - end, - "Copilot Accept", - { replace_keycodes = true, nowait = true, silent = true, expr = true, noremap = true }, - }, - }, -} +-- Format with conform +map("n", "fm", function() + require("conform").format() +end, { desc = "formatting" }) --- more keybinds! +-- Indentation in visual mode +map("v", ">", ">gv", { desc = "indent" }) -return M +-- Move selection up/down with K/J in visual mode +map("v", "J", ":m '>+1gv=gv", { desc = "move selection down" }) +map("v", "K", ":m '<-2gv=gv", { desc = "move selection up" }) + +-- Copilot accept in insert mode +map("i", "", function() + vim.fn.feedkeys(vim.fn["copilot#Accept"](), "") +end, { desc = "Copilot Accept", replace_keycodes = true, nowait = true, silent = true, expr = true, noremap = true })