Replies: 1 comment
-
require('fzf-lua').files {
previewer = {
_ctor = function()
local base = require 'fzf-lua.previewer.builtin'.buffer_or_file
local previewer = base:extend()
function previewer:populate_preview_buf(entry_str)
if entry_str:match('%.env') then
local entry = self:parse_entry(entry_str)
local tmpbuf = self:get_tmp_buffer()
vim.bo[tmpbuf].filetype = 'plaintext'
pcall(
vim.api.nvim_buf_set_lines,
tmpbuf,
0,
-1,
false,
{
'This file is sensitive!!!!!!!!!!!!',
'Do not preview it!!!!!!!!!!!!!!!',
}
)
-- swap preview buffer with new one
self:set_preview_buf(tmpbuf)
self:preview_buf_post(entry)
return
end
self.super.populate_preview_buf(self, entry_str)
end
return previewer
end,
},
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
smartding
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
During development I write my LLM API key in a
.env
file, which is auto-loaded when the program starts.When I run
require("fzf-lua").files()
, I want to disable preview for this.env
only, so as to avoid accidentally showing someone the API key in preview.Is it doable?
Beta Was this translation helpful? Give feedback.
All reactions