Skip to content

Commit

Permalink
Change mapping gy to gl
Browse files Browse the repository at this point in the history
  • Loading branch information
ernstwi committed Sep 19, 2022
1 parent 8a391b9 commit e7009f0
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Try `:help concealcursor` and `:help conceallevel` for details.

- `g:vim_markdown_follow_anchor`

This feature allows the `gy` command to follow named anchors in links of the form
This feature allows the `gl` command to follow named anchors in links of the form
`file#anchor` or just `#anchor`, where file may omit the `.md` extension as
usual. Two variables control its operation:

Expand Down Expand Up @@ -305,7 +305,7 @@ The following options control which syntax extensions will be turned on. They ar

- `g:vim_markdown_no_extensions_in_markdown`

If you want to have a link like this `[link text](link-url)` and follow it for editing in vim using the `gy` command, but have it open the file "link-url.md" instead of the file "link-url", then use this option:
If you want to have a link like this `[link text](link-url)` and follow it for editing in vim using the `gl` command, but have it open the file "link-url.md" instead of the file "link-url", then use this option:

let g:vim_markdown_no_extensions_in_markdown = 1

Expand All @@ -317,7 +317,7 @@ The following options control which syntax extensions will be turned on. They ar

- `g:vim_markdown_autowrite`

If you follow a link like this `[link text](link-url)` using the `gy` shortcut, this option will automatically save any edits you made before moving you:
If you follow a link like this `[link text](link-url)` using the `gl` shortcut, this option will automatically save any edits you made before moving you:

let g:vim_markdown_autowrite = 1

Expand Down Expand Up @@ -371,7 +371,7 @@ The following work on normal and visual modes:

Known limitation: does not work for links that span multiple lines.

- `gy`: open the link under the cursor in Vim for editing. Useful for relative markdown links. Falls back to `gf` with force editing, if not on a markdown link. `<Plug>Markdown_EditUrlUnderCursor`
- `gl`: open the link under the cursor in Vim for editing. Useful for relative markdown links. Falls back to `gf` with force editing, if not on a markdown link. `<Plug>Markdown_EditUrlUnderCursor`

The rules for the cursor position are the same as the `gx` command.

Expand Down
10 changes: 5 additions & 5 deletions doc/vim-markdown.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Follow named anchors ~
*g:vim_markdown_follow_anchor*
- 'g:vim_markdown_follow_anchor'

This feature allows the 'gy' command to follow named anchors in links of
This feature allows the 'gl' command to follow named anchors in links of
the form 'file#anchor' or just '#anchor', where file may omit the '.md'
extension as usual. Two variables control its operation:
>
Expand Down Expand Up @@ -420,7 +420,7 @@ Do not require .md extensions for Markdown links ~
- 'g:vim_markdown_no_extensions_in_markdown'

If you want to have a link like this '[link text](link-url)' and follow it
for editing in vim using the 'gy' command, but have it open the file "link-
for editing in vim using the 'gl' command, but have it open the file "link-
url.md" instead of the file "link-url", then use this option:
>
let g:vim_markdown_no_extensions_in_markdown = 1
Expand All @@ -438,7 +438,7 @@ Auto-write when following link ~
*g:vim_markdown_autowrite*
- 'g:vim_markdown_autowrite'

If you follow a link like this '[link text](link-url)' using the 'gy'
If you follow a link like this '[link text](link-url)' using the 'gl'
shortcut, this option will automatically save any edits you made before
moving you:
>
Expand Down Expand Up @@ -515,8 +515,8 @@ The following work on normal and visual modes:
<
Known limitation: does not work for links that span multiple lines.

*vim-markdown-gy*
- 'gy': open the link under the cursor in Vim for editing. Useful for
*vim-markdown-gl*
- 'gl': open the link under the cursor in Vim for editing. Useful for
relative markdown links. '<Plug>Markdown_EditUrlUnderCursor'

The rules for the cursor position are the same as the 'gx' command.
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ if !get(g:, 'vim_markdown_no_default_key_mappings', 0)
call <sid>MapNotHasmapto(']u', 'Markdown_MoveToParentHeader')
call <sid>MapNotHasmapto(']h', 'Markdown_MoveToCurHeader')
call <sid>MapNotHasmapto('gx', 'Markdown_OpenUrlUnderCursor')
call <sid>MapNotHasmapto('gy', 'Markdown_EditUrlUnderCursor')
call <sid>MapNotHasmapto('gl', 'Markdown_EditUrlUnderCursor')
endif

command! -buffer -range=% HeaderDecrease call s:HeaderDecrease(<line1>, <line2>)
Expand Down
1 change: 1 addition & 0 deletions test/gl_test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gl test
1 change: 0 additions & 1 deletion test/gy_test.md

This file was deleted.

36 changes: 18 additions & 18 deletions test/map.vader
Original file line number Diff line number Diff line change
Expand Up @@ -51,41 +51,41 @@ Execute (gx autolink):
AssertEqual b:func(1, match(b:line, 'd') + 1), ''

Given markdown;
[gy_test.md](gy_test.md)
[gl_test.md](gl_test.md)

Execute (gy opens file):
normal gy
AssertEqual @%, 'gy_test.md'
AssertEqual getline(1), 'gy test'
Execute (gl opens file):
normal gl
AssertEqual @%, 'gl_test.md'
AssertEqual getline(1), 'gl test'

Given markdown;
[gy_test](gy_test)
[gl_test](gl_test)

Execute (gy opens file without .md extensions):
Execute (gl opens file without .md extensions):
let g:vim_markdown_no_extensions_in_markdown = 1
normal gy
AssertEqual @%, 'gy_test.md'
AssertEqual getline(1), 'gy test'
normal gl
AssertEqual @%, 'gl_test.md'
AssertEqual getline(1), 'gl test'
unlet g:vim_markdown_no_extensions_in_markdown

Given markdown;
[gy_test.md](gy_test.md)
[gl_test.md](gl_test.md)

Execute (gy does not write before opening file):
Execute (gl does not write before opening file):
normal ia
normal l
normal gy
AssertEqual @%, 'gy_test.md'
AssertEqual getline(1), 'gy test'
normal gl
AssertEqual @%, 'gl_test.md'
AssertEqual getline(1), 'gl test'

Given markdown;
[gy_test.md](gy_test.md)
[gl_test.md](gl_test.md)

Execute (gy auto-write before opening file):
Execute (gl auto-write before opening file):
let g:vim_markdown_autowrite = 1
normal ia
normal l
AssertThrows normal gy
AssertThrows normal gl
AssertEqual g:vader_exception, 'Vim(write):E382: Cannot write, ''buftype'' option is set'
unlet g:vim_markdown_autowrite

Expand Down

0 comments on commit e7009f0

Please sign in to comment.