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

Shortcut functions (for use in mappings) #23

Merged
merged 4 commits into from
Apr 5, 2023
Merged

Conversation

weeman1337
Copy link
Collaborator

@weeman1337 weeman1337 commented Jul 3, 2022

Two shortcut functions as a start:

Name Action
grep_word_under_cursor Start live grep with word under cursor
grep_visual_selection Start live grep with visual selection

Have a look at the README for details.

closes #51

part of #14

@jesseleite
Copy link
Contributor

Also would be nice to grep visual selection, like I implemented in https://github.com/jesseleite/vim-agriculture#mappings

@vignesh0025
Copy link

When will this get merged ? Thank you for the support.

@weeman1337 weeman1337 changed the title Adding shortcut functions (for use in mappings) Shortcut functions (for use in mappings) Mar 21, 2023
@weeman1337 weeman1337 marked this pull request as ready for review April 3, 2023 17:08
@weeman1337
Copy link
Collaborator Author

It would be great if someone could test the implementation in this PR.

@weeman1337 weeman1337 merged commit 0f75ea8 into master Apr 5, 2023
@gstokkink
Copy link

gstokkink commented Apr 6, 2023

@weeman1337 the grep word under cursor works great, but the grep visual selection always does a blank grep for me. I have it mapped as follows:

-- Live grep with visual selection
map(
  'v',
  '<Leader>[',
  "<CMD>lua require('telescope-live-grep-args.shortcuts').grep_visual_selection()<CR>",
  default_options
)

Edit: ah, I figured out what goes wrong. This only occurs when the visual selection starts with a whitespace, like when you visually select an indented line using V, and then call this function. If I leave out the whitespace from the selection, it works. Would be nice if this got fixed! Thanks for your efforts 😉

@weeman1337
Copy link
Collaborator Author

#55 @gstokkink

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.

Automatically select the word under cursor when invoking live grep
4 participants