From e8315399fb7a337ac496c776048a38599716bdb9 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 6 Oct 2024 17:11:48 +0200 Subject: checkpoint --- after/plugin/gitsigns.lua | 17 ++++++++++++----- after/plugin/telescope.lua | 14 +++++++------- lua/config/lazy.lua | 1 + lua/config/map.lua | 37 +++++++++++++++++++------------------ 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/after/plugin/gitsigns.lua b/after/plugin/gitsigns.lua index b781fb6..87dd7f4 100644 --- a/after/plugin/gitsigns.lua +++ b/after/plugin/gitsigns.lua @@ -1,4 +1,5 @@ -require("gitsigns").setup({ +local gitsigns = require("gitsigns") +gitsigns.setup({ signs = { add = { text = "▎" }, change = { text = "▎" }, @@ -7,12 +8,18 @@ require("gitsigns").setup({ changedelete = { text = "▎" }, untracked = { text = "▎" }, }, + numhl = false, + attach_to_untracked = true, + update_debounce = 0, on_attach = function(buffer) - local gs = package.loaded.gitsigns local map = vim.keymap.set - -- stylua: ignore start - map("n", "]g", gs.next_hunk, { desc = "Next git hunk" }) - map("n", "[g", gs.prev_hunk, { desc = "Previous git hunk" }) + map("n", "]g", gitsigns.next_hunk, { desc = "Next git hunk" }) + map("n", "[g", gitsigns.prev_hunk, { desc = "Previous git hunk" }) + map("n", " gd", gitsigns.toggle_deleted, { desc="Toggle deleted"}) + map("n", " gr", gitsigns.reset_hunk, { desc="Reset hunk"}) + map("n", " gs", gitsigns.stage_hunk, { desc="Stage hunk"}) + map("n", " gu", gitsigns.undo_stage_hunk, { desc="Undo stage hunk"}) + map("n", " gb", gitsigns.blame, { desc="Blame"}) end, }) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 720e157..c77e464 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -24,16 +24,16 @@ require("telescope").setup({ }) local builtin = require("telescope.builtin") -map("n", " tf", builtin.find_files) +map("n", " ff", builtin.find_files) map("n", " bl", builtin.buffers) -map("n", "", builtin.git_files) -map("n", " tw", builtin.live_grep) -map("n", " th", builtin.help_tags, { desc = "Find help tags" }) +map("n", " fp", builtin.git_files) +map("n", " fw", builtin.live_grep) +map("n", " fh", builtin.help_tags) -- symbols -map("n", " tse", "lua require'telescope.builtin'.symbols{ sources = {'emoji', 'gitmoji'} }") -map("n", " tsn", "lua require'telescope.builtin'.symbols{ sources = {'nerd'} }") -map("n", " tsj", "lua require'telescope.builtin'.symbols{ sources = {'julia'} }") +map("n", " fe", "lua require'telescope.builtin'.symbols{ sources = {'emoji', 'gitmoji'} }") +map("n", " fn", "lua require'telescope.builtin'.symbols{ sources = {'nerd'} }") +map("n", " fj", "lua require'telescope.builtin'.symbols{ sources = {'julia'} }") require("telescope").load_extension("ui-select") require("telescope").load_extension("fzf") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index b8b5927..7e4752b 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -15,6 +15,7 @@ vim.opt.rtp:prepend(lazypath) -- plugins installation and configuration require("lazy").setup({ "echasnovski/mini.nvim", + "tpope/vim-fugitive", "lewis6991/gitsigns.nvim", "tpope/vim-vinegar", "tpope/vim-eunuch", diff --git a/lua/config/map.lua b/lua/config/map.lua index 85c1e0f..1ce241d 100644 --- a/lua/config/map.lua +++ b/lua/config/map.lua @@ -20,20 +20,19 @@ 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" }) +map("x", " p", [["_dP]], { desc = "Paste while keeping the registry" }) -- moving map("i", "", "I", { noremap = true }) map("i", "", "A", { 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 }) +map("n", " sp", "sp", { desc = "Open horizontal split" }) +map("n", " vs", "vs", { desc = "Open vertical split" }) +map("n", " q", "q!", { noremap = true }) +map("n", " Q", "qa!", { noremap = true }) -- close all except focused buffer -map("n", "1", "%bd|e#", { noremap = true }) +map("n", " 1", "%bd|e#", { noremap = true }) -- next tab map("n", "+", "tabe .", { noremap = true }) @@ -42,11 +41,9 @@ 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]]) +map({ "n", "v" }, " y", [["+y]]) +map("n", " Y", [["+Y]]) +map({ "n", "v" }, " P", [["+p]]) -- templates map("n", "rt", ":-1r " .. vim.fn.stdpath("config") .. "/templates", { noremap = true }) @@ -65,17 +62,21 @@ vim.api.nvim_create_user_command("Hide", function() end, {}) -- write -map("n", "w", "write", { noremap = true }) -map("n", "W", "write!", { noremap = true }) -map("n", "e", "edit", { noremap = true }) -map("n", "s", function() +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 }) +map("n", " P", "Lazy", { noremap = true }) -- spelling -map("n", "s", "setlocal spell!", { noremap = true }) +map("n", " ts", "setlocal spell!", { noremap = true, desc = "Toggle spelling" }) map("n", "g", "z=1", { noremap = true }) + +map("n", " td", function() + vim.diagnostic.enable(vim.diagnostic.is_enabled() == false) +end, { desc = "Toggle diagnostics" }) -- cgit v1.2.3