diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 4b75299..0000000 --- a/flake.lock +++ /dev/null @@ -1,27 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1775036866, - "narHash": "sha256-ZojAnPuCdy657PbTq5V0Y+AHKhZAIwSIT2cb8UgAz/U=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6201e203d09599479a3b3450ed24fa81537ebc4e", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/init.lua b/init.lua index ac23edb..cc846ae 100644 --- a/init.lua +++ b/init.lua @@ -1,10 +1,8 @@ --- Set mapleader -vim.g.mapleader = "" -vim.g.maplocalleader = "," - --- Lazy require("config.lazy") +-- Colorcheme +vim.cmd.colorscheme("catppuccin-mocha") + -- Line numbers vim.opt.cursorline = true vim.wo.relativenumber = true @@ -12,22 +10,6 @@ vim.wo.number = true vim.api.nvim_set_hl(0, "LineNr", { fg = "#6c7086" }) -- overlay0 vim.api.nvim_set_hl(0, "CursorLineNr", { fg = "#cba6f7", bold = true }) -- mauve -local cursorline_group = vim.api.nvim_create_augroup("CursorLineControl", { clear = true }) - -vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter" }, { - group = cursorline_group, - callback = function() - vim.opt_local.cursorline = true - end, -}) - -vim.api.nvim_create_autocmd({ "WinLeave" }, { - group = cursorline_group, - callback = function() - vim.opt_local.cursorline = false - end, -}) - -- Windows vim.opt.splitbelow = true vim.opt.splitright = true @@ -52,99 +34,12 @@ vim.opt.incsearch = true -- Nowrap vim.opt.wrap = false --- Colorcheme -vim.cmd.colorscheme("catppuccin-mocha") - -- Scrolloff vim.opt.scrolloff = math.floor(vim.o.lines / 2) - 3 -- Indent vim.o.autoindent = true --- Keymap function -function Keymap(mode, key, binding) - vim.keymap.set(mode, key, binding, { noremap = true, silent = true }) -end - --- Better keymaps -Keymap("i", "jj", "") -Keymap("n", "q:", ":") -Keymap("n", "bd", function() -- delete buffer - vim.cmd("bd") - vim.cmd("echo 'Buffer deleted'") -end) - -vim.keymap.set("n", "i", function() - if vim.fn.getline("."):match("^%s*$") then - return [["_cc]] - else - return "i" - end -end, { expr = true, desc = "Inent properly on empty lines" }) - -vim.keymap.set("n", "a", function() - if vim.fn.getline("."):match("^%s*$") then - return [["_cc]] - else - return "a" - end -end, { expr = true, desc = "Indent properly on empty lines" }) - -vim.keymap.set("n", "A", function() - if vim.fn.getline("."):match("^%s*$") then - return [["_cc]] - else - return "A" - end -end, { expr = true, desc = "Indent properly on empty lines" }) - --- C-BS for deleting whole word in insert mode -vim.keymap.set("i", "", "", { noremap = true }) - --- Keybinds for MiniSessions -vim.keymap.set("n", "qj", function() -- quit and save session local - MiniSessions.write(".session") - vim.cmd("wqa") -end, { noremap = true }) - -vim.keymap.set("n", "qd", function() -- quit and delete session - pcall(MiniSessions.delete(".session")) - vim.cmd("wqa") -end, { noremap = true }) - --- lg keybind -Keymap("n", "l", function() - Snacks.lazygit.open() -end) - --- Autocommand to check git status -vim.api.nvim_create_autocmd("VimEnter", { - callback = function() - -- Verify if the current directory is a git repo - local is_git = os.execute("git rev-parse --is-inside-work-tree > /dev/null 2>&1") - if is_git ~= 0 then - return - end - - -- Perform an async fetch to avoid startup lag - vim.fn.jobstart("git fetch", { - on_exit = function() - -- Get the number of commits the remote is ahead of local HEAD - local count = vim.fn.system("git rev-list --count HEAD..@{u} 2>/dev/null"):gsub("%s+", "") - - if count ~= "" and tonumber(count) > 0 then - vim.schedule(function() - vim.notify( - "󰊢 " .. count .. " new commit(s) available on remote.", - vim.log.levels.INFO, - { title = "Git Status", icon = "󰊢" } - ) - end) - end - end, - }) - end, -}) - --- Keybind to check diags from linter -vim.api.nvim_set_keymap("n", "d", "lua vim.diagnostic.open_float()", { noremap = true, silent = true }) +-- Undotree +vim.cmd("packadd nvim.undotree") +vim.keymap.set("n", "u", require("undotree").open) diff --git a/lua/config/autocmd.lua b/lua/config/autocmd.lua new file mode 100644 index 0000000..b9fa53f --- /dev/null +++ b/lua/config/autocmd.lua @@ -0,0 +1,44 @@ +-- Autocommand to check git status +vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + -- Verify if the current directory is a git repo + local is_git = os.execute("git rev-parse --is-inside-work-tree > /dev/null 2>&1") + if is_git ~= 0 then + return + end + + -- Perform an async fetch to avoid startup lag + vim.fn.jobstart("git fetch", { + on_exit = function() + -- Get the number of commits the remote is ahead of local HEAD + local count = vim.fn.system("git rev-list --count HEAD..@{u} 2>/dev/null"):gsub("%s+", "") + + if count ~= "" and tonumber(count) > 0 then + vim.schedule(function() + vim.notify( + "󰊢 " .. count .. " new commit(s) available on remote.", + vim.log.levels.INFO, + { title = "Git Status", icon = "󰊢" } + ) + end) + end + end, + }) + end, +}) + +local cursorline_group = vim.api.nvim_create_augroup("CursorLineControl", { clear = true }) + +vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter" }, { + group = cursorline_group, + callback = function() + vim.opt_local.cursorline = true + end, +}) + +vim.api.nvim_create_autocmd({ "WinLeave" }, { + group = cursorline_group, + callback = function() + vim.opt_local.cursorline = false + end, +}) diff --git a/lua/config/binds.lua b/lua/config/binds.lua new file mode 100644 index 0000000..9619003 --- /dev/null +++ b/lua/config/binds.lua @@ -0,0 +1,29 @@ +-- Keymap function +function Keymap(mode, key, binding) + vim.keymap.set(mode, key, binding, { noremap = true, silent = true }) +end + +Keymap("n", "q:", ":") -- remove nonsense command +Keymap("n", "bd", function() -- delete buffer + vim.cmd("bd") + vim.cmd("echo 'Buffer deleted'") +end) + +for bind = "i", "a", "A" do -- proper indenting function + Keymap("n", bind, function() + if vim.fn.getline("."):match("^%s*$") then + return [["_cc]] + else + return bind + end + end) +end + +Keymap("i", "", "") -- C-Backscpace for whole words + +-- Open Lazygit +Keymap("n", "l", function() + Snacks.lazygit.open() +end) + +Keymap("n", "d", "lua vim.diagnostic.open_float()") -- Diagnostics for Linter diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 393ac80..ae4cf46 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -19,16 +19,17 @@ vim.opt.rtp:prepend(lazypath) -- loading lazy.nvim so that mappings are correct. -- This is also a good place to setup other settings (vim.opt) vim.g.mapleader = " " +vim.g.maplocalleader = "," -- Setup lazy.nvim require("lazy").setup({ spec = { -- import your plugins + { import = "plugins.utils" }, { import = "plugins" }, - { import = "plugins.completion" }, { import = "plugins.ui" }, - { import = "plugins.functional" }, - { import = "plugins.functional.neorg" }, + { import = "plugins.editing" }, + { import = "plugins.completion" }, }, -- Configure any other settings here. See the documentation for more details. -- colorscheme that will be used when installing plugins. diff --git a/lua/plugins/completion/treesitter.lua b/lua/plugins/completion/treesitter.lua index da9722a..51e875b 100644 --- a/lua/plugins/completion/treesitter.lua +++ b/lua/plugins/completion/treesitter.lua @@ -15,7 +15,6 @@ return { "json", "lua", "norg", - "norg_meta", "markdown", "markdown_inline", "query", diff --git a/lua/plugins/functional/flash.lua b/lua/plugins/editing/flash.lua similarity index 100% rename from lua/plugins/functional/flash.lua rename to lua/plugins/editing/flash.lua diff --git a/lua/plugins/editing/neorg.lua b/lua/plugins/editing/neorg.lua new file mode 100644 index 0000000..0748c4e --- /dev/null +++ b/lua/plugins/editing/neorg.lua @@ -0,0 +1,106 @@ +return { + { + "nvim-neorg/neorg", + lazy = true, + ft = "norg", + version = "*", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-neorg/neorg-telescope" }, + { "benlubas/neorg-interim-ls" }, + }, + config = function() + require("neorg").setup({ + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.qol.toc"] = { + config = { + close_after_use = true, + }, + }, + ["core.integrations.treesitter"] = {}, + ["core.looking-glass"] = {}, + ["core.itero"] = { + config = { + iterables = { + "unordered_list%d", + "ordered_list%d", + "quote%d", + }, + }, + }, + ["core.completion"] = { + config = { engine = { module_name = "external.lsp-completion" } }, + }, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/Notes", + site = "~/Documents/voidarc/content/", + }, + default_workspace = "notes", + }, + }, + ["core.integrations.telescope"] = { + config = { + insert_file_link = { + -- Whether to show the title preview in telescope. Affects performance with a large + -- number of files. + show_title_preview = true, + }, + }, + }, + ["external.interim-ls"] = { + config = { + -- default config shown + completion_provider = { + -- Enable or disable the completion provider + enable = true, + + -- Show file contents as documentation when you complete a file name + documentation = true, + + -- Try to complete categories provided by Neorg Query. Requires `benlubas/neorg-query` + categories = false, + + -- suggest heading completions from the given file for `{@x|}` where `|` is your cursor + -- and `x` is an alphanumeric character. `{@name}` expands to `[name]{:$/people:# name}` + }, + }, + }, + }, + }) + vim.wo.foldlevel = 99 + vim.wo.conceallevel = 2 + + vim.api.nvim_create_autocmd("Filetype", { + pattern = "norg", + callback = function() + vim.keymap.set("n", "", "(neorg.esupports.hop.hop-link.vsplit)", { buffer = true }) + vim.keymap.set("i", "", "(neorg.itero.next-iteration)", { buffer = true }) + vim.keymap.set("n", "m", "Neorg inject-metadata", { buffer = true }) + vim.keymap.set("n", "f", "Telescope neorg insert_link", { buffer = true }) + vim.opt.colorcolumn = "140" + vim.api.nvim_set_hl(0, "@neorg.tags.ranged_verbatim.code_block", { bg = "NONE" }) + end, + }) + end, + }, + { + "folke/snacks.nvim", + config = function() + require("snacks").setup({ + bigfile = {}, + lazygit = {}, + image = { + enabled = true, + math = { + enabled = true, + latex = {}, + }, + }, + }) + end, + }, +} diff --git a/lua/plugins/functional/scrolleof.lua b/lua/plugins/editing/scrollEof.lua similarity index 98% rename from lua/plugins/functional/scrolleof.lua rename to lua/plugins/editing/scrollEof.lua index f9093b7..e121c05 100644 --- a/lua/plugins/functional/scrolleof.lua +++ b/lua/plugins/editing/scrollEof.lua @@ -3,3 +3,4 @@ return { event = { "CursorMoved", "WinScrolled" }, opts = {}, } + diff --git a/lua/plugins/functional/autosave.lua b/lua/plugins/functional/autosave.lua deleted file mode 100644 index af53d64..0000000 --- a/lua/plugins/functional/autosave.lua +++ /dev/null @@ -1,47 +0,0 @@ -return { - "okuuva/auto-save.nvim", - version = "^1.0.0", -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release - cmd = "ASToggle", -- optional for lazy loading on command - event = { "InsertLeave", "TextChanged" }, - opts = {}, - config = function(opts) - require("auto-save").setup({ - enabled = true, - trigger_events = { -- See :h events - immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" }, -- vim events that trigger an immediate save - defer_save = { "InsertLeave" }, -- vim events that trigger a deferred save (saves after `debounce_delay`) - cancel_deferred_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save - }, - debounce_delay = 1000, - noautocmd = true, - }) - local group = vim.api.nvim_create_augroup("autosave", {}) - - vim.api.nvim_create_autocmd("User", { - pattern = "AutoSaveWritePre", - group = group, - callback = function(opts) - if opts.data.saved_buffer ~= nil then - local filename = vim.fn.expand("%:t") - print("Saved '" .. filename .. "' at " .. vim.fn.strftime("%H:%M:%S")) - end - end, - }) - - vim.api.nvim_create_autocmd("User", { - pattern = "AutoSaveEnable", - group = group, - callback = function(opts) - print("AutoSave enabled") - end, - }) - - vim.api.nvim_create_autocmd("User", { - pattern = "AutoSaveDisable", - group = group, - callback = function(opts) - print("AutoSave disabled") - end, - }) - end, -} diff --git a/lua/plugins/functional/mini.lua b/lua/plugins/functional/mini.lua deleted file mode 100644 index 6319a93..0000000 --- a/lua/plugins/functional/mini.lua +++ /dev/null @@ -1,73 +0,0 @@ -return { - "echasnovski/mini.nvim", - version = "", - - config = function() - require("mini.pairs").setup() -- Bracket pairs and stuff - - require("mini.ai").setup() -- Around and In extension for visual mode - - require("mini.cursorword").setup() -- Underline current word below cursor (makes it easier to c and d) - - require("mini.indentscope").setup({ -- shows indents - symbol = "│", - draw = { - delay = 10, - animation = require("mini.indentscope").gen_animation.linear({ - duration = 15, - unit = "step", - easing = "out", - }), - }, - }) - - require("mini.trailspace").setup() -- Shows useless spaces - - require("mini.sessions").setup({ -- dir based session management - autoread = true, - autowrite = true, - file = ".session", - force = { read = false, write = true, delete = true }, - }) - - require("mini.surround").setup() -- Suround selections with characters - - require("mini.move").setup({ -- move selection in visual mode - mappings = { - down = "J", - up = "K", - }, - }) - - require("mini.icons").setup() -- Icon provider - - local animate = require("mini.animate") -- animations ovs - require("mini.animate").setup({ - cursor = { - enable = false, - }, - scroll = { - -- Animate for 200 milliseconds with linear easing - timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), - -- Animate equally but with at most 120 steps instead of default 60 - subscroll = animate.gen_subscroll.equal({ max_output_steps = 60 }), - }, - open = { - -- Animate for 400 milliseconds with linear easing - timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), - -- Animate with wiping from nearest edge instead of default static one - winconfig = animate.gen_winconfig.wipe({ direction = "from_edge" }), - -- Make bigger windows more transparent - winblend = animate.gen_winblend.linear({ from = 0, to = 0 }), - }, - close = { - -- Animate for 400 milliseconds with linear easing - timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), - -- Animate with wiping to nearest edge instead of default static one - winconfig = animate.gen_winconfig.wipe({ direction = "to_edge" }), - -- Make bigger windows more transparent - winblend = animate.gen_winblend.linear({ from = 0, to = 0 }), - }, - }) - end, -} diff --git a/lua/plugins/functional/neorg.lua b/lua/plugins/functional/neorg.lua deleted file mode 100644 index bdb1f9c..0000000 --- a/lua/plugins/functional/neorg.lua +++ /dev/null @@ -1,83 +0,0 @@ -return { - "nvim-neorg/neorg", - lazy = false, - version = "*", - dependencies = { { "nvim-lua/plenary.nvim" }, { "nvim-neorg/neorg-telescope" }, { "benlubas/neorg-interim-ls" } }, - config = function() - require("neorg").setup({ - load = { - ["core.defaults"] = {}, - ["core.concealer"] = {}, - ["core.qol.toc"] = { - config = { - close_after_use = true, - }, - }, - ["core.integrations.treesitter"] = {}, - ["core.looking-glass"] = {}, - ["core.itero"] = { - config = { - iterables = { - "unordered_list%d", - "ordered_list%d", - "quote%d", - }, - }, - }, - ["core.completion"] = { - config = { engine = { module_name = "external.lsp-completion" } }, - }, - ["core.dirman"] = { - config = { - workspaces = { - notes = "~/Notes", - site = "~/Documents/voidarc/content/", - }, - default_workspace = "notes", - }, - }, - ["core.integrations.telescope"] = { - config = { - insert_file_link = { - -- Whether to show the title preview in telescope. Affects performance with a large - -- number of files. - show_title_preview = true, - }, - }, - }, - ["external.interim-ls"] = { - config = { - -- default config shown - completion_provider = { - -- Enable or disable the completion provider - enable = true, - - -- Show file contents as documentation when you complete a file name - documentation = true, - - -- Try to complete categories provided by Neorg Query. Requires `benlubas/neorg-query` - categories = false, - - -- suggest heading completions from the given file for `{@x|}` where `|` is your cursor - -- and `x` is an alphanumeric character. `{@name}` expands to `[name]{:$/people:# name}` - }, - }, - }, - }, - }) - vim.wo.foldlevel = 99 - vim.wo.conceallevel = 2 - - vim.api.nvim_create_autocmd("Filetype", { - pattern = "norg", - callback = function() - vim.keymap.set("n", "", "(neorg.esupports.hop.hop-link.vsplit)", { buffer = true }) - vim.keymap.set("i", "", "(neorg.itero.next-iteration)", { buffer = true }) - vim.keymap.set("n", "m", "Neorg inject-metadata", { buffer = true }) - vim.keymap.set("n", "f", "Telescope neorg insert_link", { buffer = true }) - vim.opt.colorcolumn = "140" - vim.api.nvim_set_hl(0, "@neorg.tags.ranged_verbatim.code_block", { bg = "NONE" }) - end, - }) - end, -} diff --git a/lua/plugins/functional/nerdy.lua b/lua/plugins/functional/nerdy.lua deleted file mode 100644 index 134102e..0000000 --- a/lua/plugins/functional/nerdy.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - '2kabhishek/nerdy.nvim', - cmd = 'Nerdy', - opts = { - max_recents = 30, -- Configure recent icons limit - copy_to_clipboard = false, -- Copy glyph to clipboard instead of inserting - copy_register = '+', -- Register to use for copying (if `copy_to_clipboard` is true) - }, -} diff --git a/lua/plugins/functional/remember.lua b/lua/plugins/functional/remember.lua deleted file mode 100644 index 557f82c..0000000 --- a/lua/plugins/functional/remember.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - "vladdoster/remember.nvim", - config = function() - require("remember").setup({}) - end, -} diff --git a/lua/plugins/functional/telescope-file-browser.lua b/lua/plugins/functional/telescope-file-browser.lua deleted file mode 100644 index 4e996b7..0000000 --- a/lua/plugins/functional/telescope-file-browser.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - "nvim-telescope/telescope-file-browser.nvim", - dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }, -} diff --git a/lua/plugins/functional/telescope.lua b/lua/plugins/functional/telescope.lua deleted file mode 100644 index f416d96..0000000 --- a/lua/plugins/functional/telescope.lua +++ /dev/null @@ -1,68 +0,0 @@ -return { - "nvim-telescope/telescope.nvim", - tag = "0.1.8", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope-symbols.nvim", - "nvim-telescope/telescope-ui-select.nvim", - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - }, - config = function() - require("telescope").setup({ - defaults = { - file_ignore_patterns = { ".git", ".venv", ".node_modules" }, - }, - pickers = { - live_grep = { - additional_args = function(opts) - return { "--hidden" } - end, - }, - }, - extensions = { - file_browser = { - theme = "ivy", - hijack_netrw = true, - }, - ["ui-select"] = { - require("telescope.themes").get_dropdown({ - -- even more opts - }), - }, - }, - }) - local builtin = require("telescope.builtin") - - vim.keymap.set("n", "ff", function() - builtin.find_files({ hidden = true }) - end, { desc = "Telescope find files (current file dir)" }) - - vim.keymap.set("n", "fn", function() - local full_path = vim.api.nvim_buf_get_name(0) - local dir = vim.fn.fnamemodify(full_path, ":h") - require("telescope").extensions.file_browser.file_browser({ - path = dir, - }) - end) - - vim.keymap.set("n", "fs", function() -- select sessions - MiniSessions.select() - end) - - vim.keymap.set("n", "fd", function() -- select sessions - MiniSessions.select("delete") - end) - - vim.keymap.set("n", "fg", function() - builtin.live_grep({ hidden = true }) - end, { desc = "Telescope live grep (current file dir)" }) - - vim.keymap.set("n", "fb", function() - builtin.buffers({ cwd = vim.fn.expand("%:p:h") }) -- buffers don’t need cwd, but harmless - end, { desc = "Telescope buffers" }) - - require("telescope").load_extension("file_browser") - require("telescope").load_extension("ui-select") - require("telescope").load_extension("nerdy") - end, -} diff --git a/lua/plugins/functional/undotree.lua b/lua/plugins/functional/undotree.lua deleted file mode 100644 index 2319ece..0000000 --- a/lua/plugins/functional/undotree.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "mbbill/undotree", - lazy = false, - config = function() - vim.keymap.set("n", "u", "UndotreeToggleUndotreeFocus") - end, -} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index eafbacf..a564707 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1 +1 @@ -return { undefined } +return {} diff --git a/lua/plugins/ui/cattpuccin.lua b/lua/plugins/ui/catppuccin.lua similarity index 99% rename from lua/plugins/ui/cattpuccin.lua rename to lua/plugins/ui/catppuccin.lua index 12f3c84..5ce5c62 100644 --- a/lua/plugins/ui/cattpuccin.lua +++ b/lua/plugins/ui/catppuccin.lua @@ -10,3 +10,4 @@ return { show_end_of_buffer = true, -- shows the '~' characters after the end of buffers } } + diff --git a/lua/plugins/ui/lualine.lua b/lua/plugins/ui/lualine.lua index 7fc9bc2..9cb3756 100644 --- a/lua/plugins/ui/lualine.lua +++ b/lua/plugins/ui/lualine.lua @@ -69,3 +69,4 @@ return { }) end, } + diff --git a/lua/plugins/ui/noice.lua b/lua/plugins/ui/noice.lua index a5178ca..c3f88a7 100644 --- a/lua/plugins/ui/noice.lua +++ b/lua/plugins/ui/noice.lua @@ -44,3 +44,4 @@ return { "rcarriga/nvim-notify", }, } + diff --git a/lua/plugins/ui/snacks.lua b/lua/plugins/ui/snacks.lua deleted file mode 100644 index 22f1e79..0000000 --- a/lua/plugins/ui/snacks.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - "folke/snacks.nvim", - config = function() - require("snacks").setup({ - bigfile = {}, - lazygit = {}, - image = { - enabled = true, - math = { - enabled = true, - latex = {}, - }, - }, - }) - end, -} diff --git a/lua/plugins/ui/vimade.lua b/lua/plugins/ui/vimade.lua index 100bf03..7034827 100644 --- a/lua/plugins/ui/vimade.lua +++ b/lua/plugins/ui/vimade.lua @@ -5,3 +5,4 @@ return { fadelevel = 0.6, }, } + diff --git a/lua/plugins/utils/files.lua b/lua/plugins/utils/files.lua new file mode 100644 index 0000000..e0d37b5 --- /dev/null +++ b/lua/plugins/utils/files.lua @@ -0,0 +1,55 @@ +return { + { + "okuuva/auto-save.nvim", + version = "^1.0.0", -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release + cmd = "ASToggle", -- optional for lazy loading on command + event = { "InsertLeave", "TextChanged" }, + opts = {}, + config = function(opts) + require("auto-save").setup({ + enabled = true, + trigger_events = { -- See :h events + immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" }, -- vim events that trigger an immediate save + defer_save = { "InsertLeave" }, -- vim events that trigger a deferred save (saves after `debounce_delay`) + cancel_deferred_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save + }, + debounce_delay = 1000, + noautocmd = true, + }) + local group = vim.api.nvim_create_augroup("autosave", {}) + + vim.api.nvim_create_autocmd("User", { + pattern = "AutoSaveWritePre", + group = group, + callback = function(opts) + if opts.data.saved_buffer ~= nil then + local filename = vim.fn.expand("%:t") + print("Saved '" .. filename .. "' at " .. vim.fn.strftime("%H:%M:%S")) + end + end, + }) + + vim.api.nvim_create_autocmd("User", { + pattern = "AutoSaveEnable", + group = group, + callback = function(opts) + print("AutoSave enabled") + end, + }) + + vim.api.nvim_create_autocmd("User", { + pattern = "AutoSaveDisable", + group = group, + callback = function(opts) + print("AutoSave disabled") + end, + }) + end, + }, + { + "vladdoster/remember.nvim", + config = function() + require("remember").setup({}) + end, + }, +} diff --git a/lua/plugins/utils/mini.lua b/lua/plugins/utils/mini.lua new file mode 100644 index 0000000..af8c3fa --- /dev/null +++ b/lua/plugins/utils/mini.lua @@ -0,0 +1,73 @@ +return { + "echasnovski/mini.nvim", + version = "", + + config = function() + require("mini.pairs").setup() -- Bracket pairs and stuff + + require("mini.ai").setup() -- Around and In extension for visual mode + + require("mini.cursorword").setup() -- Underline current word below cursor (makes it easier to c and d) + + require("mini.indentscope").setup({ -- shows indents + symbol = "│", + draw = { + delay = 10, + animation = require("mini.indentscope").gen_animation.linear({ + duration = 15, + unit = "step", + easing = "out", + }), + }, + }) + + require("mini.trailspace").setup() -- Shows useless spaces + + require("mini.sessions").setup({ -- dir based session management + autoread = true, + autowrite = true, + file = ".session", + force = { read = false, write = true, delete = true }, + }) + + require("mini.surround").setup() -- Suround selections with characters + + require("mini.move").setup({ -- move selection in visual mode + mappings = { + down = "J", + up = "K", + }, + }) + + require("mini.icons").setup() -- Icon provider + + -- local animate = require("mini.animate") -- animations ovs + -- require("mini.animate").setup({ + -- cursor = { + -- enable = false, + -- }, + -- scroll = { + -- -- Animate for 200 milliseconds with linear easing + -- timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), + -- -- Animate equally but with at most 120 steps instead of default 60 + -- subscroll = animate.gen_subscroll.equal({ max_output_steps = 60 }), + -- }, + -- open = { + -- -- Animate for 400 milliseconds with linear easing + -- timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), + -- -- Animate with wiping from nearest edge instead of default static one + -- winconfig = animate.gen_winconfig.wipe({ direction = "from_edge" }), + -- -- Make bigger windows more transparent + -- winblend = animate.gen_winblend.linear({ from = 0, to = 0 }), + -- }, + -- close = { + -- -- Animate for 400 milliseconds with linear easing + -- timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), + -- -- Animate with wiping to nearest edge instead of default static one + -- winconfig = animate.gen_winconfig.wipe({ direction = "to_edge" }), + -- -- Make bigger windows more transparent + -- winblend = animate.gen_winblend.linear({ from = 0, to = 0 }), + -- }, + -- }) + end, +} diff --git a/lua/plugins/utils/telescope.lua b/lua/plugins/utils/telescope.lua new file mode 100644 index 0000000..ba990a8 --- /dev/null +++ b/lua/plugins/utils/telescope.lua @@ -0,0 +1,83 @@ +return { + { + "nvim-telescope/telescope.nvim", + tag = "", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope-symbols.nvim", + "nvim-telescope/telescope-ui-select.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + }, + config = function() + require("telescope").setup({ + defaults = { + file_ignore_patterns = { ".git", ".venv", ".node_modules" }, + }, + pickers = { + live_grep = { + additional_args = function(opts) + return { "--hidden" } + end, + }, + }, + extensions = { + file_browser = { + theme = "ivy", + hijack_netrw = true, + }, + ["ui-select"] = { + require("telescope.themes").get_dropdown({ + -- even more opts + }), + }, + }, + }) + local builtin = require("telescope.builtin") + + vim.keymap.set("n", "ff", function() + builtin.find_files({ hidden = true }) + end, { desc = "Telescope find files (current file dir)" }) + + vim.keymap.set("n", "fn", function() + local full_path = vim.api.nvim_buf_get_name(0) + local dir = vim.fn.fnamemodify(full_path, ":h") + require("telescope").extensions.file_browser.file_browser({ + path = dir, + }) + end) + + vim.keymap.set("n", "fs", function() -- select sessions + MiniSessions.select() + end) + + vim.keymap.set("n", "fd", function() -- select sessions + MiniSessions.select("delete") + end) + + vim.keymap.set("n", "fg", function() + builtin.live_grep({ hidden = true }) + end, { desc = "Telescope live grep (current file dir)" }) + + vim.keymap.set("n", "fb", function() + builtin.buffers({ cwd = vim.fn.expand("%:p:h") }) -- buffers don’t need cwd, but harmless + end, { desc = "Telescope buffers" }) + + require("telescope").load_extension("file_browser") + require("telescope").load_extension("ui-select") + require("telescope").load_extension("nerdy") + end, + }, + { + "nvim-telescope/telescope-file-browser.nvim", + dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }, + }, + { + "2kabhishek/nerdy.nvim", + cmd = "Nerdy", + opts = { + max_recents = 30, -- Configure recent icons limit + copy_to_clipboard = false, -- Copy glyph to clipboard instead of inserting + copy_register = "+", -- Register to use for copying (if `copy_to_clipboard` is true) + }, + }, +}