local builtin = require("telescope.builtin") local function git_exists() local path = require("pl.path") local p = "." while true do local gitpath = p .. "/.git" local d = io.open(gitpath) if d then d:close() return true else p = p .. "/.." end if path.abspath(p) ~= "/" then return false end end end vim.keymap.set('n', '', function() if git_exists() then builtin.git_files() else builtin.find_files() end end, {}) vim.keymap.set('n', 'ff', builtin.find_files, {}) vim.keymap.set('n', 'fg', builtin.live_grep, {}) vim.keymap.set('n', 'fh', builtin.help_tags, {})