diff options
| author | Marcelo <setanta@gmail.com> | 2025-03-30 04:26:45 -0300 |
|---|---|---|
| committer | Marcelo <setanta@gmail.com> | 2025-03-30 04:26:45 -0300 |
| commit | ffb28d8745befa70979488b75bb50fa1efc9f478 (patch) | |
| tree | 1b53112dd19203ecb120d6c17d182453b9a2aab9 | |
| parent | 70fa6519abe34d9251b4cef6122257fc0edbd4aa (diff) | |
Make telescope open_file and git_file appearances consistent.
And opening the files from the current commit with git_files will
exclude deleted files.
| -rw-r--r-- | lua/config/plugins/telescope.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lua/config/plugins/telescope.lua b/lua/config/plugins/telescope.lua index 4faa22b..aa4893d 100644 --- a/lua/config/plugins/telescope.lua +++ b/lua/config/plugins/telescope.lua @@ -26,6 +26,12 @@ return { }, } + local open_file_appearance = vim.tbl_extend("force", grep_appearance, { + previewer = false, + sort_lastused = true, + sort_mru = true, + }) + local telescope = require("telescope") telescope.setup({ defaults = { @@ -50,6 +56,8 @@ return { sort_mru = true, ignore_current_buffer = true, }, + find_files = open_file_appearance, + git_files = open_file_appearance, live_grep = grep_appearance, grep_string = grep_appearance, help_tags = { @@ -85,7 +93,7 @@ return { end, { desc = "Lists function names from treesitter queries", }) vim.keymap.set("n", "<Leader>o", function() - local ok, _ = pcall(builtin.git_files, { previewer = false }) + local ok, _ = pcall(builtin.git_files) if not ok then builtin.find_files() end @@ -100,8 +108,7 @@ return { end, { desc = "Show files marked as modified by git." }) vim.keymap.set("n", "<Leader>gF", function() local ok, _ = pcall(builtin.git_files, { - previewer = false, - git_command = { "git", "diff-tree", "--no-commit-id", "--name-only", "HEAD", "-r" } + git_command = { "git", "diff-tree", "--no-commit-id", "--name-only", "--diff-filter=d", "HEAD", "-r" } }) if not ok then builtin.find_files() |
