-
Notifications
You must be signed in to change notification settings - Fork 24
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
How to make Cheatsheet.txt dynamic? #7
Comments
Hi @siduck76 :) Glad to hear that you're trying to add it to NvChad! There was a recent question regarding the same issue, and I'm planning to solve it along with local cheatsheet = require('cheatsheet.nvim')
cheatsheet.add_cheat("Toggle NvimTree", "<C-N>", "optional-section-name") ... so that it's possible to add them programmatically. Then I think it'll be easy for you to loop over the |
yes :D |
@sudormrfbin let me if this gets before 18th please! I need to release v1.0 before 19th of this month :c |
Also would it be possible to add heading for the mappings? like : Telescope old files | fw |
So I have this mappings table , with multiple tables in it ( for each plugin ) so I wanna loop through and do something like this :
|
I'll try to finish it up before 18th then, most probably tomorrow :)
That should be handled by sections: add_cheat("old files", "<leader>fw", "Telescope") |
is this a config? I didnt find it in the readme |
I meant the
|
I cant write the cheatsheet keybinds manually tho :/ , isnt there any automatic way? |
Since the mappings file in NvChad config will be modified by the user , writing the cheatsheet manually which will get old ( when the user changes his mappings ) is not gonna work. |
Oh you misunderstood me, |
ohh cool , lemme know when it gets done ❤️ |
I've added local cheatsheet = require('cheatsheet')
for section, data in pairs(mappings) do
for description, keymap in pairs(data) do
cheatsheet.add_cheat(description, keymap, section)
end
end I suggest adding better worded descriptions for each of the mappings since here we are simply using the key name of the mapping in the table as a substitute (it doesn't play nice with the search because of underscores and camelCase). |
Thanks this works! Btw how do I make the cheatsheet popup ( telescope ) show and list out only cheatsheet made by mappings? I dont wanna list cheatsheet for default vim mappings . so I'll make two mappings :
|
You can do it like so (with cf069d8): cheatsheet = require('cheatsheet')
-- for :Cheatsheet ( will show default cheetsheet with default vim mappings and stuff )
cheatsheet.show_cheatsheet_telescope()
-- for user cheatsheet ( will show those from mappings table only )
cheatsheet.show_cheatsheet_telescope({bundled_cheatsheets=false, bundled_plugin_cheatsheets=false}) |
hi @sudormrfbin , very cool plugin! Im liking it so far but one thing bugs me . We can write our mappings in cheatsheet.txt , Is there anyway to make this automatic?
Im trying to add this plugin in NvChad and the user config contains this
So obviously I cant define any mappings in the cheatsheet.txt since the user would change his mappings here and would have to manually do it again in cheatsheet.txt :c .
Is there a way get all defined mappings ( keys and their cmds) and get it work with cheatsheet.nvim?
The text was updated successfully, but these errors were encountered: