From e472e08511e1c18a8f30a94c2303e11cba50151a Mon Sep 17 00:00:00 2001 From: Binciu Viorel Date: Sun, 26 May 2024 12:55:14 +0300 Subject: [PATCH] feat: Updated keymaps --- lua/config/keymaps.lua | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 2c134f7..8419b9f 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -1,3 +1,80 @@ -- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any additional keymaps here + +local function map(mode, lhs, rhs, opts) + local keys = require("lazy.core.handler").handlers.keys + ---@cast keys LazyKeysHandler + -- do not create the keymap if a lazy keys handler exists + if not keys.active[keys.parse({ lhs, mode = mode }).id] then + opts = opts or {} + opts.silent = opts.silent ~= false + vim.keymap.set(mode, lhs, rhs, opts) + end +end + +-- Switch to last buffer with +map("n", "", "", { desc = "Switch to last buffer" }) + +-- Zen Mode +map("n", "cz", "ZenMode", { desc = "🙏 Zen mode" }) + +-- Yank file path +map("n", "y", function() + local filepath = vim.fn.expand("%") + vim.fn.setreg("+", filepath) +end, { desc = "Yank file path" }) + +-- Octo map +map("n", "go", "Octo", { desc = "Open Octo" }) +map("n", "goc", "Octo ", { desc = "Add comment" }) +map("n", "gop", "Octo ", { desc = "Pull Request" }) +map("n", "gor", "Octo ", { desc = "Review" }) +map("n", "got", "Octo ", { desc = "Thread" }) +map("n", "gopl", "Octo pr list", { desc = "Open PR list" }) +map( + "n", + "gopm", + "Octo search is:pr review-requested:bogdan-calapod is:open draft:false", + { desc = "Open own PR list" } +) +map("n", "gopc", "Octo pr create", { desc = "Create PR" }) +map("n", "gopk", "Octo pr checkout", { desc = "Checkout PR" }) +map("n", "gopb", "Octo pr browser", { desc = "Open PR in browser" }) +map("n", "gopy", "Octo pr url", { desc = "Copy PR URL" }) +map("n", "gopp", "Octo pr checks", { desc = "View PR checks" }) +map("n", "gopr", "Octo pr reload", { desc = "Reload PR" }) +map("n", "gora", "Octo reviewer add", { desc = "Add reviewer" }) +map("n", "gors", "Octo review start", { desc = "Start review" }) +map("n", "gorr", "Octo review resume", { desc = "Resume review" }) +map("n", "gorS", "Octo review submit", { desc = "Submit review" }) +map("n", "gord", "Octo review discard", { desc = "Discard review" }) +map("n", "gorx", "Octo review close", { desc = "Close review window" }) +map("n", "gorc", "Octo review comments", { desc = "View pending review comments" }) +map("n", "goca", "Octo comment add", { desc = "Add comment" }) +map("n", "gocd", "Octo comment delete", { desc = "Delete comment" }) +map("n", "gotr", "Octo thread resolve", { desc = "Resolve thread" }) +map("n", "gotu", "Octo thread unresolve", { desc = "Unresolve thread" }) +map("n", "gt", "GitTimeLapse", { desc = "Git Timelapse" }) + +-- Eureka +map("n", "o", function() + require("eureka").show_notes() +end, { desc = "Eureka" }) + +-- Notify +map("n", "uN", "Telescope notify ", { desc = "View all notifications" }) +-- Advanced Git Search +map("n", "ga", function() end, { desc = "Advanced Git" }) +map("n", "gad", "Telescope advanced_git_search diff_branch_file", { desc = "Diff with branch " }) + +-- Other maps +map("n", "ce", "NiceReference", { desc = "Go to r[e]ferences" }) +map("n", "ue", "set relativenumber!", { desc = "Toggle relative line numbers" }) +map("n", "gb", "Git blame", { desc = "Git blame" }) +map("n", "ut", "Telescope undo", { desc = "Undo tree" }) + +-- Codeium +map("i", "", function() + return vim.fn["codeium#Accept"]() +end, { expr = true, desc = "Accept codeium suggestion" })