From aa23da0325cba2fa56cb2e68f842543909eac69a Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 30 Sep 2023 03:04:30 +0200 Subject: nvim: Call git_files() when in a git repo --- .config/nvim/after/plugin/telescope.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to '.config/nvim/after/plugin') diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua index fa355e1..c7f4937 100644 --- a/.config/nvim/after/plugin/telescope.lua +++ b/.config/nvim/after/plugin/telescope.lua @@ -1,9 +1,15 @@ +local os = require('os') local builtin = require('telescope.builtin') local lib = require('mango.lib') ---vim.keymap.set('n', 'pf', builtin.git_files, {}) +lib.remap('n', 'pf', function() + if os.execute('git rev-parse --is-inside-work-tree') == 0 then + builtin.git_files() + else + builtin.find_files() + end +end) -lib.remap('n', 'pf', builtin.find_files) lib.remap('n', 'ps', function() builtin.grep_string({ search = vim.fn.input('Grep > ') }) end) -- cgit v1.2.3