Closed jacobrreed closed 1 month ago
@jacobrreed This is the best I've managed so far:
keys = {
{ "<leader>ci", ":CodeSnap<cr>", desc = "CodeSnap", mode = "x" },
},
It works fine but due to using the :
you do briefly see that you've entered command mode. If that doesn't bother you then this will suffice.
I'm yet to find a way to do it silently (without seeing the command in command mode) using vim.cmd
or <cmd>...<cr>
or anything else.
The closest I got was:
vim.keymap.set("x", "<leader>ci", [['<,'>CodeSnap]])
This almost worked but the first time I enter visual mode I get a "Mark not set" error, which is something to do with <
and >
. I'n not sure why it doesn't register the marks the first time (vim issue, plugin issue, something else???) but if you exit visual mode and then try again it seems to work. But I didn't want it to be temperamental so I've settled for the mapping I put at the top.
ah Ok this works great, x
mode was the answer, also to stop the above from bothering you just add silent=true
This is my setup now, works good
@mistricky Might want to add some documentation on keybind setup, the above seems to work thanks
also to stop the above from bothering you just add
silent=true
Thank you!
Hi @jacobrreed, thx for this issue, sorry reply late.
Might want to add some documentation on keybind setup
Add keybind setup to document would be great! I'll document it later
The Keymappings chapter was updated on README.
Can you add your setup for keymaps?
Currently this doesnt work, I have to manually visually select, then type the command CodeSnap removing the range selectors
<
and>
If i use the above it will just say "no code selected"