Jump to content

Workflow help: search for word and move to closest one in text


Recommended Posts

Hello all!

 

I work a lot with code but sometimes find it annoying to move around in my editor, since my keyboard has small arrow keys. A workflow in which I could hit CMD+Space and write any word, press enter, and move to the end/start of the position of the closest (defined in some way) instance of that word in the text.

 

No idea of how to go about this. It only needs to be usable in one app, and that app supports CMD+F to search for a word, but it does so from the top. 

 

Any suggestions on where to start with this, or if it's even feasible, would be greatly appreciated!

Link to comment

Depends on the IDE you are using... VS Code's CLI has the code --goto <filepath>:<line>:<character> command, for example.

 

But how would a workflow be more convenient than hitting cmd+f, typing the word, and then cycling through the matches with cmd+g?

 

About the arrow keys, I suggest setting up a "hyper key" and remapping hyper+h,j,k,l to the arrow keys via Karabiner or to just use ctrl+n, ctrl+p.

Another option would be to check out how vim approaches the problem (incremental search), and to look for integrations with your IDE or to directly give (neo)vim a try.

 

I don't think it's worth the effort, and I'm not even sure it's possible to devise a generic solution if you're looking to manipulate the scroll view of the app.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...