-
Notifications
You must be signed in to change notification settings - Fork 46
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
Discussion: (suggested) mappings for treesitter and remote #242
Comments
[Disclaimer: I'm new to leap and have only started using it since yesterday 😄] With regard to remote, I'm not sure you need line-wise or block-wise by default. The documentation encourages users to use normal remote mode versus operator remote mode to allow greater flexibility with making selections anyways. And for those that use the operator remote mode solely (like me), I still don't have a problem making line-wise selections using standard vim methods. And in the worse case, I can always just press With regards to treesitter, I lean towards to Finally, with regards to remote and treesitter, I don't need any shortcuts as the above compose well. If I want to do a remote yank of a line-wise treesitter selection, then it's My leap configuration for reference and the basis for my comments above (not shown, I use require("leap").opts.equivalence_classes = { " \t\r\n", "([{", ")]}", "'\"`" }
require("leap.user").set_repeat_keys("<enter>", "<backspace>")
-- I prefer bi-directional searches as the downsides are mostly compensated
-- for by the above set_repeat_keys. I lose dot-repeats, but I'm not using
-- them anyways because I don't want repeat.vim. The other downside is
-- that we don't get as many autojumps, but we'll see how that pans out.
--
-- I had to move mini.surround to gz to make room for this binding.
vim.keymap.set({ "x", "n", "o" }, "s", function()
require("leap").leap({
target_windows = { vim.api.nvim_get_current_win() },
})
end)
-- With bi-directional searching enabled, I use this binding to search other
-- windows. I originally combined them all into one binding to search all
-- windows, but one of leap's benefites is that first autojump, so this helps
-- improve the odds by limiting matches.
vim.keymap.set({ "x", "n", "o" }, "S", function()
require("leap").leap({
target_windows = require("leap.util").get_enterable_windows(),
})
end)
-- I only use remote operations via operating pending mode. This allows me to
-- save wasting another key in my normal mode mappings.
vim.keymap.set({ "o" }, "r", function()
require("leap.remote").action()
end)
-- This mapping is what LazyVim uses for the built-in treesitter plugin
-- incremental selection, so using it doesn't waste another key in my
-- configuration as I already had this one bound to the same function..
vim.keymap.set({ "n", "x", "o" }, "<C-Space>", function()
require("leap.treesitter").select()
end)
-- Automatically paste when doing a remote yank operation.
vim.api.nvim_create_augroup("LeapRemote", {})
vim.api.nvim_create_autocmd("User", {
pattern = "RemoteOperationDone",
group = "LeapRemote",
callback = function(event)
vim.notify(event.data.register)
-- Do not paste if some special register was in use.
if vim.v.operator == "y" and event.data.register == "+" then
vim.cmd("normal! p")
end
end,
}) |
Remote
gs
,gS
(linewise),g<c-s>
(blockwise)? Do we need linewise (and blockwise) by default?Treesitter
Dedicated linewise keys would be great, since they are much more efficient (filtering).
gy
/gY
,ga
/gA
,gb
/gB
,gl
/gL
... ?gy
,gY
- the only ones that have at least some mnemonic value ("y" looks like a branching tree). Note: If "clever-y" is configured, one can use<alt-y>
to yank the current selection (:h v_META
).ga
/gA
- comfortable, work fine with;
and,
(different hand). No mnemonics. "clever-a" is awkward with the pinky.Remote + treesitter
What about shortcuts, basically
require'leap.remote'.action { input = '<treesitter-trigger>' }
?The text was updated successfully, but these errors were encountered: