Skip to content

Commit

Permalink
Insert link after cursor (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgollenz authored Jul 25, 2023
1 parent 2b75a32 commit 6b6eb8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions lua/orgmode/objects/help.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ local helps = {
{ key = 'org_forward_heading_same_level', description = 'Go to next heading on same level' },
{ key = 'org_backward_heading_same_level', description = 'Go to previous heading on same level' },
{ key = 'outline_up_heading', description = 'Go to parent heading' },
{ key = 'org_insert_link', description = 'Insert a hyperlink' },
{ key = 'org_deadline', description = 'Insert/Update deadline date' },
{ key = 'org_schedule', description = 'Insert/Update scheduled date' },
{ key = 'org_time_stamp', description = 'Insert date under cursor' },
Expand Down
6 changes: 3 additions & 3 deletions lua/orgmode/org/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ function OrgMappings:_insert_heading_from_plain_line(suffix)
end
end

-- Inserts a new link at the cursor position or modifies the link the cursor is
-- Inserts a new link after the cursor position or modifies the link the cursor is
-- currently on
function OrgMappings:insert_link()
local link_location = vim.fn.OrgmodeInput('Links: ', '')
Expand All @@ -734,8 +734,8 @@ function OrgMappings:insert_link()
target_col = target_col + link.from
else
local colnr = vim.fn.col('.')
insert_from = colnr - 1
insert_to = colnr
insert_from = colnr
insert_to = colnr + 1
target_col = target_col + colnr
end

Expand Down

0 comments on commit 6b6eb8e

Please sign in to comment.