Ⅰ. 插件描述
A vim-plugin that tells Deckset to update it's preview windowⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'bwmcadams/vim-deckset-are-made-of'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'bwmcadams/vim-deckset-are-made-of'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'bwmcadams/vim-deckset-are-made-of'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/bwmcadams/vim-deckset
Ⅳ. 文档说明
# vim-deckset
Originally based upon omega/vim-deckset but mostly rewritten
Contents:
About
Deckset is an OS X application for rendering markdown
as presentation.
It has a nifty floating preview window that shows up in edit mode, and by default
updates the view when the markdown file is saved. By default it makes a best guess
as to what the last modified section is, and tries to update the preview to that
slide.
It turns out however, that Deckset's preview window can be scripted using AppleScript and JavaScript Automation.
For us Vim users, we can do a bit better than
the default behavior. This Vim plugin will, under the right
circumstances, update the contents of the preview window
as you move your VIM cursor around in the Markdown file.
Installation
Best way is to use Pathogen, and simply checkout this git repo under your Pathogen bundle directory (typically ~/.vim/bundle). If you've set Pathogen up properly it will automatically load at Vim boot.
Otherwise, by hand:
- Copy
vim-deckset/after/ftplugin/deckset.vimto~/.vim/after/ftplugin/deckset.vim - Copy
vim-deckset/after/ftdetect/deckset.vimto~/.vim/after/ftdetect/deckset.vim - Copy
vim-deckset/syntax/deckset.vimto~/.vim/syntax/deckset.vim
Implementation Notes
In order to avoid conflicting with your existing Markdown plugins & syntax
detectors when you are not running Deckset, the plugin takes a few extra
safety steps.
- It checks both if Deckset is running, and the file you're editing is _open inside of Deckset_.
- If these conditions are met, your Vim filetype is set to ‘deckset’.
Apart from the syntax highlighting files, this plugin should be run out of the
.vim/afterfolders, so that it makes sure to pick up and set the ‘deckset’ filetype without it later being overridden by other Markdown detectors (assuming those aren't also loaded inafter).In addition, there's an enhanced Vim syntax file based on
tpope/vim-markdown, which attempts
to specifically support all of the Deckset Markdown, including LaTeX
recognition inside formula blocks (If you have the optional Formula plugin
for Deckset).
Brilliantly, Tim Pop's Markdown code supports replacing the code inside of
fenced code blocks with proper Syntax highlighting (it seems the sub-highlighting only shows up on some colorschemes). This works only for languages set in the global
setting (placed in your ~/.vimrc) g:markdown_fenced_languages. To add
support for Scala code highlighting, add the following:
let g:markdown_fenced_languages = ["scala"]It is an array, so you can add many languages. I've preserved the same
variable name as Tim Pope's Markdown as there's no conflict, so you only need
one global setting for both Tim Pope's markdown and deckset-markdown.
Additonally, as long as you have a tex syntax highlighting plugin in your
Vim setup, Deckset formulas will syntax highlight similarly-you do not need to
add tex to the g:markdown_fenced_languages setting.
I've seen issues with terminal based Vim acting odd & glitchy when the plugin is activated. As a result, by default I have the plugin set to only execute only when the GUI mode (aka MacVim) is running. If you'd like to change it you can set the following in your .vimrc file:
let g:DecksetRequireGUI = 0In order to not totally overload your Vim session by running everytime you
move through the file, vim-deckset updates the preview window on the following conditions:
CursorHold– In Command mode, if the Cursor hasn't moved ing:DecksetPreviewPauseTimemillisecondsCursorHoldI- In Insert mode, if the Cursor hasn't moved ing:DecksetPreviewPauseTimemillisecondsBufRead- The file is read from disk (such as when we first open)BufWrite- When the file is savedFocusGained- The Vim window is brought to the foregroundInsertLeave- Insert mode is exited
The default for g:DecksetPreviewPauseTime is 500 milliseconds. You can
change that by setting a new value (in milliseconds) in your.vimrc:
let g:DecksetPreviewPauseTime = 750Additionally, vim-deckset is set to automatically save the file if any of the
above conditions trigger & the file buffer is modified. If you'd like to
disable that behavior, you can turn it off in your .vimrc:
let g:DecksetAutosave = 0Finally, if you'd like to force an update to the Deckset Preview window, you
can either run:
:call UpdateDecksetPreview()Or, if <leader> is set, <leader>R.