Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change mapping ge to gl #582

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 `ge` 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 `ge` 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 `ge` 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.

- `ge`: 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 'ge' 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 'ge' 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 'ge'
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-ge*
- 'ge': 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('ge', 'Markdown_EditUrlUnderCursor')
call <sid>MapNotHasmapto('gl', 'Markdown_EditUrlUnderCursor')
endif

command! -buffer -range=% HeaderDecrease call s:HeaderDecrease(<line1>, <line2>)
Expand Down
1 change: 0 additions & 1 deletion test/ge_test.md

This file was deleted.

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
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;
[ge_test.md](ge_test.md)
[gl_test.md](gl_test.md)

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

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

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

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

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

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

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

Expand Down