diff --git a/init.lua b/init.lua index 7f1163f..ba1affd 100644 --- a/init.lua +++ b/init.lua @@ -260,6 +260,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. @@ -281,7 +289,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 @@ -313,11 +321,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 @@ -646,6 +649,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' }) @@ -670,3 +684,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'})