From 0b297401381a86165974d8811a43b0566811ec85 Mon Sep 17 00:00:00 2001 From: CronyAkatsuki Date: Sun, 24 Dec 2023 17:42:57 +0100 Subject: [PATCH] Fix keybinding, disable system clipboard by default. --- after/plugin/tmux.lua | 8 ++++---- lua/crony/map.lua | 40 +++++++++++++++++++++++++++++++++++----- lua/crony/set.lua | 3 --- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/after/plugin/tmux.lua b/after/plugin/tmux.lua index 97b68a6..962aad9 100644 --- a/after/plugin/tmux.lua +++ b/after/plugin/tmux.lua @@ -1,4 +1,4 @@ -vim.keymap.set("n", "c-h>", "TmuxNavigateLeft", { desc = "Window Left" }) -vim.keymap.set("n", "c-j>", "TmuxNavigateDown", { desc = "Window Down" }) -vim.keymap.set("n", "c-k>", "TmuxNavigateUp", { desc = "Window Up" }) -vim.keymap.set("n", "c-l>", "TmuxNavigateRight", { desc = "Window Right" }) +vim.keymap.set("n", "C-h>", "TmuxNavigateLeft", { desc = "Window Left" }) +vim.keymap.set("n", "C-j>", "TmuxNavigateDown", { desc = "Window Down" }) +vim.keymap.set("n", "C-k>", "TmuxNavigateUp", { desc = "Window Up" }) +vim.keymap.set("n", "C-l>", "TmuxNavigateRight", { desc = "Window Right" }) diff --git a/lua/crony/map.lua b/lua/crony/map.lua index e73fba2..45607c0 100644 --- a/lua/crony/map.lua +++ b/lua/crony/map.lua @@ -1,12 +1,42 @@ +local map = vim.keymap.set + -- Leader vim.g.mapleader = ' ' vim.g.maplocalleader = ';' -- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) +map('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +map('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +map('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +map('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) -- Lsp format -vim.keymap.set('n', 'f', vim.lsp.buf.format, { desc = "Format current buffer" }) +map('n', 'f', vim.lsp.buf.format, { desc = "Format current buffer" }) + +-- 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" }) + +-- source current lua config file +map("n", "", function() + vim.cmd("so") +end, { desc = "Source current source file" }) + +-- better indenting +map("v", "<", "", ">gv") + +-- next greatest remap ever : asbjornHaland ( stolen from the primeagen ) +map({ "n", "v" }, "y", [["+y]], { desc = "" }) +map("n", "Y", [["+Y]]) + +map({ "n", "v" }, "d", [["_d]]) diff --git a/lua/crony/set.lua b/lua/crony/set.lua index 5aa7fc5..d736bf4 100644 --- a/lua/crony/set.lua +++ b/lua/crony/set.lua @@ -20,9 +20,6 @@ opt.smartindent = true -- Enable the mouse, just to have it opt.mouse = 'a' --- Enable system clipboard -opt.clipboard = 'unnamedplus' - -- Enable break indent opt.breakindent = true