Skip to content

Commit 6b6eb8e

Browse files
authored
Insert link after cursor (#592)
1 parent 2b75a32 commit 6b6eb8e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lua/orgmode/objects/help.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ local helps = {
4444
{ key = 'org_forward_heading_same_level', description = 'Go to next heading on same level' },
4545
{ key = 'org_backward_heading_same_level', description = 'Go to previous heading on same level' },
4646
{ key = 'outline_up_heading', description = 'Go to parent heading' },
47+
{ key = 'org_insert_link', description = 'Insert a hyperlink' },
4748
{ key = 'org_deadline', description = 'Insert/Update deadline date' },
4849
{ key = 'org_schedule', description = 'Insert/Update scheduled date' },
4950
{ key = 'org_time_stamp', description = 'Insert date under cursor' },

lua/orgmode/org/mappings.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ function OrgMappings:_insert_heading_from_plain_line(suffix)
707707
end
708708
end
709709

710-
-- Inserts a new link at the cursor position or modifies the link the cursor is
710+
-- Inserts a new link after the cursor position or modifies the link the cursor is
711711
-- currently on
712712
function OrgMappings:insert_link()
713713
local link_location = vim.fn.OrgmodeInput('Links: ', '')
@@ -734,8 +734,8 @@ function OrgMappings:insert_link()
734734
target_col = target_col + link.from
735735
else
736736
local colnr = vim.fn.col('.')
737-
insert_from = colnr - 1
738-
insert_to = colnr
737+
insert_from = colnr
738+
insert_to = colnr + 1
739739
target_col = target_col + colnr
740740
end
741741

0 commit comments

Comments
 (0)