1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
735f28b62d plugin/telescope: add keymap to show hidden files 2024-09-23 15:38:53 +02:00
dd81949f0a plugin/telescope: update version
The 0.1.x branch wasn't properly updated
2024-09-23 15:38:38 +02:00
2 changed files with 20 additions and 2 deletions

View File

@ -40,7 +40,7 @@
"render-markdown.nvim": { "branch": "main", "commit": "75a0a9596a91130fae43d3b7c0d6c651645ef1df" }, "render-markdown.nvim": { "branch": "main", "commit": "75a0a9596a91130fae43d3b7c0d6c651645ef1df" },
"resession.nvim": { "branch": "master", "commit": "c4d92a57b3936a2d6e1c087dbd6b670da2b1b082" }, "resession.nvim": { "branch": "master", "commit": "c4d92a57b3936a2d6e1c087dbd6b670da2b1b082" },
"statuscol.nvim": { "branch": "main", "commit": "1022f922b77b44c36f8057ac29adbfd89ce86958" }, "statuscol.nvim": { "branch": "main", "commit": "1022f922b77b44c36f8057ac29adbfd89ce86958" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "telescope.nvim": { "branch": "master", "commit": "b324469959908c1c7434eb65d80e87895e6828f7" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"vim-wakatime": { "branch": "master", "commit": "f699e30ca1ba0c7f316847316fd0ba19d3ee51c1" }, "vim-wakatime": { "branch": "master", "commit": "f699e30ca1ba0c7f316847316fd0ba19d3ee51c1" },
"which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" } "which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" }

View File

@ -1,6 +1,5 @@
local spec = { local spec = {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
branch = "0.1.x",
} }
spec.dependencies = { spec.dependencies = {
@ -15,6 +14,9 @@ spec.keys = {
{ "<Leader>fc", "<cmd>Telescope git_status<CR>", desc = "Find changed files" }, { "<Leader>fc", "<cmd>Telescope git_status<CR>", desc = "Find changed files" },
} }
-- Not sure where in the state this is stored, so just track it here
local find_files_show_hidden = false
spec.config = function() spec.config = function()
local telescope = require("telescope") local telescope = require("telescope")
local builtin = require("telescope.builtin") local builtin = require("telescope.builtin")
@ -44,12 +46,26 @@ spec.config = function()
end end
end end
-- Very primitive solution, but good enough for now
local function toggle_hidden(bufnr)
local state = require("telescope.actions.state")
local current_picker = state.get_current_picker(bufnr)
local current_prompt = get_current_prompt(current_picker)
find_files_show_hidden = not find_files_show_hidden
builtin.find_files({ default_text = current_prompt, hidden = find_files_show_hidden })
end
local find_prompt_prefix = "🔍";
telescope.setup({ telescope.setup({
defaults = { defaults = {
initial_mode = "insert" initial_mode = "insert"
}, },
pickers = { pickers = {
buffers = { buffers = {
prompt_prefix = find_prompt_prefix,
mappings = { mappings = {
i = { i = {
["<C-d>"] = actions.delete_buffer + actions.move_to_top, ["<C-d>"] = actions.delete_buffer + actions.move_to_top,
@ -61,9 +77,11 @@ spec.config = function()
} }
}, },
find_files = { find_files = {
prompt_prefix = find_prompt_prefix,
mappings = { mappings = {
i = { i = {
["<C-f>"] = cycle_picker, ["<C-f>"] = cycle_picker,
["<C-h>"] = toggle_hidden,
} }
} }
} }