Skip to content
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

Add motion_forcing to Hop. #65 #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jhgarner
Copy link

This gives users an easy way to customize how motions work with operators. You can force the motion to act linewise, charwise, or blockwise. The default tries to match how Neovim's handles the f/t/F/T operators.

This gives users an easy way to customize how motions work with
operators. You can force the motion to act linewise, charwise, or
blockwise. The default tries to match how Neovim's handles the f/t/F/T
operators.
@jhgarner
Copy link
Author

jhgarner commented Oct 13, 2024

Looks like Github decided to display issue 65 from the original repo instead of this one. Here's a link to the issue I'm actually trying to fix #65

lua/hop/init.lua Outdated
vim.cmd('normal! v')
elseif opts.direction == hint.HintDirection.BEFORE_CURSOR then
-- This lines up with how the F and T motions work
vim.cmd('normal! <C-V>')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this break if hopping to a previous line? Shouldn't it also just be normal! v?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like blockwise was doing the right thing, but I don't really understand why. What I really wanted was for the motion to be exclusive which happens to be default, so I've updated the code to remove this elseif.

The original commit made backwards hopping blockwise. Although that did
the right thing, it doesn't really make sense. What we really want is
for the motion to be exclusive. I've updated the code and docs to make
it exclusive instead of blockwise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants