diff --git a/init.lua b/init.lua index 3c71dc1..30551d2 100644 --- a/init.lua +++ b/init.lua @@ -21,6 +21,7 @@ require("autopairs-config") require("diffview-config") require("notify-config") require("tint-config") +require("autosession-config") -- require("chatgpt-config") require("debugger-config") require("debugger-config.rust") diff --git a/lua/autosession-config/init.lua b/lua/autosession-config/init.lua new file mode 100644 index 0000000..72e7b89 --- /dev/null +++ b/lua/autosession-config/init.lua @@ -0,0 +1,14 @@ +require("auto-session").setup({ + log_level = "error", + auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, + session_lens = { + buftypes_to_ignore = {}, + load_on_setup = true, + theme_conf = { border = true }, + previewer = false, + }, +}) + +vim.keymap.set("n", "", require("auto-session.session-lens").search_session, { + noremap = true, +}) diff --git a/lua/mappings/init.lua b/lua/mappings/init.lua index 460d748..06ee938 100644 --- a/lua/mappings/init.lua +++ b/lua/mappings/init.lua @@ -11,7 +11,7 @@ map("n", "", "k", { noremap = true, silent = false }) map("v", "<", "", "", opts) -map("i", "", 'copilot#Accept("")', { silent = true, expr = true }) +-- map("i", "", 'copilot#Accept("")', { silent = true, expr = true }) map("n", "", "zz", { noremap = true, silent = false }) map("n", "", "zz", { noremap = true, silent = false }) diff --git a/lua/packer-config/init.lua b/lua/packer-config/init.lua index f15e11d..eb2fe38 100644 --- a/lua/packer-config/init.lua +++ b/lua/packer-config/init.lua @@ -83,4 +83,12 @@ return require("packer").startup(function(use) require("lspsaga").setup({}) end, }) + + --> Auto Session + use({ + "rmagatti/auto-session", + config = function() + require("auto-session").setup() + end, + }) end) diff --git a/lua/which-config/init.lua b/lua/which-config/init.lua index 4c2697e..6e24a09 100644 --- a/lua/which-config/init.lua +++ b/lua/which-config/init.lua @@ -1,126 +1,127 @@ local wk = require("which-key") wk.setup({ - plugins = { - marks = false, - registers = false, - spelling = { enabled = false, suggestions = 20 }, - presets = { - operators = false, - motions = false, - text_objects = false, - windows = false, - nav = false, - z = false, - g = false, - }, - }, + plugins = { + marks = false, + registers = false, + spelling = { enabled = false, suggestions = 20 }, + presets = { + operators = false, + motions = false, + text_objects = false, + windows = false, + nav = false, + z = false, + g = false, + }, + }, }) local Terminal = require("toggleterm.terminal").Terminal local toggle_float = function() - local float = Terminal:new({ direction = "float" }) - return float:toggle() + local float = Terminal:new({ direction = "float" }) + return float:toggle() end local toggle_lazygit = function() - local lazygit = Terminal:new({ cmd = "lazygit", direction = "float" }) - return lazygit:toggle() + local lazygit = Terminal:new({ cmd = "lazygit", direction = "float" }) + return lazygit:toggle() end local mappings = { - ["/"] = { ":CommentToggle", "Toggle Comment" }, - c = { ":67,69CommentToggle", "Range Toggle Comment" }, - q = { ":q", "Quit" }, - Q = { ":wq", "Save & Quit" }, - w = { ":w", "Save" }, - x = { ":bdelete", "Close" }, - -- d = { ":Dashboard", "Dashboard" }, - E = { ":e ~/.config/nvim/init.lua", "Edit config" }, - f = { - name = "Telescope", - f = { ":Telescope find_files", "Telescope Find Files" }, - g = { ":Telescope live_grep", "Telescope Live Grep" }, - o = { ":Telescope oldfiles", "Telescope Old Files" }, - h = { ":Telescope keymaps", "Telescope Keymaps" }, - b = { ":Telescope buffers", "Telescope Buffers" }, - }, - g = { - name = "ChatGPT", - c = { "ChatGPT", "ChatGPT" }, - e = { "ChatGPTEditWithInstruction", "Edit with instruction", mode = { "n", "v" } }, - g = { "ChatGPTRun grammar_correction", "Grammar Correction", mode = { "n", "v" } }, - t = { "ChatGPTRun translate", "Translate", mode = { "n", "v" } }, - k = { "ChatGPTRun keywords", "Keywords", mode = { "n", "v" } }, - d = { "ChatGPTRun docstring", "Docstring", mode = { "n", "v" } }, - a = { "ChatGPTRun add_tests", "Add Tests", mode = { "n", "v" } }, - o = { "ChatGPTRun optimize_code", "Optimize Code", mode = { "n", "v" } }, - s = { "ChatGPTRun summarize", "Summarize", mode = { "n", "v" } }, - f = { "ChatGPTRun fix_bugs", "Fix Bugs", mode = { "n", "v" } }, - x = { "ChatGPTRun explain_code", "Explain Code", mode = { "n", "v" } }, - r = { "ChatGPTRun roxygen_edit", "Roxygen Edit", mode = { "n", "v" } }, - l = { "ChatGPTRun code_readability_analysis", "Code Readability Analysis", mode = { "n", "v" } }, - }, - b = { - name = "Telescope Bookmarks", - m = { ":Telescope marks", "Bookmarks" }, - }, - t = { - name = "Terminal", - t = { ":ToggleTerm", "Split Below" }, - f = { toggle_float, "Floating Terminal" }, - l = { toggle_lazygit, "LazyGit" }, - }, - l = { - name = "LSP", - i = { ":LspInfo", "Connected Language Servers" }, - k = { "lua vim.lsp.buf.signature_help()", "Signature Help" }, - K = { "Lspsaga hover_doc", "Hover Commands" }, - w = { "lua vim.lsp.buf.add_workspace_folder()", "Add Workspace Folder" }, - W = { "lua vim.lsp.buf.remove_workspace_folder()", "Remove Workspace Folder" }, - l = { - "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", - "List Workspace Folders", - }, - t = { "lua vim.lsp.buf.type_definition()", "Type Definition" }, - d = { "lua vim.lsp.buf.definition()", "Go To Definition" }, - D = { "lua vim.lsp.buf.declaration()", "Go To Declaration" }, - r = { "lua vim.lsp.buf.references()", "References" }, - R = { "Lspsaga rename", "Rename" }, - a = { "Lspsaga code_action", "Code Action" }, - e = { "Lspsaga show_line_diagnostics", "Show Line Diagnostics" }, - n = { "Lspsaga diagnostic_jump_next", "Go To Next Diagnostic" }, - N = { "Lspsaga diagnostic_jump_prev", "Go To Previous Diagnostic" }, - }, - p = { - name = "Packer", - r = { ":PackerClean", "Remove Unused Plugins" }, - c = { ":PackerCompile profile=true", "Recompile Plugins" }, - i = { ":PackerInstall", "Install Plugins" }, - p = { ":PackerProfile", "Packer Profile" }, - s = { ":PackerSync", "Sync Plugins" }, - S = { ":PackerStatus", "Packer Status" }, - u = { ":PackerUpdate", "Update Plugins" }, - }, - -- debugger mappings -- - d = { - name = "Debugger", - c = { "lua require'dap'.continue()", "Continue" }, - o = { "lua require'dap'.step_over()", "Step Over" }, - i = { "lua require'dap'.step_into()", "Step Into" }, - O = { "lua require'dap'.step_out()", "Step Out" }, - b = { "lua require'dap'.toggle_breakpoint()", "Toggle Breakpoint" }, - s = { - "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", - "Set Breakpoint condition", - }, - B = { - "lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))", - "Set Breakpoint log message", - }, - n = { "lua require'dap'.repl.open()", "Open" }, - l = { "lua require'dap'.run_last()", "Run Last" }, - }, + ["/"] = { ":CommentToggle", "Toggle Comment" }, + c = { ":67,69CommentToggle", "Range Toggle Comment" }, + q = { ":q", "Quit" }, + Q = { ":wq", "Save & Quit" }, + w = { ":w", "Save" }, + x = { ":bdelete", "Close" }, + -- d = { ":Dashboard", "Dashboard" }, + E = { ":e ~/.config/nvim/init.lua", "Edit config" }, + f = { + name = "Telescope", + f = { ":Telescope find_files", "Telescope Find Files" }, + g = { ":Telescope live_grep", "Telescope Live Grep" }, + o = { ":Telescope oldfiles", "Telescope Old Files" }, + h = { ":Telescope keymaps", "Telescope Keymaps" }, + b = { ":Telescope buffers", "Telescope Buffers" }, + }, + g = { + name = "ChatGPT", + c = { "ChatGPT", "ChatGPT" }, + b = { "ChatGPTCompleteCode", "ChatGPTCompleteCode" }, + e = { "ChatGPTEditWithInstruction", "Edit with instruction", mode = { "n", "v" } }, + g = { "ChatGPTRun grammar_correction", "Grammar Correction", mode = { "n", "v" } }, + t = { "ChatGPTRun translate", "Translate", mode = { "n", "v" } }, + k = { "ChatGPTRun keywords", "Keywords", mode = { "n", "v" } }, + d = { "ChatGPTRun docstring", "Docstring", mode = { "n", "v" } }, + a = { "ChatGPTRun add_tests", "Add Tests", mode = { "n", "v" } }, + o = { "ChatGPTRun optimize_code", "Optimize Code", mode = { "n", "v" } }, + s = { "ChatGPTRun summarize", "Summarize", mode = { "n", "v" } }, + f = { "ChatGPTRun fix_bugs", "Fix Bugs", mode = { "n", "v" } }, + x = { "ChatGPTRun explain_code", "Explain Code", mode = { "n", "v" } }, + r = { "ChatGPTRun roxygen_edit", "Roxygen Edit", mode = { "n", "v" } }, + l = { "ChatGPTRun code_readability_analysis", "Code Readability Analysis", mode = { "n", "v" } }, + }, + b = { + name = "Telescope Bookmarks", + m = { ":Telescope marks", "Bookmarks" }, + }, + t = { + name = "Terminal", + t = { ":ToggleTerm", "Split Below" }, + f = { toggle_float, "Floating Terminal" }, + l = { toggle_lazygit, "LazyGit" }, + }, + l = { + name = "LSP", + i = { ":LspInfo", "Connected Language Servers" }, + k = { "lua vim.lsp.buf.signature_help()", "Signature Help" }, + K = { "Lspsaga hover_doc", "Hover Commands" }, + w = { "lua vim.lsp.buf.add_workspace_folder()", "Add Workspace Folder" }, + W = { "lua vim.lsp.buf.remove_workspace_folder()", "Remove Workspace Folder" }, + l = { + "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", + "List Workspace Folders", + }, + t = { "lua vim.lsp.buf.type_definition()", "Type Definition" }, + d = { "lua vim.lsp.buf.definition()", "Go To Definition" }, + D = { "lua vim.lsp.buf.declaration()", "Go To Declaration" }, + r = { "lua vim.lsp.buf.references()", "References" }, + R = { "Lspsaga rename", "Rename" }, + a = { "Lspsaga code_action", "Code Action" }, + e = { "Lspsaga show_line_diagnostics", "Show Line Diagnostics" }, + n = { "Lspsaga diagnostic_jump_next", "Go To Next Diagnostic" }, + N = { "Lspsaga diagnostic_jump_prev", "Go To Previous Diagnostic" }, + }, + p = { + name = "Packer", + r = { ":PackerClean", "Remove Unused Plugins" }, + c = { ":PackerCompile profile=true", "Recompile Plugins" }, + i = { ":PackerInstall", "Install Plugins" }, + p = { ":PackerProfile", "Packer Profile" }, + s = { ":PackerSync", "Sync Plugins" }, + S = { ":PackerStatus", "Packer Status" }, + u = { ":PackerUpdate", "Update Plugins" }, + }, + -- debugger mappings -- + d = { + name = "Debugger", + c = { "lua require'dap'.continue()", "Continue" }, + o = { "lua require'dap'.step_over()", "Step Over" }, + i = { "lua require'dap'.step_into()", "Step Into" }, + O = { "lua require'dap'.step_out()", "Step Out" }, + b = { "lua require'dap'.toggle_breakpoint()", "Toggle Breakpoint" }, + s = { + "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", + "Set Breakpoint condition", + }, + B = { + "lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))", + "Set Breakpoint log message", + }, + n = { "lua require'dap'.repl.open()", "Open" }, + l = { "lua require'dap'.run_last()", "Run Last" }, + }, } local opts = { prefix = "" }