aboutsummaryrefslogtreecommitdiff
path: root/lua/cmake-explorer/telescope/previewers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/cmake-explorer/telescope/previewers.lua')
-rw-r--r--lua/cmake-explorer/telescope/previewers.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/lua/cmake-explorer/telescope/previewers.lua b/lua/cmake-explorer/telescope/previewers.lua
new file mode 100644
index 0000000..39fea4a
--- /dev/null
+++ b/lua/cmake-explorer/telescope/previewers.lua
@@ -0,0 +1,40 @@
+local previewers = require("telescope.previewers")
+local config = require("cmake-explorer.config")
+
+local M = {}
+
+M.configure_previewer = function(opts)
+ return previewers.new_buffer_previewer({
+ title = "Configure Details",
+
+ define_preview = function(self, entry)
+ if self.state.bufname then
+ return
+ end
+ local entries = {
+ "Command:",
+ config.cmake_path .. " " .. table.concat(entry.value.configure_args, " "),
+ }
+ vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, entries)
+ end,
+ })
+end
+
+M.build_previewer = function(opts)
+ return previewers.new_buffer_previewer({
+ title = "Build Details",
+
+ define_preview = function(self, entry)
+ if self.state.bufname then
+ return
+ end
+ local entries = {
+ "Command:",
+ config.cmake_path .. " " .. table.concat(entry.value.build_args, " "),
+ }
+ vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, entries)
+ end,
+ })
+end
+
+return M