Skip to content

Feature: Global Search Behavior Inspired by VS Code (@, #, $, etc.) #2058

@Ali-Aref

Description

@Ali-Aref

Have you RTFM'd?

  • I have done proper research

Feature Request

Hi everyone — first of all, thank you for this awesome plugin! It’s fast, flexible, and makes Neovim feel like a modern editor.

I’d love to suggest a feature that mimics VS Code’s global search behavior via prefixes in the Ctrl+p menu. The idea is to allow smart, context-aware searches by using specific starting characters. Here's what I mean:

Prefix Behavior
@ Search symbols in current file
# Search workspace/global symbols (via LSP)
no prefix Search files by name
$ Search open buffers

This approach keeps search unified in a single interface while still offering contextual power — similar to VS Code’s Ctrl+p. It would reduce the cognitive load of remembering multiple commands and help users move even faster inside Neovim.

🙋 Is this possible?
Is it currently feasible to implement something like this via fzf-lua or fzf.vim? And if so, would it make sense to integrate this behavior into the plugin or expose an interface to let users define prefix handlers?

Thanks again for the great work, and I’d love to hear your thoughts! 🚀


Here is how I have implemented this currently using fzf

return {
  "ibhagwan/fzf-lua",
  dependencies = { "nvim-tree/nvim-web-devicons" },
  opts = {},
  config = function()
    local fzf = require("fzf-lua")
    local config = fzf.config
    local actions = config.actions

    local function vscode_search()
      vim.ui.input({ prompt = "Search: " }, function(input)
        if not input then return end
        
        if input:sub(1, 1) == "#" then
          -- Global/workspace symbols search
          fzf.lsp_workspace_symbols({ query = input:sub(2) })
        elseif input:sub(1, 1) == "@" then
          -- Document symbols search
          fzf.lsp_document_symbols({ query = input:sub(2) })
        else
          -- File search
          fzf.files({ query = input })
        end
      end)
    end

    fzf.setup({})
    
    -- other mappings
    vim.keymap.set("n", "<leader>ff", vscode_search, { desc = "VSCode-like search" })
  end,
}

But this doesn't feel smooth and fast.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions