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

Find commands #5275

Open
donaldcallen opened this issue Jan 16, 2025 · 5 comments
Open

Find commands #5275

donaldcallen opened this issue Jan 16, 2025 · 5 comments

Comments

@donaldcallen
Copy link

I am a very experienced vi and vim user. In the last year or two, I've gotten interested in Kakoune and have used it a fair amount. I've also read the arguments in favor of select first, operate second. I want to mention something here that I have not seen discussed.

In vim, I use the find (f and t) commands for two purposes:

  1. I want to perform an operation on everything between where the cursor is currently and the character to be found, e.g., 'dt,'.
  2. I simply want to navigate to the found character and once there, do a local operation, e.g., an insert or a replace.

To do 2. in Kakoune, I need to be very careful. If, for example, after a find I press 'i' with the intention of inserting at the target character, the insertion takes place where I came from, not where I'm at. I have to remember to collapse the selection that I didn't want in this case. So it's more mental effort and an extra keystroke than the same situation in vim.

In vim, I can run the find command by itself, not preceded by an operator, which gets me to my target character, where I can do whatever operation I want at that site. If I want 1. above, then I can precede the find with an operator. I have not found a way to separate these two cases easily in Kakoune. It would help if there were non-selecting versions of the find commands. I haven't figured out a way to achieve that myself.

@krobelus
Copy link
Contributor

krobelus commented Jan 16, 2025 via email

@donaldcallen
Copy link
Author

Thanks -- that works.

@donaldcallen
Copy link
Author

Though there is an issue. After using the non-selecting find, alt-. repeats the selecting find.

@krobelus
Copy link
Contributor

krobelus commented Jan 16, 2025 via email

@donaldcallen
Copy link
Author

I would like to add that my observation about the find commands extends to other movement commands as well that select -- w, b, etc. When you want to use movement commands to get somewhere to perform a local operation, which is frequently the case in my experience, I think the vi approach -- operation/selection by movement or just movement -- is superior in this way to Kakoune, where you do not have the option of not selecting by movement. So when you need this, you are forced to collapse the selection after the movement, an extra keystroke. And it's not only the keystroke, it's having to remember to do it, otherwise you get something you didn't intend. Yes, you can undo, but I that this aspect of Kakoune, well done as it is, reduces my editing efficiency.

I know that the claim is that Kakoune beats vim in the vimgolf cases. I haven't looked carefully at them, but frankly, I don't care about those results. I care about my results and what I am finding is that Kakoune is not as efficient an editor for me as vim, nvim or vis.

krobelus has been very helpful in showing me how to add the non-selecting commands and their analogous repeaters. But I'd have to do that with every movement command I use and then I have to remember to use non-selecting movement and repeater when necessary, which is a bigger issue. As opposed to just doing the movement, rather than the operation followed by a movement (which I think is a crucial brilliancy in Bill Joy's original vi design that has been sacrificed by the Kakoune select-then-operate approach) and the normal repeater in either case.

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

No branches or pull requests

2 participants