Skip to content

Commit a847849

Browse files
authored
Merge pull request #17 from seflue/main
feat: add tags to search
2 parents ddc7bca + a20bd31 commit a847849

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lua/telescope-orgmode/insert_link.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ local utils = require('telescope-orgmode.utils')
1818
---@field display function
1919
---@field location string,
2020
---@field line string,
21+
---@field tags string,
2122

2223
local function insert(prompt_bufnr)
2324
actions.close(prompt_bufnr)

lua/telescope-orgmode/utils.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ utils.make_entry = function(opts)
6161
items = {
6262
{ width = vim.F.if_nil(opts.location_width, 20) },
6363
{ remaining = true },
64+
--{ width = vim.F.if_nil(opts.tag_width, 20) },
6465
},
6566
})
6667

68+
---@param entry MatchEntry
6769
local function make_display(entry)
68-
return displayer({ entry.location, entry.line })
70+
return displayer({ entry.location, entry.tags .. ' ' .. entry.line })
6971
end
7072

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

7881
if headline then
7982
lnum = headline.position.start_line
8083
location = string.format('%s:%i', location, lnum)
8184
line = string.format('%s %s', string.rep('*', headline.level), headline.title)
85+
tags = table.concat(headline.all_tags, ':')
8286
end
8387

8488
return {
8589
value = entry,
86-
ordinal = location .. ' ' .. line,
90+
ordinal = location .. ' ' .. tags .. ' ' .. line,
8791
filename = entry.filename,
8892
lnum = lnum,
8993
display = make_display,
9094
location = location,
9195
line = line,
96+
tags = tags,
9297
}
9398
end
9499
end

0 commit comments

Comments
 (0)