NeoComposer.nvim
NeoComposer.nvim copied to clipboard
Feature Request - Adding Filetype-Specific Macros and Namespaces
Hi,
I really like NeoComposer. It reminds me of a plugin I use in normal Vim named Marvim but which hasn't seen much activity lately.
As they basically serve the same purpose (I still haven't tested Marvim in Neovim), I was wondering if you planned on additional some additional features that it supports that I don't see in NeoComposer such as:
- filetype-specific macros
- namespaces to more easily manage macros
Thanks
Thank you for the feedback. Can you walk me though what those new features would look like? You mentioned namespace. Does that mean the ability to name your macros? How would you prefer to interact with those features given the current ui? Lots of questions, I know 🥹 Just trying to determine the best way to implement it.
Yes. You can name macros. By default, macros are saved in a namespace corresponding to the filetype you had open when you saved the macro. They also pop-up when I invoke it when I have a file of that filetype open. So if I have some macros specific to markdown, it would automatically prepend the markdown
namespace to the name of the macro and it would be named: markdown:name_of_macro
. When you tell it to run a macro and you are in a markdown file, it would automatically open the markdown
namespace and allow you to select one of the named macros. I could backspace and change the namespace to something else if I wanted to (so I can manually create a namespace where I have my generic macros and then tell it to run this)
Sorry I haven't forgotten. I've just been swamped with school and internship obligations. 😅
I second this. For my use case, being able to name macros for future usage and have them versioned somewhere (for fast setup / sharing) is key. That also allows a small community to grow around this tool as macros now become shareable utilities.
The way I see this design:
- When finishing recording a macro, the message is displayed in the command line:
Name the macro (default current date time):
- If no name is given, name format will be:
YYYY-MM-DD HH:mm:ss
- If no name is given, name format will be:
- The macro is stored preferably in a text-based format that is easy to parse and human-readable (I saw SQLite dependency, maybe going this way is a simpler idea + make this plugin dependency-free?)
- Text-based macro library format could be something like this:
[macros."${macro_name || date}"] # If macro has been named, then, date macro = "jj3wd" # Raw sequence recorded by macro. date = "2024-02-22" file_type = "js" # Fetched automatically from the file the macro was recorded. If buffer, then "txt". namespace = "my_personal_projects" # Optional, up to the developer to fill this manually when organizing.
- Text-based macro library format could be something like this:
- When calling
:Telescope macros
showName: ${macro_name} | ${file_type} | ${namespace}
and allow filtering by these fields with the normal fuzzy search it is already capable of doing.
Let me know what you think. Perhaps I could try to write something.
I welcome any PRs, but I don't have the bandwidth right now to make any major changes.