Skip to content

barklan/telescope-git-grep.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Telescope git grep

screen

Installation

With lazy.nvim:

{
    "nvim-telescope/telescope.nvim",
    dependencies = {
        ...
        "barklan/telescope-git-grep.nvim",
    },
    config = function()
        local gitgrep_actions = require("telescope-git-grep.actions")

        require("telescope").setup({
            extensions = {
                git_grep = {
                    auto_quoting = true,
                    mappings = {
                        i = {
                            ["<C-k>"] = gitgrep_actions.quote_prompt(),
                            ["<C-s>"] = gitgrep_actions.quote_prompt({ postfix = ' --since=' }),
                        },
                    },
                },
            },
        })
        require("telescope").load_extension("git_grep")
    end,
}

Usage

vim.keymap.set(
    "n",
    "<leader>fg",
    ":lua require('telescope').extensions.git_grep.git_grep()<CR>",
    { silent = true, desc = "git grep" }
)
vim.keymap.set(
    "n",
    "<leader>fb",
    ":lua require('telescope').extensions.git_grep.git_bgrep()<CR>",
    { silent = true, desc = "git grep buffer" }
)

Acknowledgements

This is basically a slightly modified version of telescope-live-grep-args.nvim.

Releases

No releases published

Packages

No packages published

Languages