From 5c7dffe3782c18e0d47f5753a8c30a0cd1b6e352 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 16 Sep 2024 18:06:11 +0200 Subject: checkpoint - made keybinds more logical with prefixes - renamed user to config - updated to-do's - added rounded borders on floating windows - added vim-eunuch - added telescope-symbols --- lua/config/map.lua | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 lua/config/map.lua (limited to 'lua/config/map.lua') diff --git a/lua/config/map.lua b/lua/config/map.lua new file mode 100644 index 0000000..230588f --- /dev/null +++ b/lua/config/map.lua @@ -0,0 +1,83 @@ +local map = vim.keymap.set + +-- Leader +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +-- open config +map("n", " c", function() + vim.cmd("cd ~/.config/nvim") + vim.cmd("e " .. "init.lua") +end, { desc = "Open neovim config file" }) +-- Move text easilly +map("v", "J", ":m '>+1gv=gv", { desc = "Move selected text up" }) +map("v", "K", ":m '<-2gv=gv", { desc = "Move selected text down" }) + +-- better find next and previous +map("n", "n", "nzzzv", { desc = "Keep cursor in middle with search" }) +map("n", "N", "Nzzzv", { desc = "Keep cursor in middle with search" }) + +map("n", "J", "mzJ`z", { desc = "Move up next line with space in between" }) + +-- greatest remap ever +map("x", "p", [["_dP]], { desc = "Paste while keeping the registry" }) + +-- moving +map("i", "", "I", { noremap = true }) +map("i", "", "A", { noremap = true }) +map("i", "", "D", { noremap = true }) + +-- buffers +map("n", "sp", "sp", { desc = "Open horizontal split" }) +map("n", "vs", "vs", { desc = "Open vertical split" }) +map("n", "gb", "buffers:buffer", { noremap = true }) +map("n", "q", "q!", { noremap = true }) +map("n", "Q", "qa!", { noremap = true }) +-- close all except focused buffer +map("n", "1", "%bd|e#", { noremap = true }) +-- next tab +map("n", "+", "tabe .", { noremap = true }) + +-- better indenting +map("v", "<", "", ">gv") + +-- allow for use of system clipboard fast +map({ "n", "v" }, "y", [["+y]]) +map("n", "Y", [["+Y]]) +map({ "n", "v" }, "P", [["+p]]) + +map({ "n", "v" }, "d", [["_d]]) + +-- templates +map("n", "rt", ":-1r " .. vim.fn.stdpath("config") .. "/templates", { noremap = true }) + +-- hide all +local s = { hidden_all = 0 } +map("n", "", function() + s.hidden_all = 1 - s.hidden_all + local opt = s.hidden_all == 0 + vim.opt.showmode = opt + vim.opt.ruler = opt + vim.opt.nu = opt + vim.opt.rnu = opt + vim.opt.showcmd = opt + vim.opt.laststatus = opt and 2 or 0 + vim.opt.signcolumn = opt and "yes" or "no" +end, { noremap = true }) + +-- write +map("n", "w", "write", { noremap = true }) +map("n", "W", "write!", { noremap = true }) +map("n", "e", "edit", { noremap = true }) +map("n", "s", function() + vim.cmd.source() + print("sourced.") +end, { noremap = true }) + +-- Lazy +map("n", "P", "Lazy", { noremap = true }) + +-- spelling +map("n", "s", "setlocal spell!", { noremap = true }) +map("n", "g", "z=1", { noremap = true }) -- cgit v1.2.3