From a79c54f6eaef17fc634a16ef7b6724deab816c25 Mon Sep 17 00:00:00 2001 From: omagdy Date: Tue, 22 Jul 2025 21:41:35 +0300 Subject: nvim: Added undotree plugin + some QOL changes --- nvim/.config/nvim/lazy-lock.json | 1 + nvim/.config/nvim/lua/config/keymaps.lua | 44 +++++++++++++++------ nvim/.config/nvim/lua/config/lazy.lua | 7 +++- nvim/.config/nvim/lua/config/options.lua | 1 + nvim/.config/nvim/lua/plugins/competitest.lua | 1 - .../nvim/lua/plugins/lualine-macro-recording.lua | 1 + nvim/.config/nvim/lua/plugins/main.lua | 9 ----- nvim/.config/nvim/lua/plugins/obsidian.lua | 5 +++ nvim/.config/nvim/lua/plugins/telescope.lua | 16 ++++++-- nvim/.config/nvim/lua/plugins/undotree.lua | 12 ++++++ nvim/.config/nvim/spell/en.utf-8.add | 1 + nvim/.config/nvim/spell/en.utf-8.add.spl | Bin 0 -> 46 bytes 12 files changed, 72 insertions(+), 26 deletions(-) create mode 100644 nvim/.config/nvim/lua/plugins/undotree.lua create mode 100644 nvim/.config/nvim/spell/en.utf-8.add create mode 100644 nvim/.config/nvim/spell/en.utf-8.add.spl diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 2d98779..9606910 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -74,6 +74,7 @@ "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, "ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" }, "typescript.nvim": { "branch": "main", "commit": "4de85ef699d7e6010528dcfbddc2ed4c2c421467" }, + "undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" }, "vim-tmux-navigator": { "branch": "master", "commit": "412c474e97468e7934b9c217064025ea7a69e05e" }, "vimtex": { "branch": "master", "commit": "7f2633027c8f496a85284de0c11aa32f1e07e049" } } diff --git a/nvim/.config/nvim/lua/config/keymaps.lua b/nvim/.config/nvim/lua/config/keymaps.lua index 2bb7600..e5aa308 100644 --- a/nvim/.config/nvim/lua/config/keymaps.lua +++ b/nvim/.config/nvim/lua/config/keymaps.lua @@ -72,6 +72,29 @@ vim.cmd([[ cnoreabbrev Qall qall ]]) +-- load the session for the current directory +vim.keymap.set("n", "ql", function() + require("persistence").load() +end) + +-- select a session to load +vim.keymap.set("n", "qs", function() + require("persistence").select() +end) + +-- load the last session +vim.keymap.set("n", "qL", function() + require("persistence").load({ last = true }) +end) + +-- stop Persistence => session won't be saved on exit +vim.keymap.set("n", "qd", function() + require("persistence").stop() +end) + +-- Sane keymap to deal with built-in terminal +map("t", "", "", { desc = "Using Escape in terminal mode to actualy put you back in normal mode" }) + -- vimtex keymaps map("n", "i", "VimtexCompile", { desc = "Compile latex document", remap = true }) @@ -84,28 +107,27 @@ map("n", "a", function() require("harpoon.mark").add_file() end, { desc = "Add file to harpoon", remap = true }) -map("n", "q", function() +map("n", "1", function() require("harpoon.ui").nav_file(1) end, { desc = "navigate to first harpoon mark", remap = true }) -map("n", "w", function() +map("n", "2", function() require("harpoon.ui").nav_file(2) end, { desc = "navigate to second harpoon mark", remap = true }) +map("n", "3", function() + require("harpoon.ui").nav_file(3) +end, { desc = "navigate to second harpoon mark", remap = true }) + +map("n", "4", function() + require("harpoon.ui").nav_file(4) +end, { desc = "navigate to second harpoon mark", remap = true }) + map("n", "h", "noh", { desc = "remove highlights", remap = true }) map("n", "j", "/<++>ciwO", { desc = "jump to <++>", remap = true }) map("n", "", "bprevious", { desc = "Jump to recently used buffer" }) map("n", "gl", "lua vim.diagnostic.open_float()", { desc = "Line diagnostics", remap = true }) --- oil.nvim keymaps --- map("n", "e", function() --- if vim.o.filetype == "oil" then --- vim.cmd("bd") --- else --- vim.cmd("vsplit | vertical resize -60 | wincmd r") --- require("oil").open() --- end --- end, { desc = "Open Oil.nvim ins split mode", remap = true }) map("n", "-", "Oil", { desc = "Open Oil.nvim", remap = true }) -- competitest keymaps diff --git a/nvim/.config/nvim/lua/config/lazy.lua b/nvim/.config/nvim/lua/config/lazy.lua index e5f5d91..674639d 100644 --- a/nvim/.config/nvim/lua/config/lazy.lua +++ b/nvim/.config/nvim/lua/config/lazy.lua @@ -11,8 +11,11 @@ require("lazy").setup({ -- add LazyVim and import its plugins { "LazyVim/LazyVim", import = "lazyvim.plugins" }, -- import any extras modules here - -- { import = "lazyvim.plugins.extras.lang.typescript" }, - -- { import = "lazyvim.plugins.extras.lang.json" }, + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, -- import/override with your plugins { import = "plugins" }, diff --git a/nvim/.config/nvim/lua/config/options.lua b/nvim/.config/nvim/lua/config/options.lua index c245255..c86b443 100644 --- a/nvim/.config/nvim/lua/config/options.lua +++ b/nvim/.config/nvim/lua/config/options.lua @@ -21,4 +21,5 @@ end -- g:neovide_transparency should be 0 if you want to unify transparency of content and title bar. vim.g.neovide_transparency = 0.5 vim.g.transparency = 0.8 +vim.g.cmdheight = 1 vim.g.neovide_background_color = "#0A0E14" .. alpha() diff --git a/nvim/.config/nvim/lua/plugins/competitest.lua b/nvim/.config/nvim/lua/plugins/competitest.lua index 9004051..719b3a8 100644 --- a/nvim/.config/nvim/lua/plugins/competitest.lua +++ b/nvim/.config/nvim/lua/plugins/competitest.lua @@ -58,7 +58,6 @@ return { height = 0.5, show_nu = true, show_rnu = false, - close_mappings = { "q", "Q" }, }, }, popup_ui = { diff --git a/nvim/.config/nvim/lua/plugins/lualine-macro-recording.lua b/nvim/.config/nvim/lua/plugins/lualine-macro-recording.lua index e69de29..a564707 100644 --- a/nvim/.config/nvim/lua/plugins/lualine-macro-recording.lua +++ b/nvim/.config/nvim/lua/plugins/lualine-macro-recording.lua @@ -0,0 +1 @@ +return {} diff --git a/nvim/.config/nvim/lua/plugins/main.lua b/nvim/.config/nvim/lua/plugins/main.lua index 1204e8f..a593259 100644 --- a/nvim/.config/nvim/lua/plugins/main.lua +++ b/nvim/.config/nvim/lua/plugins/main.lua @@ -45,15 +45,6 @@ return { }, }, - - - -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, - -- treesitter, mason and typescript.nvim. So instead of the above, you can use: - { import = "lazyvim.plugins.extras.lang.typescript" }, - -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc - { import = "lazyvim.plugins.extras.lang.json" }, - - -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above -- would overwrite `ensure_installed` with the new value. -- If you'd rather extend the default config, use the code below instead: diff --git a/nvim/.config/nvim/lua/plugins/obsidian.lua b/nvim/.config/nvim/lua/plugins/obsidian.lua index 64f119d..bba856e 100644 --- a/nvim/.config/nvim/lua/plugins/obsidian.lua +++ b/nvim/.config/nvim/lua/plugins/obsidian.lua @@ -3,6 +3,7 @@ return { version = "*", -- recommended, use latest release instead of latest commit lazy = true, ft = "markdown", + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: -- event = { -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. @@ -18,12 +19,16 @@ return { -- see below for full list of optional dependencies 👇 }, opts = { + disable_frontmatter = true, workspaces = { { name = "personal", path = "/mnt/Storage/omar/volty", }, }, + templates = { + folder = "5 - Template", + }, }, keys = { { diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index b9f4a46..f8dcfc5 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -15,6 +15,11 @@ return { "f", false, }, + { + "fq", + "Telescope quickfix", + desc = "Find quickfix list", + }, { "fp", function() @@ -24,13 +29,18 @@ return { }, { "fd", - "Telescope find_files", - desc = "Find Buffer", + "Telescope diagnostics", + desc = "Find diagnostics in current project", }, { "ff", + "Telescope find_files", + desc = "Find files in current project", + }, + { + "fg", "Telescope git_files", - desc = "Find Buffer", + desc = "Find git files in current project", }, { "fb", diff --git a/nvim/.config/nvim/lua/plugins/undotree.lua b/nvim/.config/nvim/lua/plugins/undotree.lua new file mode 100644 index 0000000..a09ac4a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/undotree.lua @@ -0,0 +1,12 @@ +return { + "mbbill/undotree", + lazy = false, + + keys = { + { + "ut", + "UndotreeToggle", + desc = "Toggle UndoTree", + }, + }, +} diff --git a/nvim/.config/nvim/spell/en.utf-8.add b/nvim/.config/nvim/spell/en.utf-8.add new file mode 100644 index 0000000..c31de31 --- /dev/null +++ b/nvim/.config/nvim/spell/en.utf-8.add @@ -0,0 +1 @@ +Rustaceans diff --git a/nvim/.config/nvim/spell/en.utf-8.add.spl b/nvim/.config/nvim/spell/en.utf-8.add.spl new file mode 100644 index 0000000..99929ea Binary files /dev/null and b/nvim/.config/nvim/spell/en.utf-8.add.spl differ -- cgit v1.2.3