diff --git a/.config/nvim/lua/config/plugins/autosession.lua b/.config/nvim/lua/config/plugins/autosession.lua index 5a694f5..ed1dbd7 100644 --- a/.config/nvim/lua/config/plugins/autosession.lua +++ b/.config/nvim/lua/config/plugins/autosession.lua @@ -7,6 +7,21 @@ return { ---@type AutoSession.Config opts = { suppressed_dirs = { '~/', '~/Downloads', '/' }, + pre_restore_cmds = { + -- might not be necessary, but save current harpoon data when we're about to restore a session + function() require('harpoon'):sync() end, + }, + post_restore_cmds = { + function() + -- vim.notify('calling harpoon sync after restore') + local harpoon = require('harpoon') + local hdata = require('harpoon.data') + + -- this is the only way i found to force harpoon to reread data from the disk rather + -- than using what's in memory + require('harpoon').data = hdata.Data:new(harpoon.config) + end, + }, } } diff --git a/.config/nvim/lua/config/plugins/git.lua b/.config/nvim/lua/config/plugins/git.lua index 6039e03..243b1e6 100644 --- a/.config/nvim/lua/config/plugins/git.lua +++ b/.config/nvim/lua/config/plugins/git.lua @@ -1,23 +1,107 @@ return { - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '┃' }, - change = { text = '┃' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - untracked = { text = '┆' }, + { + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signs_staged = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signs_staged_enable = true, + signcolumn = true, + + on_attach = function() + local gitsigns = require('gitsigns') + + vim.keymap.set('n', 'gs', gitsigns.stage_hunk, { desc = 'stage hunk' }) + vim.keymap.set('n', 'gr', gitsigns.reset_hunk, { desc = 'restore hunk' }) + + vim.keymap.set('n', 'gS', gitsigns.stage_buffer, { desc = 'stage buffer' }) + vim.keymap.set('n', 'gR', gitsigns.stage_hunk, { desc = 'reset buffer' }) + + vim.keymap.set('n', 'gp', gitsigns.preview_hunk, { desc = 'preview hunk' }) + vim.keymap.set('n', 'gb', gitsigns.blame_line, { desc = 'blame line' }) + + + end }, - -- signs_staged = { - -- add = { text = '┃' }, - -- change = { text = '┃' }, - -- delete = { text = '_' }, - -- topdelete = { text = '‾' }, - -- changedelete = { text = '~' }, - -- untracked = { text = '┆' }, - -- }, - signs_staged_enable = false, - signcolumn = true + }, + { + "sindrets/diffview.nvim", + }, + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + config = function() + require('neogit').setup({ + + kind = 'floating', + graph_style = 'kitty', + disable_line_numbers = false, + disable_relative_line_numbers = false, + commit_editor = { + kind = 'floating', + }, + commit_select_view = { + kind = "floating", + }, + commit_view = { + kind = "floating", + verify_commit = vim.fn.executable("gpg") == 1, -- Can be set to true or false, otherwise we try to find the binary + }, + log_view = { + kind = "floating", + }, + rebase_editor = { + kind = "floating", + }, + reflog_view = { + kind = "floating", + }, + merge_editor = { + kind = "floating", + }, + description_editor = { + kind = "floating", + }, + tag_editor = { + kind = "floating", + }, + preview_buffer = { + kind = "floating", + }, + popup = { + kind = "floating", + }, + stash = { + kind = "floating", + }, + refs_view = { + kind = "floating", + }, + mappings = { + status = { + ['i'] = 'MoveUp', + ['k'] = 'MoveDown', + ['j'] = false, + }, + } + }) + vim.keymap.set('n', 'gg', 'Neogit', { desc = 'open neogit '}) + end } } diff --git a/.config/nvim/lua/config/plugins/init.lua b/.config/nvim/lua/config/plugins/init.lua index f2ab85c..3bf5a1e 100644 --- a/.config/nvim/lua/config/plugins/init.lua +++ b/.config/nvim/lua/config/plugins/init.lua @@ -43,8 +43,8 @@ require('lazy').setup({ require('config.plugins.blinkcmp'), require('config.plugins.lsp'), require('config.plugins.treesitter'), - require('config.plugins.autosession'), require('config.plugins.harpoon'), + require('config.plugins.autosession'), require('config.plugins.molten'), diff --git a/.config/nvim/lua/config/plugins/telescope.lua b/.config/nvim/lua/config/plugins/telescope.lua index 3822a4e..df328ef 100644 --- a/.config/nvim/lua/config/plugins/telescope.lua +++ b/.config/nvim/lua/config/plugins/telescope.lua @@ -36,9 +36,12 @@ return { local builtin = require('telescope.builtin') - vim.keymap.set('n', 'sf', builtin.find_files, { desc = 'Telescope find files' }) + vim.keymap.set('n', 'sf', builtin.find_files, { desc = 'find files' }) + vim.keymap.set('n', 'sw', builtin.grep_string, { desc = 'grep string' }) + vim.keymap.set('n', 'ss', builtin.lsp_document_symbols, { desc = 'document symbols' }) + vim.keymap.set('n', 'sS', builtin.lsp_workspace_symbols, { desc = 'workspace symbols' }) - vim.keymap.set('n', 'sp', 'SessionSearch', { desc = 'Search Sessions' }) + vim.keymap.set('n', 'sp', 'SessionSearch', { desc = 'search sessions' }) vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc.