Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(note-taking): added global-note.nvim plugin #934

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lua/astrocommunity/note-taking/global-note-nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Global-note.nvim

It's a simple Neovim plugin that provides a global note in a float window.

**Repository:** <https://github.com/backdround/global-note.nvim>

**Notes:** A project local note has also been setup
48 changes: 48 additions & 0 deletions lua/astrocommunity/note-taking/global-note-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
local get_project_name = function()
local project_name

local project_directory, err = vim.loop.cwd()
if not project_directory then
vim.notify(err, vim.log.levels.WARN)
else
project_name = vim.fs.basename(project_directory)
end

if not project_name then vim.notify("Unable to get the project name", vim.log.levels.WARN) end

return project_name
end

return {
"backdround/global-note.nvim",
dependencies = {
{ "AstroNvim/astroui", opts = { icons = { Notes = " " } } },
{
"AstroNvim/astrocore",
opts = function(_, opts)
local maps = opts.mappings
local prefix = "<Leader>m"

maps.n[prefix] = { desc = require("astroui").get_icon("Notes", 1, true) .. "Notes" }
maps.n[prefix .. "m"] = {
function() require("global-note").toggle_note() end,
desc = "Toggle global note",
}
maps.n[prefix .. "l"] = {
function() require("global-note").toggle_note "project_local" end,
desc = "Toggle local note",
}
end,
},
},
opts = {
title = " Global note ",
additional_presets = {
project_local = {
command_name = "ProjectNote",
filename = function() return get_project_name() .. ".md" end,
title = function() return " Note for project " .. get_project_name() .. " " end,
},
},
},
}
Loading