aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lua/pml68/remap.lua30
1 files changed, 18 insertions, 12 deletions
diff --git a/lua/pml68/remap.lua b/lua/pml68/remap.lua
index 3846493..950140d 100644
--- a/lua/pml68/remap.lua
+++ b/lua/pml68/remap.lua
@@ -64,22 +64,28 @@ vim.keymap.set('n', '<leader>fg', "<cmd>Telescope git_files<CR>", {})
vim.keymap.set('n', '<leader>fd', "<cmd>Telescope diagnostics<CR>", {})
vim.keymap.set('n', '<leader>ft', function()
local telescope = require("telescope.builtin")
- local todo_files = {}
-
- local handle = io.popen("rg --files -g 'TODO.{md,txt}'")
+ local handle = io.popen("rg 'TODO'")
local result = handle:read("*a")
handle:close()
- for file in result:gmatch("[^\r\n]+") do
- table.insert(todo_files, file)
- end
+ if result:match("[^\r\n]+") == nil then
+ local todo_files = {}
+
+ local files_handle = io.popen("rg --files -g 'TODO.{md,txt}'")
+ local files_result = files_handle:read("*a")
+ files_handle:close()
+
+ for file in files_result:gmatch("[^\r\n]+") do
+ table.insert(todo_files, file)
+ end
- if #todo_files > 0 then
- telescope.find_files({
- prompt_title = "Choose TODO file",
- cwd = vim.fn.getcwd(),
- search_dirs = todo_files
- })
+ if #todo_files > 0 then
+ telescope.find_files({
+ prompt_title = "Choose TODO file",
+ cwd = vim.fn.getcwd(),
+ search_dirs = todo_files
+ })
+ end
else
telescope.grep_string({ search = "TODO" })
end