-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(note-taking): added global-note.nvim plugin (#934)
* feat(note-taking): added global-note.nvim plugin * refactor(note-taking-nvim): Rewrote get_project_name function
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}, | ||
}, | ||
} |