Skip to content

Commit

Permalink
feat(telescope): allow word and selection searches (LazyVim#1096)
Browse files Browse the repository at this point in the history
Changes the current normal-mode mappings <leader>sw / <leader>sW to only
display matches surrounded by word boundaries. Also adds the equivalent
visual-mode mappings to allow searching for the current selection.

Selection searching does not consider word boundaries, so highlighting a
single word and searching for it will produce the same results as the
word-under-cursor searching did before this change. This allows the user
to easily choose whether or not to include word boundaries in their
search.
  • Loading branch information
SameAsMuli committed Jul 22, 2023
1 parent 02d673d commit 6b2c648
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/lazyvim/plugins/editor.lua
Expand Up @@ -119,8 +119,10 @@ return {
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
{ "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
{ "<leader>sw", Util.telescope("grep_string"), desc = "Word (root dir)" },
{ "<leader>sW", Util.telescope("grep_string", { cwd = false }), desc = "Word (cwd)" },
{ "<leader>sw", Util.telescope("grep_string", { word_match = "-w" }), desc = "Word (root dir)" },
{ "<leader>sW", Util.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" },
{ "<leader>sw", Util.telescope("grep_string"), mode = "v", desc = "Selection (root dir)" },
{ "<leader>sW", Util.telescope("grep_string", { cwd = false }), mode = "v", desc = "Selection (cwd)" },
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
{
"<leader>ss",
Expand Down

0 comments on commit 6b2c648

Please sign in to comment.