vim-mdlink
Vim plugin to convert URL to Markdown style with title.
Install
Checkout into your plugin directory. Or use plugin manager.
Requirements
- Vim 8.0+ (with +channel +job)
- Go
- kana/vim-textobj-user
- mattn/vim-textobj-url
Settings
-
Create $HOME/.vim-mdlink file like the following. And input your github personal token.
let g:vim_mdlink = { \ 'github_token': 'your personal token' \}
-
If using GHE, add optional settings about GHE.
let g:vim_mdlink = { \ 'github_token': 'your personal token', \ 'ghe_url': 'https://ghe.domain.name/', \ 'ghe_api_url': 'https://ghe.domain.name/api/v3/repos/', \ 'ghe_token': 'your personal token' \}
Usage
MarkdownLink
- Put the cursor on the row existing URL. Or select multi rows by visual mode.
- Enter command
:MarkdownLink
.
MarkdownLinkOnlyOnCursor
- Put the cursor on the URL.
- Enter command
:MarkdownLinkOnlyOnCursor
.
Convert all URL
- Enter command
:%Markdownlink
.
Map example
nnoremap <silent> ml :MarkdownLink<CR>
vnoremap <silent> ml :MarkdownLink<CR>
nnoremap <silent> mo :MarkdownLinkOnlyOnCursor<CR>
License
MIT