diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-09-30 03:04:30 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-09-30 03:04:30 +0200 |
commit | aa23da0325cba2fa56cb2e68f842543909eac69a (patch) | |
tree | befc149b38bc67c94b312f6f148016a16ac84511 | |
parent | 82021c72d10c0c1b20551e373b7bc436faae65c5 (diff) |
nvim: Call git_files() when in a git repo
-rw-r--r-- | .config/nvim/after/plugin/telescope.lua | 10 |
1 files changed, 8 insertions, 2 deletions
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', '<leader>pf', builtin.git_files, {}) +lib.remap('n', '<leader>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', '<leader>pf', builtin.find_files) lib.remap('n', '<leader>ps', function() builtin.grep_string({ search = vim.fn.input('Grep > ') }) end) |