Skip to content

Commit 585190e

Browse files
fix(refile): allow slash to be omitted when refiling to file
1 parent 1c9c1ff commit 585190e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: lua/orgmode/capture/init.lua

+5-1
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,13 @@ function Capture:get_destination()
393393
return false
394394
end
395395

396-
local path = destination:match('^.*%.org/')
396+
local path = destination:match('^.*%.org/?')
397397
local headline_title = path and destination:sub(#path + 1) or ''
398398

399+
if not vim.endswith(path, '/') then
400+
path = path .. '/'
401+
end
402+
399403
if not valid_destinations[path] then
400404
utils.echo_error(
401405
('"%s" is not a is not a file specified in the "org_agenda_files" setting. Refiling cancelled.'):format(path)

0 commit comments

Comments
 (0)