Skip to content

Commit

Permalink
feat(nvim): live grep in cwd by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sbulav committed Apr 15, 2024
1 parent c6fe658 commit 7956e91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nvim/after/plugin/keymap.vim
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ nnoremap <leader>A :argadd <C-R>=fnameescape(expand('%:p:h')).'/**/*'<CR>
" Telescope
" <c-x>,<c-v> open in split/vsplit, <c-u>,<c-d> up/down preview
nnoremap <leader>fM <cmd>lua require('telescope.builtin').marks()<cr>
nnoremap <leader>fa <cmd>lua require('telescope.builtin').live_grep()<cr>
nnoremap <leader>fA <cmd>lua require('telescope.builtin').live_grep()<cr>
nnoremap <leader>fa <cmd>lua require('config.telescope_myfunctions').grep_in_cwd()<cr>
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
nnoremap <leader>fc <cmd>lua require('telescope.builtin').git_commits()<cr>
nnoremap <leader>fF <cmd>lua require('telescope.builtin').find_files()<cr>
Expand Down
7 changes: 7 additions & 0 deletions nvim/lua/config/telescope_myfunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ M.search_in_cwd = function()
}
end

M.grep_in_cwd = function()
require("telescope.builtin").live_grep {
prompt_title = "< Grep in Current Directory >",
cwd = vim.fn.expand "%:p:h",
}
end

M.search_vimfiles = function()
require("telescope.builtin").find_files {
prompt_title = "< Find Vimfiles >",
Expand Down

0 comments on commit 7956e91

Please sign in to comment.