From 353bbc67f2f7c9cfc1127f5c8e8254c8584a2ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Thu, 16 Nov 2023 23:48:31 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(nvim):=20added=20a=20lot=20of?= =?UTF-8?q?=20extras?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wildfire, neorg, obsidian, autosave, no-neck-pain, etc --- .../lua/plugins/extras/coding/wildfire.lua | 5 ++ .../nvim/lua/plugins/extras/editor/neorg.lua | 26 ++++++++++ .../lua/plugins/extras/editor/obsidian.lua | 48 +++++++++++++++++++ .../lua/plugins/extras/ui/comment-box.lua | 5 ++ .../nvim/lua/plugins/extras/util/autosave.lua | 31 ++++++++++++ .../lua/plugins/extras/util/no-neck-pain.lua | 11 +++++ 6 files changed, 126 insertions(+) create mode 100644 .config/nvim/lua/plugins/extras/coding/wildfire.lua create mode 100644 .config/nvim/lua/plugins/extras/editor/neorg.lua create mode 100644 .config/nvim/lua/plugins/extras/editor/obsidian.lua create mode 100644 .config/nvim/lua/plugins/extras/ui/comment-box.lua create mode 100644 .config/nvim/lua/plugins/extras/util/autosave.lua create mode 100644 .config/nvim/lua/plugins/extras/util/no-neck-pain.lua diff --git a/.config/nvim/lua/plugins/extras/coding/wildfire.lua b/.config/nvim/lua/plugins/extras/coding/wildfire.lua new file mode 100644 index 00000000..f7c84a85 --- /dev/null +++ b/.config/nvim/lua/plugins/extras/coding/wildfire.lua @@ -0,0 +1,5 @@ +return { + "sustech-data/wildfire.nvim", + event = "BufEnter", + opts = {}, +} diff --git a/.config/nvim/lua/plugins/extras/editor/neorg.lua b/.config/nvim/lua/plugins/extras/editor/neorg.lua new file mode 100644 index 00000000..39641639 --- /dev/null +++ b/.config/nvim/lua/plugins/extras/editor/neorg.lua @@ -0,0 +1,26 @@ +return { + "nvim-neorg/neorg", + build = ":Neorg sync-parsers", + dependencies = { "nvim-lua/plenary.nvim" }, + event = "VeryLazy", + opts = { + load = { + ["core.defaults"] = {}, -- Loads default behaviour + ["core.concealer"] = {}, -- Adds pretty icons to your documents + ["core.keybinds"] = {}, -- Adds default keybindings + ["core.completion"] = { + config = { + engine = "nvim-cmp", + }, + }, -- Enables support for completion plugins + ["core.journal"] = {}, -- Enables support for the journal module + ["core.dirman"] = { -- Manages Neorg workspaces + config = { + workspaces = { + notes = "~/projects/notes", + }, + }, + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/extras/editor/obsidian.lua b/.config/nvim/lua/plugins/extras/editor/obsidian.lua new file mode 100644 index 00000000..0b62e8a6 --- /dev/null +++ b/.config/nvim/lua/plugins/extras/editor/obsidian.lua @@ -0,0 +1,48 @@ +return { + "epwalsh/obsidian.nvim", + event = { "BufReadPre */obsidian-vault/*.md" }, + keys = { + { + "gf", + function() + if require("obsidian").util.cursor_on_markdown_link() then + return "ObsidianFollowLink" + else + return "gf" + end + end, + noremap = false, + expr = true, + }, + }, + dependencies = { + "nvim-lua/plenary.nvim", + "hrsh7th/nvim-cmp", + "nvim-telescope/telescope.nvim", + }, + opts = { + dir = vim.env.HOME .. "Documentos/Obsidian/obsidianVault/root", -- specify the vault location. no need to call 'vim.fn.expand' here + use_advanced_uri = true, + finder = "telescope.nvim", + mappings = {}, + + templates = { + subdir = "templates", + date_format = "%Y-%m-%d-%a", + time_format = "%H:%M", + }, + + note_frontmatter_func = function(note) + -- This is equivalent to the default frontmatter function. + local out = { id = note.id, aliases = note.aliases, tags = note.tags } + -- `note.metadata` contains any manually added fields in the frontmatter. + -- So here we just make sure those fields are kept in the frontmatter. + if note.metadata ~= nil and require("obsidian").util.table_length(note.metadata) > 0 then + for k, v in pairs(note.metadata) do + out[k] = v + end + end + return out + end, + }, +} diff --git a/.config/nvim/lua/plugins/extras/ui/comment-box.lua b/.config/nvim/lua/plugins/extras/ui/comment-box.lua new file mode 100644 index 00000000..66fe8254 --- /dev/null +++ b/.config/nvim/lua/plugins/extras/ui/comment-box.lua @@ -0,0 +1,5 @@ +return { + "LudoPinelli/comment-box.nvim", + event = "BufReadPost", + opts = {}, +} diff --git a/.config/nvim/lua/plugins/extras/util/autosave.lua b/.config/nvim/lua/plugins/extras/util/autosave.lua new file mode 100644 index 00000000..1affc133 --- /dev/null +++ b/.config/nvim/lua/plugins/extras/util/autosave.lua @@ -0,0 +1,31 @@ +return { + -- "Pocco81/auto-save.nvim", + "zoriya/auto-save.nvim", -- HACK: use fork until PR is accepted + event = { "InsertEnter" }, + opts = { + callbacks = { + before_saving = function() + -- save global autoformat status + vim.g.OLD_AUTOFORMAT = vim.g.autoformat_enabled + + vim.g.autoformat_enabled = false + vim.g.OLD_AUTOFORMAT_BUFFERS = {} + -- disable all manually enabled buffers + for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + if vim.b[bufnr].autoformat_enabled then + table.insert(vim.g.OLD_BUFFER_AUTOFORMATS, bufnr) + vim.b[bufnr].autoformat_enabled = false + end + end + end, + after_saving = function() + -- restore global autoformat status + vim.g.autoformat_enabled = vim.g.OLD_AUTOFORMAT + -- reenable all manually enabled buffers + for _, bufnr in ipairs(vim.g.OLD_AUTOFORMAT_BUFFERS or {}) do + vim.b[bufnr].autoformat_enabled = true + end + end, + }, + }, +} diff --git a/.config/nvim/lua/plugins/extras/util/no-neck-pain.lua b/.config/nvim/lua/plugins/extras/util/no-neck-pain.lua new file mode 100644 index 00000000..166ba96d --- /dev/null +++ b/.config/nvim/lua/plugins/extras/util/no-neck-pain.lua @@ -0,0 +1,11 @@ +return { + "shortcuts/no-neck-pain.nvim", + opts = {}, + keys = { + { + "uN", + "NoNeckPain", + desc = "No Neck Pain", + }, + }, +}