Skip to content

Commit

Permalink
add g:mkdp_echo_preview_url to display url when open preview page
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcco committed Jan 14, 2019
1 parent 3785090 commit f0ecb8f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ let g:mkdp_open_to_the_world = 0
" default: ''
let g:mkdp_browser = ''
" set to 1, echo preview page url in command line when open preview page
" default is 0
let g:mkdp_echo_preview_url = 0
" options for markdown render
" mkit: markdown-it options for render
" katex: katex options for math
Expand Down Expand Up @@ -99,6 +103,12 @@ command:
:MarkdownPreviewStop
```

### F&Q

A: Why my sync scroll is slow reaction

B: set `updatetime` to a small number, like `set updatetime=100`

### reference

- [coc.nvim](https://github.com/neoclide/coc.nvim)
Expand Down
4 changes: 4 additions & 0 deletions app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ async function startServer () {
} else {
opener(url)
}
const isEchoUrl = await plugin.nvim.getVar('mkdp_echo_preview_url')
if (isEchoUrl) {
plugin.nvim.call('mkdp#util#echo_url', [url])
}
}
plugin.init({
refreshPage,
Expand Down
6 changes: 6 additions & 0 deletions autoload/mkdp/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ function! mkdp#util#echo_messages(hl, msgs)
echohl None
endfunction

" echo url
function! mkdp#util#echo_url(url)
let l:url = 'Preview page: ' . a:url
call mkdp#util#echo_messages('Type', l:url)
endfunction

" try open preview page
function! s:try_open_preview_page(timer_id) abort
let l:server_status = mkdp#rpc#get_server_status()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "markdown-preview.vim",
"version": "0.0.5",
"version": "0.0.6",
"description": "markdown preview plugin for (neo)vim",
"bin": "./app/server.js",
"repository": "https://github.com/iamcco/markdown-preview.vim.git",
Expand Down
6 changes: 6 additions & 0 deletions plugin/mkdp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ if !exists('g:mkdp_open_to_the_world')
let g:mkdp_open_to_the_world = 0
endif

" set to 1, echo preview page url in command line when open preview page
" default is 0
if !exists('g:mkdp_echo_preview_url')
let g:mkdp_echo_preview_url = 0
endif

" switch browser to open preview page
if !exists('g:mkdp_browser')
let g:mkdp_browser = ''
Expand Down

0 comments on commit f0ecb8f

Please sign in to comment.