Skip to content

Commit

Permalink
Merge pull request #9 from neo451/dev
Browse files Browse the repository at this point in the history
feat: telescope integration with highlighted buffer and line wrap
  • Loading branch information
neo451 authored Oct 6, 2024
2 parents 59b8f0b + 87afce3 commit 8583603
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 197 deletions.
20 changes: 10 additions & 10 deletions lua/telescope/_extensions/feed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local conf = require("telescope.config").values
local actions = require "telescope.actions"
local action_state = require "telescope.actions.state"
local previewers = require "telescope.previewers"
local highlighter = require("telescope.previewers.utils").highlighter

local config = require "feed.config"
local db = require("feed.db").db(config.db_dir)
Expand All @@ -25,38 +26,37 @@ local function feed(opts)
pickers
.new(opts, {
prompt_title = "Feeds",

previewer = previewers.new_buffer_previewer {
--- TODO: attach highlighter! format content on disk to markdown
define_preview = function(self, entry, _)
local db_entry = db:address(db.index[entry.index])
conf.buffer_previewer_maker(db_entry, self.state.bufnr, {
bufname = self.state.bufname,
winid = self.state.winid,
preview = opts.preview,
file_encoding = opts.file_encoding,
})
highlighter(self.state.bufnr, "markdown")
vim.api.nvim_set_option_value("wrap", true, { win = self.state.winid })
end,
},
finder = finders.new_table {
results = lines,
},
attach_mappings = function(prompt_bufnr, map)
attach_mappings = function(prompt_bufnr)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
local entry = db.index[selection.index]
render.show(format.entry(entry, db:get(entry)), render.buf.entry[2], ut.highlight_entry)
if not render.buf then
render.prepare_bufs(require("feed.commands").cmds)
end
render.show_entry(selection.index)
end)
return true
end,
sorter = conf.generic_sorter(opts), -- TODO: sort by date?
sorter = conf.generic_sorter(opts),
})
:find()
end

return telescope.register_extension {
setup = function(ext_config, usr_config) end,
-- health = lp_health,
exports = {
feed = feed,
},
Expand Down
60 changes: 0 additions & 60 deletions spec/conv_spec.lua

This file was deleted.

10 changes: 0 additions & 10 deletions spec/date_spec.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
-- local tests = {
-- { "@5-days-ago--3-days-ago", 5, 3 },
-- { "@3-days-ago--5-days-ago", 5, 3 },
-- { "@2019-06-01", 23 },
-- { "@2019-06-20--2019-06-01", 23, 4 },
-- { "@2019-06-01--2019-06-20", 23, 4 },
-- { "@2019-06-01--4-days-ago", 23, 4 },
-- { "@4-days-ago--2019-06-01", 23, 4 },
-- }

local M = require "feed.date"

describe("new_from", function()
Expand Down
117 changes: 0 additions & 117 deletions spec/treedoc_spec.lua

This file was deleted.

0 comments on commit 8583603

Please sign in to comment.