From ce1d0686fdc22262ad78271f06fb02827a68e27f Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Sun, 3 Sep 2023 00:41:35 +0200 Subject: [PATCH] Add some further keybindinds and plugins --- init.lua | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index f42e402..50e2edb 100644 --- a/init.lua +++ b/init.lua @@ -243,6 +243,14 @@ require('lazy').setup({ 'tpope/vim-dadbod', 'kristijanhusak/vim-dadbod-ui', 'kristijanhusak/vim-dadbod-completion', + { + -- Highlight, edit, and navigate code + 'ThePrimeagen/harpoon', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + }, + 'mbbill/undotree', -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. @@ -264,7 +272,7 @@ require('lazy').setup({ -- NOTE: You can change these options as you wish! -- Set highlight on search -vim.o.hlsearch = true +vim.o.hlsearch = false -- Make line numbers default vim.wo.number = true @@ -296,11 +304,6 @@ vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEn -- Enable mouse mode vim.o.mouse = 'a' --- Sync clipboard between OS and Neovim. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.o.clipboard = 'unnamedplus' - -- Enable break indent vim.o.breakindent = true @@ -609,6 +612,17 @@ cmp.setup { vim.keymap.set('i', 'jj', '', { desc = 'Closes insert mode' }) vim.keymap.set('n', 'ec', ':', { desc = 'Execute command' }) +vim.keymap.set('v', 'J', ":m '>+1gv=gv", { desc = 'Move line down' }) +vim.keymap.set('v', 'K', ":m '<-2gv=gv", { desc = 'Move line up' }) + +vim.keymap.set('x', 'p', "\"_dP", { desc = '[P]aste with previous still in buffer' }) + +vim.keymap.set('n', 'y', "\"+y", { desc = '[Y]ank to system clipboard' }) +vim.keymap.set('v', 'y', "\"+y", { desc = '[Y]ank to system clipboard' }) +vim.keymap.set('n', 'Y', "\"+Y", { desc = '[Y]ank to system clipboard' }) + +vim.keymap.set('n', 'rr', [[:%s/\<\>//gI]], { desc = '[R]ename by [R]egex pattern' }) + -- map capital b and e to end/start line, should be default? vim.keymap.set('n', 'B', '_', { desc = 'Jump to line [B]eginning' }) vim.keymap.set('n', 'E', '$', { desc = 'Jump to line [E]nding' }) @@ -633,3 +647,18 @@ vim.keymap.set('n', 'nu', 'DBUIToggle', { desc = 'Toggle UI' }) vim.keymap.set('n', 'nf', 'DBUIFindBuffer', { desc = 'Find buffer' }) vim.keymap.set('n', 'nr', 'DBUIRenameBuffer', { desc = 'Rename buffer' }) vim.keymap.set('n', 'nq', 'DBUILastQueryInfo', { desc = 'Last query info' }) + +-- harpoon +local mark = require('harpoon.mark') +local ui = require('harpoon.ui') + +vim.keymap.set('n', 'h', mark.add_file, { desc = 'Add file to harpoon'}) +vim.keymap.set('n', '', ui.toggle_quick_menu, { desc = 'Toggle harpoon quick menu'}) + +vim.keymap.set('n', '', function () ui.nav_file(1) end, { desc = 'Harpoon file 1'}) +vim.keymap.set('n', '', function () ui.nav_file(2) end, { desc = 'Harpoon file 2'}) +vim.keymap.set('n', '', function () ui.nav_file(3) end, { desc = 'Harpoon file 3'}) +vim.keymap.set('n', '', function () ui.nav_file(4) end, { desc = 'Harpoon file 4'}) + +-- undotree +vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle , { desc = 'Toggle Undotree'})