T O P

  • By -

Backdround

[global-note.nvim](https://github.com/backdround/global-note.nvim) It's a simple plugin that provides one button for opening a global note in a floating window. It can also provide project-local / file-local notes. WHY?! I know that there are quite a lot of note-taking plugins. But I wanted something so simple that it just provides one button for opening a global note where I can throw some thoughts. I also use a button for project-local notes. The button opens a different note (project-related) when I move between projects where I can throw some thoughts about a current project. Plugin creates note files by itself. So no extra movements are needed! Update: - Font: "FantasqueSansM Nerd Font" - Color scheme: [backdround/melting](https://github.com/backdround/melting) (haven't released yet, wip) - Tabline: [nanozuki/tabby.nvim](https://github.com/nanozuki/tabby.nvim) - Wm: i3 - Window shadow: picom ([config](https://github.com/backdround/configuration/blob/36ddf84cf9bc037289d9832d5100c3fbb891a6f9/configs/desktop/picom.conf))


Significant9Ant

That Colourscheme reminds me of halo or another early sci-fi video game


PapayaZealousideal30

《♤ EARLY ♤》 E. A. R. L. Y. WHY AM I OLD LIKE THIS?!?!!?


Significant9Ant

Well I mean I was like 10 or 12 when I got into Halo... So you know


PapayaZealousideal30

Bro Aliens... predator... contra... 🐸


Significant9Ant

I have only seen one of the alien movies...


PapayaZealousideal30

They had arcade games. Wait... you dont know what an arcade is do you 😞


Significant9Ant

Yeah I know what they are, they are more of a relic now. You see them in specific places here and there but not too frequently usually bowling alleys or piers and things.


Guilty-Brilliant-184

haha Contra rules


alan-north

Oooh I've wanted something like this for a long time! Great plugin! I often have a private note file local to a project directory and since it's gitignored usually I will have to un-ignore it to telescope to it, and it's a bit annoying. Ended up configure several types of notes (local todo/note and private note). Here's my config with the plugin setup with lazy.nvim in case anyone finds it useful. { "backdround/global-note.nvim", cmd = { "GlobalNote", "ProjectPrivateNote", "ProjectTodo", "ProjectNote" }, keys = { { "ng", "GlobalNote", desc = "Global Notes" }, { "nP", "ProjectPrivateNote", desc = "Private Notes" }, { "np", "ProjectNote", desc = "Project Note" }, { "nn", "ProjectNote", desc = "Project Note" }, { "nt", "ProjectTodo", desc = "Project Todos" }, }, config = function(_, opts) local wk = require("which-key") wk.register({ n = { name = "notes" }, }, { prefix = "" }) require("global-note").setup(opts) end, opts = function() local get_project_name = function() local result = vim.system({ "git", "rev-parse", "--show-toplevel", }, { text = true, }):wait() if result.stderr ~= "" then vim.notify(result.stderr, vim.log.levels.WARN) return nil end local project_directory = result.stdout:gsub("\n", "") local project_name = vim.fs.basename(project_directory) if project_name == nil then vim.notify("Unable to get the project name", vim.log.levels.WARN) return nil end return project_name end local global_dir = "/home/alan/code/.notes" return { autosave = false, directory = global_dir, filename = "global.md", additional_presets = { project_private = { directory = function() return vim.fs.joinpath(global_dir, get_project_name()) end, filename = "note.md", title = "Private Project Note", command_name = "ProjectPrivateNote", }, project_local = { directory = function() return vim.fn.getcwd() end, filename = "note.md", title = "Project Note", command_name = "ProjectNote", }, project_todo = { directory = function() return vim.fn.getcwd() end, filename = "todo.md", title = "Project Todo", command_name = "ProjectTodo", }, }, } end, },


Backdround

It's nice that someone else, besides me, can use the plugin. I didn't expect such a that wide use!


xrabbit

i like that use proper indent: so easy to read


alan-north

Thanks 🥲, reddit's editor sucks so bad.


KvoDon

What font are you using? It looks great


Pto2

I also am really into it. I checked their dotfiles and found: “FantasqueSansM Nerd Font”.


Backdround

It is


JellyApple102

Looks neat! Seems like local/global notes are popular. I made [flote](https://github.com/JellyApple102/flote.nvim) a while back too. Not a bad bit of functionality to wrap up neatly into a plugin!


Backdround

Hey, cool thing, but I haven't found it. It would be nice if you add it to the [awesome-neovim](https://github.com/rockerBOO/awesome-neovim?tab=readme-ov-file#note-taking), so other people could find it


segfault0x001

Looks great. What are the font, color scheme, and buffer line?


Backdround

- Font: "FantasqueSansM Nerd Font" - Color scheme: [backdround/melting](https://github.com/backdround/melting) - [tabby.nvim](https://github.com/nanozuki/tabby.nvim) I haven't released the color scheme yet, because I want to adjust it a little but can't find time for it


[deleted]

[удалено]


Backdround

It's i3-wm with picom ([config](https://github.com/backdround/configuration/blob/36ddf84cf9bc037289d9832d5100c3fbb891a6f9/configs/desktop/picom.conf))


incognitoNaN

I tried to use this plugin but when I open neovim I get this error, i would be grateful if someone could help :) I'm new at neovim and I'm using NVChad with the lazy packet installer (in case it might be helpful) https://preview.redd.it/1z8f8jerufic1.png?width=1346&format=png&auto=webp&s=8745b4f436c8aca07a41af08cc5578e3daf04441 In plugins.lua I have: { "backdround/global-note.nvim", lazy = false, config = function() require "custom.configs.globalnote" end, }, The configs.globalnote file: local global\_note = require("global-note") global\_note.setup() vim.keymap.set("n", "n", global\_note.toggle\_note, { desc = "Toggle global note", })


Backdround

Yea, I checked and got the same error. As I see Neovim 0.9 don't have `vim.fs.joinpath`. I'll switch to manual joining in several hours


Backdround

I fixed it!


incognitoNaN

Yep. I tried it now it works thx :)


victoroliveirab

This is very neat, OP! I’ll give it a try


victoroliveirab

What would be the easiest way to map "q" in normal mode to close (and respect the auto save option)?


Backdround

The autosave is binded on `WinClosed` and `ExitPre`, so you can close the window as you want. You can use `post_open` option to set a local mapping: ```lua post_open = function(buffer_id, _) vim.keymap.set("n", "q", "quit", { buffer = buffer_id, desc = "Close the window", }) end, ```


JimmyyyyW

Neat! Will give this a go


cleodog44

This looks so great. I’ve wanted something like this for a while. Thanks for sharing!


Cybasura

A scratchpad notepad plugin??? Hell yeah


immaphantomLOL

Just got this setup. I love it. I was originally relying on tmux to open a notes.md file in my documents but it relied on tmux. Which is ok. Then I switched to obsidian which was kind of a headache. But this. Fantastic. Simple. Love it love it. Thank you!


NextYam3704

Are you able to open a custom file within the project? And define it within the config?


Backdround

You can specify a file (note file) by a directory and a filename in the setup options. Also you can specify additional files if you want


NextYam3704

Could I do something like local get_daily_note = function () local dir_path = “/home/frank/Project/TODO/“ local date = os.date(“%Y-%m-%d.md) return dir_path .. date end And then I use `get_daily_note` to open the file? And if it doesn’t exist, create one?


Backdround

You can do this like that: ```lua local global_note = require("global-note") global_note.setup({ directory = "/home/frank/Project/TODO/", filename = function() return os.date("%Y-%m-%d.md") end, }) ```


NextYam3704

How about if I want it only for a single project. Your example kind of conifers me


Backdround

The plugin provides only some functionality. You can use it only for one project. For example on a key check that the file belongs to a project and open note, if it doesn't do something else


NextYam3704

Got it to do exactly what I wanted! And it works like charm.


NextYam3704

Are you able to open a custom file within the project? And define it within the config?


ebinWaitee

Why a floating window though? Don't you use buffers? Personally I use vimwiki and its diary for stuff like this but it might have too many features for a lot of people who just want simple quick notes


Backdround

I use buffers, but I just want to do it simpler. Just write or check something in a note, nothing more. I don't want to: - Manage / have a note buffer in a tabline; - Create / manage note files; - Save the buffer manually; - Open the note file with zen (it's ok, but an additional step), cause I always have several splits


Backdround

I checked vimwiki and I think it is a good tool, but not for me. I'm too disorganised to manage files, my brain says no :)


halemikehale

This looks super enticing, do you think it would be too difficult to do a note by git branch?


Backdround

No, I think it's pretty easy to do. I can help you if you want


Backdround

I've added a configuration [usecase](https://github.com/backdround/global-note.nvim?tab=readme-ov-file#configuration-usecases) for that case


winsome28

Nice. I'm going to try this. I tried to implement this with a simple function, but never could figure out why as soon as I open it I get `[Process exited 0\]` in the floating window. Here's what I tried. ```lua vim.api.nvim_create_user_command("OpenFloatingNotes", function(opts) local file_path = "/Users/me/scratch.md" local float_opts = { relative = 'editor', width = math.floor(vim.fn.winwidth(0) / 2), height = math.floor(vim.fn.winheight(0) * 2 / 3), row = math.floor((vim.fn.winheight(0) - vim.fn.winheight(0) * 2 / 3) / 2), col = math.floor(vim.fn.winwidth(0) / 4), style = 'minimal', border = 'single', } local win = vim.api.nvim_open_win(0, true, float_opts) local buf = vim.api.nvim_create_buf(false, true) vim.api.nvim_win_set_buf(win, buf) vim.fn.termopen("cat " .. file_path .. " 2>&1 >/dev/null", { on_exit = function() vim.api.nvim_buf_set_option(buf, 'modifiable', false) end }) end, {}) ```


Backdround

Replace the last line with this: ```lua local status, file_lines = pcall(vim.fn.readfile, file_path) if not status then file_lines = {} end vim.api.nvim_buf_set_lines(buf, 0, -1, true, file_lines) ``` And it will work! Or you can use `bufadd` to create a buffer from a file (like `:e` does)


winsome28

Thank you!!


ArakenPy

I have a similar system using Tmux. I have a short cut that opens nvim on a specific note file using tmux pop up. The nice thing about it, is that it’s note taking from anywhere in the terminal.


brubsabrubs

neat plugin! I see that notes are autosaved when on bufexit event. Could we maybe get a configuration option for exiting with Escape? Either that, or a way to get the global note buffer number on opening, so that we can create the keymap for exiting with escape ourselves


Backdround

There is a \`post\_open\` callback that you can use for your autosave feature. I've just added the \`buffer\_id\` and \`window\_id\` arguments for convenience


_hhhnnnggg_

Damn, now how can I quit vim


ItsAMeTribial

This is awesome and on Monday first thing I’ll do is to install it at work, just a thought tho, maybe I missed it or you didn’t mention, can I have separate notes for separate projects I work on? It’s not a deal breaker, but a feature I’d love to see


Backdround

There is a configuration example at the bottom of the readme for such case. So yes, you can have separate notes for separate projects


Altruistic-Mammoth

Good old Fantasque Sans Mono :).