From 69bd289324a1eb9c97a8ca657f22e7a0a013e1d9 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 13 Aug 2022 19:57:43 +0200 Subject: [PATCH] nvim: run live_grep in project root, add registers --- .config/nvim/lua/my/tools.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.config/nvim/lua/my/tools.lua b/.config/nvim/lua/my/tools.lua index c6c4ee2..1d298a4 100644 --- a/.config/nvim/lua/my/tools.lua +++ b/.config/nvim/lua/my/tools.lua @@ -38,15 +38,18 @@ packer.use { } } - map('n', 'tb', require('telescope.builtin').buffers) + local builtin = require('telescope.builtin') + local my = require('my.functions') + map('n', 'tb', builtin.buffers) map('n', 'tf', function() - require('telescope.builtin').find_files({ - cwd = require('my.functions').get_project_root() - }) + builtin.find_files({ cwd = my.get_project_root() }) end) - map('n', 'tr', require('telescope.builtin').oldfiles) - map('n', 'tg', require('telescope.builtin').live_grep) - map('n', 'tm', require('telescope.builtin').man_pages) + map('n', 'tr', builtin.oldfiles) + map('n', 'tg', function() + builtin.live_grep({ cwd = my.get_project_root() }) + end) + map('n', 'tm', builtin.man_pages) + map('n', 'tp', builtin.registers) end }