Skip to content

Commit

Permalink
Merge pull request #17 from seflue/main
Browse files Browse the repository at this point in the history
feat: add tags to search
seflue authored May 24, 2024
2 parents ddc7bca + a20bd31 commit a847849
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions lua/telescope-orgmode/insert_link.lua
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ local utils = require('telescope-orgmode.utils')
---@field display function
---@field location string,
---@field line string,
---@field tags string,

local function insert(prompt_bufnr)
actions.close(prompt_bufnr)
9 changes: 7 additions & 2 deletions lua/telescope-orgmode/utils.lua
Original file line number Diff line number Diff line change
@@ -61,11 +61,13 @@ utils.make_entry = function(opts)
items = {
{ width = vim.F.if_nil(opts.location_width, 20) },
{ remaining = true },
--{ width = vim.F.if_nil(opts.tag_width, 20) },
},
})

---@param entry MatchEntry
local function make_display(entry)
return displayer({ entry.location, entry.line })
return displayer({ entry.location, entry.tags .. ' ' .. entry.line })
end

return function(entry)
@@ -74,21 +76,24 @@ utils.make_entry = function(opts)
local lnum = nil
local location = vim.fn.fnamemodify(entry.filename, ':t')
local line = ''
local tags = ''

if headline then
lnum = headline.position.start_line
location = string.format('%s:%i', location, lnum)
line = string.format('%s %s', string.rep('*', headline.level), headline.title)
tags = table.concat(headline.all_tags, ':')
end

return {
value = entry,
ordinal = location .. ' ' .. line,
ordinal = location .. ' ' .. tags .. ' ' .. line,
filename = entry.filename,
lnum = lnum,
display = make_display,
location = location,
line = line,
tags = tags,
}
end
end

0 comments on commit a847849

Please sign in to comment.