1
0
mirror of https://github.com/amix/vimrc synced 2025-02-28 14:12:51 +08:00

add Previm and window management

This commit is contained in:
Max Alcala 2016-02-23 14:35:43 -06:00
parent f3143286d3
commit 14bf4d01c6
45 changed files with 3967 additions and 77 deletions

View File

@ -2,7 +2,6 @@
:set number
" :set colorcolumn=80
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Copying/Pasting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -12,3 +11,11 @@
set clipboard=unnamed
let g:syntastic_javascript_args = "-c ./.eslintrc"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Window management
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" close and open windows quickly
map <leader>wc <C-W>c
map <leader>wn <C-W>n

4
sources_non_forked/previm/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
preview/css/previm.css
preview/css/user_custom.css
preview/js/previm-function.js
doc/tags*

View File

@ -0,0 +1,11 @@
language: generic
before_script:
- git clone https://github.com/thinca/vim-themis --quiet --branch v1.4.1 --single-branch --depth 1 /tmp/vim-themis
script:
- vim --version
- /tmp/vim-themis/bin/themis test/ -r --reporter dot
notifications:
email: false

View File

@ -0,0 +1,56 @@
Using open source codes' LICENSES
* marked.min.js
[preview/js/lib/marked.min.js](https://github.com/kannokanno/previm/blob/master/preview/js/lib/marked.min.js)
Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
* highlight.pack.js
[preview/js/lib/highlight.pack.js](https://github.com/kannokanno/previm/blob/master/preview/js/lib/highlight.pack.js)
* github.css
[preview/css/lib/github.css](https://github.com/kannokanno/previm/blob/master/preview/css/lib/github.css)
Copyright (c) 2006, Ivan Sagalaev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of highlight.js nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,67 @@
## Previm
Vim plugin for preview.
###ScreenShot
![previm](https://raw.github.com/wiki/kannokanno/previm/images/previm-example.gif)
## Supported file formats
* Markdown
* support [mermaid](http://knsv.github.io/mermaid/index.html)
* reStructuredText(required rst2html.py)
* textile
## Dependencies
### For conversion
There is nothing essential in the case of textile and Markdown.
`rst2html.py` is required in the case of reStructuredText.
It will become available `rst2html.py` command when you install the `docutils.`
% pip install docutils
% rst2html.py --version
rst2html.py (Docutils 0.12 [release], Python 2.7.5, on darwin)
### For open preview
No need for extra libraries or plug-ins.
It can, however, be integrated with [open-browser.vim](https://github.com/tyru/open-browser.vim). For detailed usages, please see below.
## Usage
1. Define `g:previm_open_cmd` in .vimrc
* This command is used in terminal for opening your browser.
* For example, uses Safari on Mac `let g:previm_open_cmd = 'open -a Safari'`
* `:help g:previm_open_cmd` for more details
* You can skip this setting if you're using open-browser.
2. Start editing the file of Markdown.(`filetype` is `markdown`)
* __NOTE__: In the case of `.md`, `filetype` becomes a `modula2`. If so, please describe in `.vimrc` this setting
```vim
augroup PrevimSettings
autocmd!
autocmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown
augroup END
```
3. Run `:PrevimOpen` to open browser to preview
4. Back to Vim to edit your file
5. Update the file, and the content for previewing will be updated automatically
### mermaid
Support [mermaid](http://knsv.github.io/mermaid/index.html)
<pre>
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->E;
```
</pre>
![previm](https://raw.github.com/wiki/kannokanno/previm/images/previm-example-mermaid.png)

View File

@ -0,0 +1,67 @@
[README in English](https://github.com/kannokanno/previm/blob/master/README-en.mkd)
## Previm
プレビュー用のVimプラグインです。
![previm](https://raw.github.com/wiki/kannokanno/previm/images/previm-example.gif)
## 対応フォーマット
* Markdown
* support [mermaid](http://knsv.github.io/mermaid/index.html)
* reStructuredText
* textile
## 依存
### 変換のため
Markdownとtextileの場合は必須なものはありません。
reStructuredTextの場合は`rst2html.py`が必要です。
`docutils`をインストールすると`rst2html.py`コマンドが使えるようになります。
% pip install docutils
% rst2html.py --version
rst2html.py (Docutils 0.12 [release], Python 2.7.5, on darwin)
### プレビューを開くため
必須なものはありません。
[open-browser.vim](https://github.com/tyru/open-browser.vim)は任意で使用できます。
## 使い方(Markdownの場合)
1. .vimrc にて `g:previm_open_cmd` を定義します
* この値はコマンドラインから実行できるコマンドです
* たとえばMacなら `open -a Safari` などです
* `:help g:previm_open_cmd` を参照してください
* open-browserを使う場合は設定不要です
1. `filetype` がMarkdownのファイルの編集を開始します
* 注意:拡張子が`.md`の場合は`markdown`ではなく`modula2`として認識されてしまいます。その場合は以下の設定を.vimrcに記述してください
```vim
augroup PrevimSettings
autocmd!
autocmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown
augroup END
```
1. `:PrevimOpen` を実行してブラウザを開きます
1. 元のVimバッファに戻り編集を続けます
1. 変更の度にブラウザの表示内容が更新されます
### mermaid
[mermaid](http://knsv.github.io/mermaid/index.html)に対応しています。
<pre>
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->E;
```
</pre>
![previm](https://raw.github.com/wiki/kannokanno/previm/images/previm-example-mermaid.png)

View File

@ -0,0 +1,240 @@
" AUTHOR: kanno <akapanna@gmail.com>
" License: This file is placed in the public domain.
let s:save_cpo = &cpo
set cpo&vim
let s:V = vital#of('previm')
let s:File = s:V.import('System.File')
let s:newline_character = "\n"
function! previm#open(preview_html_file)
call previm#refresh()
if exists('g:previm_open_cmd') && !empty(g:previm_open_cmd)
call s:system(g:previm_open_cmd . ' ''' . a:preview_html_file . '''')
elseif s:exists_openbrowser()
" fix temporary(the cause unknown)
call s:apply_openbrowser('file:///' . a:preview_html_file)
else
call s:echo_err('Command for the open can not be found. show detail :h previm#open')
endif
endfunction
function! s:exists_openbrowser()
try
call openbrowser#load()
return 1
catch /E117.*/
return 0
endtry
endfunction
function! s:apply_openbrowser(path)
let saved_in_vim = g:openbrowser_open_filepath_in_vim
try
let g:openbrowser_open_filepath_in_vim = 0
call openbrowser#open(a:path)
finally
let g:openbrowser_open_filepath_in_vim = saved_in_vim
endtry
endfunction
function! previm#refresh()
call previm#refresh_css()
call previm#refresh_js()
endfunction
function! previm#refresh_css()
let css = []
if get(g:, 'previm_disable_default_css', 0) !=# 1
call extend(css, ["@import url('origin.css');", "@import url('lib/github.css');"])
endif
if exists('g:previm_custom_css_path')
let css_path = expand(g:previm_custom_css_path)
if filereadable(css_path)
call s:File.copy(css_path, previm#make_preview_file_path('css/user_custom.css'))
call add(css, "@import url('user_custom.css');")
else
call s:echo_err('[Previm]failed load custom css. ' . css_path)
endif
endif
call writefile(css, previm#make_preview_file_path('css/previm.css'))
endfunction
" TODO: test(refresh_cssと同じように)
function! previm#refresh_js()
let encoded_lines = split(iconv(s:function_template(), &encoding, 'utf-8'), s:newline_character)
call writefile(encoded_lines, previm#make_preview_file_path('js/previm-function.js'))
endfunction
let s:base_dir = expand('<sfile>:p:h')
function! previm#make_preview_file_path(path)
return s:base_dir . '/../preview/' . a:path
endfunction
" NOTE: getFileType()の必要性について。
" js側でファイル名の拡張子から取得すればこの関数は不要だが、
" その場合「.txtだが内部的なファイルタイプがmarkdown」といった場合に動かなくなる。
" そのためVim側できちんとファイルタイプを返すようにしている。
function! s:function_template()
let current_file = expand('%:p')
return join([
\ 'function isShowHeader() {',
\ printf('return %s;', get(g:, 'previm_show_header', 1)),
\ '}',
\ '',
\ 'function getFileName() {',
\ printf('return "%s";', s:escape_backslash(current_file)),
\ '}',
\ '',
\ 'function getFileType() {',
\ printf('return "%s";', &filetype),
\ '}',
\ '',
\ 'function getLastModified() {',
\ printf('return "%s";', s:get_last_modified_time()),
\ '}',
\ '',
\ 'function getContent() {',
\ printf('return "%s";', previm#convert_to_content(getline(1, '$'))),
\ '}',
\], s:newline_character)
endfunction
function! s:get_last_modified_time()
if exists('*strftime')
return strftime("%Y/%m/%d (%a) %H:%M:%S")
endif
return '(strftime cannot be performed.)'
endfunction
function! s:escape_backslash(text)
return escape(a:text, '\')
endfunction
function! s:system(cmd)
if get(g:, 'previm_disable_vimproc', 0)
return system(a:cmd)
endif
try
" NOTE: WindowsでDOS窓を開かず実行してくれるらしいのでvimprocを使う
let result = vimproc#system(a:cmd)
return result
catch /E117.*/
return system(a:cmd)
endtry
endfunction
function! s:do_external_parse(lines)
if &filetype !=# "rst"
return a:lines
endif
" NOTE: 本来は外部コマンドに頼りたくない
" いずれjsパーサーが出てきたときに移行するが、
" その時に混乱を招かないように設定でrst2htmlへのパスを持つことはしない
let cmd = ''
if executable("rst2html.py") ==# 1
let cmd = "rst2html.py"
elseif executable("rst2html") ==# 1
let cmd = "rst2html"
endif
if empty(cmd)
call s:echo_err("rst2html.py or rst2html has not been installed, you can not run")
return a:lines
endif
let temp = tempname()
call writefile(a:lines, temp)
return split(s:system(cmd . ' ' . s:escape_backslash(temp)), "\n")
endfunction
function! previm#convert_to_content(lines)
let mkd_dir = s:escape_backslash(expand('%:p:h'))
if has("win32unix")
" convert cygwin path to windows path
let mkd_dir = s:escape_backslash(substitute(system('cygpath -wa ' . mkd_dir), "\n$", '', ''))
endif
let converted_lines = []
for line in s:do_external_parse(a:lines)
" TODO エスケープの理由と順番の依存度が複雑
let escaped = substitute(line, '\', '\\\\', 'g')
let escaped = previm#relative_to_absolute_imgpath(escaped, mkd_dir)
let escaped = substitute(escaped, '"', '\\"', 'g')
call add(converted_lines, escaped)
endfor
return join(converted_lines, "\\n")
endfunction
" convert example
" if unix:
" ![alt](file://localhost/Users/kanno/Pictures/img.png "title")
" if win:
" ![alt](file://localhost/C:\Documents%20and%20Settings\folder/pictures\img.png "title")
function! previm#relative_to_absolute_imgpath(text, mkd_dir)
let elem = previm#fetch_imgpath_elements(a:text)
if empty(elem.path)
return a:text
endif
for protocol in ['http://', 'https://', 'file://']
if s:start_with(elem.path, protocol)
" is absolute path
return a:text
endif
endfor
" escape backslash for substitute (see pull/#34)
let dir = substitute(a:mkd_dir, '\\', '\\\\', 'g')
let elem.path = substitute(elem.path, '\\', '\\\\', 'g')
" マルチバイトの解釈はブラウザに任せるのでURLエンコードしない
" 半角空白だけはエラーの原因になるのでURLエンコード対象とする
let pre_slash = s:start_with(dir, '/') ? '' : '/'
let local_path = substitute(dir.'/'.elem.path, ' ', '%20', 'g')
let prev_imgpath = ''
let new_imgpath = ''
if empty(elem.title)
let prev_imgpath = printf('!\[%s\](%s)', elem.alt, elem.path)
let new_imgpath = printf('![%s](file://localhost%s%s)', elem.alt, pre_slash, local_path)
else
let prev_imgpath = printf('!\[%s\](%s "%s")', elem.alt, elem.path, elem.title)
let new_imgpath = printf('![%s](file://localhost%s%s "%s")', elem.alt, pre_slash, local_path, elem.title)
endif
" unify quote
let text = substitute(a:text, "'", '"', 'g')
return substitute(text, prev_imgpath, new_imgpath, '')
endfunction
function! previm#fetch_imgpath_elements(text)
let elem = {'alt': '', 'path': '', 'title': ''}
let matched = matchlist(a:text, '!\[\(.*\)\](\(.*\))')
if empty(matched)
return elem
endif
let elem.alt = matched[1]
return extend(elem, s:fetch_path_and_title(matched[2]))
endfunction
function! s:fetch_path_and_title(path)
let matched = matchlist(a:path, '\(.*\)\s\+["'']\(.*\)["'']')
if empty(matched)
return {'path': a:path}
endif
let trimmed_path = matchstr(matched[1],'^\s*\zs.\{-}\ze\s*$')
return {'path': trimmed_path, 'title': matched[2]}
endfunction
function! s:start_with(haystock, needle)
return stridx(a:haystock, a:needle) ==# 0
endfunction
function! s:echo_err(msg)
echohl WarningMsg
echomsg a:msg
echohl None
endfunction
let &cpo = s:save_cpo
unlet! s:save_cpo

View File

@ -0,0 +1,12 @@
function! vital#of(name)
let files = globpath(&runtimepath, 'autoload/vital/' . a:name . '.vital')
let file = split(files, "\n")
if empty(file)
throw 'vital: version file not found: ' . a:name
endif
let ver = readfile(file[0], 'b')
if empty(ver)
throw 'vital: invalid version file: ' . a:name
endif
return vital#_{substitute(ver[0], '\W', '', 'g')}#new()
endfunction

View File

@ -0,0 +1,304 @@
let s:self_version = expand('<sfile>:t:r')
" Note: The extra argument to globpath() was added in Patch 7.2.051.
let s:globpath_third_arg = v:version > 702 || v:version == 702 && has('patch51')
let s:loaded = {}
function! s:import(name, ...)
let target = {}
let functions = []
for a in a:000
if type(a) == type({})
let target = a
elseif type(a) == type([])
let functions = a
endif
unlet a
endfor
let module = s:_import(a:name)
if empty(functions)
call extend(target, module, 'keep')
else
for f in functions
if has_key(module, f) && !has_key(target, f)
let target[f] = module[f]
endif
endfor
endif
return target
endfunction
function! s:load(...) dict
for arg in a:000
let [name; as] = type(arg) == type([]) ? arg[: 1] : [arg, arg]
let target = split(join(as, ''), '\W\+')
let dict = self
while 1 <= len(target)
let ns = remove(target, 0)
if !has_key(dict, ns)
let dict[ns] = {}
endif
if type(dict[ns]) == type({})
let dict = dict[ns]
else
unlet dict
break
endif
endwhile
if exists('dict')
call extend(dict, s:_import(name))
endif
unlet arg
endfor
return self
endfunction
function! s:unload()
let s:loaded = {}
endfunction
function! s:exists(name)
return s:_get_module_path(a:name) !=# ''
endfunction
function! s:search(pattern)
let paths = s:_vital_files(a:pattern)
let modules = sort(map(paths, 's:_file2module(v:val)'))
return s:_uniq(modules)
endfunction
function! s:expand_modules(entry, all)
if type(a:entry) == type([])
let candidates = s:_concat(map(copy(a:entry), 's:search(v:val)'))
if empty(candidates)
throw printf('vital: Any of module %s is not found', string(a:entry))
endif
if eval(join(map(copy(candidates), 'has_key(a:all, v:val)'), '+'))
let modules = []
else
let modules = [candidates[0]]
endif
else
let modules = s:search(a:entry)
if empty(modules)
throw printf('vital: Module %s is not found', a:entry)
endif
endif
call filter(modules, '!has_key(a:all, v:val)')
for module in modules
let a:all[module] = 1
endfor
return modules
endfunction
function! s:_import(name)
if type(a:name) == type(0)
return s:_build_module(a:name)
endif
let path = s:_get_module_path(a:name)
if path ==# ''
throw 'vital: module not found: ' . a:name
endif
let sid = s:_get_sid_by_script(path)
if !sid
try
execute 'source' fnameescape(path)
catch /^Vim\%((\a\+)\)\?:E484/
throw 'vital: module not found: ' . a:name
catch /^Vim\%((\a\+)\)\?:E127/
" Ignore.
endtry
let sid = s:_get_sid_by_script(path)
endif
return s:_build_module(sid)
endfunction
function! s:_get_module_path(name)
if s:_is_absolute_path(a:name) && filereadable(a:name)
return a:name
endif
if a:name ==# ''
let paths = [s:self_file]
elseif a:name =~# '\v^\u\w*%(\.\u\w*)*$'
let paths = s:_vital_files(a:name)
else
throw 'vital: Invalid module name: ' . a:name
endif
call filter(paths, 'filereadable(expand(v:val, 1))')
let path = get(paths, 0, '')
return path !=# '' ? path : ''
endfunction
function! s:_get_sid_by_script(path)
let path = s:_unify_path(a:path)
for line in filter(split(s:_redir('scriptnames'), "\n"),
\ 'stridx(v:val, s:self_version) > 0')
let list = matchlist(line, '^\s*\(\d\+\):\s\+\(.\+\)\s*$')
if !empty(list) && s:_unify_path(list[2]) ==# path
return list[1] - 0
endif
endfor
return 0
endfunction
function! s:_file2module(file)
let filename = fnamemodify(a:file, ':p:gs?[\\/]\+?/?')
let tail = matchstr(filename, 'autoload/vital/_\w\+/\zs.*\ze\.vim$')
return join(split(tail, '[\\/]\+'), '.')
endfunction
if filereadable(expand('<sfile>:r') . '.VIM')
" resolve() is slow, so we cache results.
let s:_unify_path_cache = {}
" Note: On windows, vim can't expand path names from 8.3 formats.
" So if getting full path via <sfile> and $HOME was set as 8.3 format,
" vital load duplicated scripts. Below's :~ avoid this issue.
function! s:_unify_path(path)
if has_key(s:_unify_path_cache, a:path)
return s:_unify_path_cache[a:path]
endif
let value = tolower(fnamemodify(resolve(fnamemodify(
\ a:path, ':p')), ':~:gs?[\\/]\+?/?'))
let s:_unify_path_cache[a:path] = value
return value
endfunction
else
function! s:_unify_path(path)
return resolve(fnamemodify(a:path, ':p:gs?[\\/]\+?/?'))
endfunction
endif
if s:globpath_third_arg
function! s:_runtime_files(path)
return split(globpath(&runtimepath, a:path, 1), "\n")
endfunction
else
function! s:_runtime_files(path)
return split(globpath(&runtimepath, a:path), "\n")
endfunction
endif
let s:_vital_files_cache_runtimepath = ''
let s:_vital_files_cache = []
function! s:_vital_files(pattern)
if s:_vital_files_cache_runtimepath !=# &runtimepath
let path = printf('autoload/vital/%s/**/*.vim', s:self_version)
let s:_vital_files_cache = s:_runtime_files(path)
let mod = ':p:gs?[\\/]\+?/?'
call map(s:_vital_files_cache, 'fnamemodify(v:val, mod)')
let s:_vital_files_cache_runtimepath = &runtimepath
endif
let target = substitute(a:pattern, '\.', '/', 'g')
let target = substitute(target, '\*', '[^/]*', 'g')
let regexp = printf('autoload/vital/%s/%s.vim', s:self_version, target)
return filter(copy(s:_vital_files_cache), 'v:val =~# regexp')
endfunction
" Copy from System.Filepath
if has('win16') || has('win32') || has('win64')
function! s:_is_absolute_path(path)
return a:path =~? '^[a-z]:[/\\]'
endfunction
else
function! s:_is_absolute_path(path)
return a:path[0] ==# '/'
endfunction
endif
function! s:_build_module(sid)
if has_key(s:loaded, a:sid)
return copy(s:loaded[a:sid])
endif
let functions = s:_get_functions(a:sid)
let prefix = '<SNR>' . a:sid . '_'
let module = {}
for func in functions
let module[func] = function(prefix . func)
endfor
if has_key(module, '_vital_loaded')
let V = vital#{s:self_version}#new()
if has_key(module, '_vital_depends')
let all = {}
let modules =
\ s:_concat(map(module._vital_depends(),
\ 's:expand_modules(v:val, all)'))
call call(V.load, modules, V)
endif
try
call module._vital_loaded(V)
catch
" FIXME: Show an error message for debug.
endtry
endif
if !get(g:, 'vital_debug', 0)
call filter(module, 'v:key =~# "^\\a"')
endif
let s:loaded[a:sid] = module
return copy(module)
endfunction
if exists('+regexpengine')
function! s:_get_functions(sid)
let funcs = s:_redir(printf("function /\\%%#=2^\<SNR>%d_", a:sid))
let map_pat = '<SNR>' . a:sid . '_\zs\w\+'
return map(split(funcs, "\n"), 'matchstr(v:val, map_pat)')
endfunction
else
function! s:_get_functions(sid)
let prefix = '<SNR>' . a:sid . '_'
let funcs = s:_redir('function')
let filter_pat = '^\s*function ' . prefix
let map_pat = prefix . '\zs\w\+'
return map(filter(split(funcs, "\n"),
\ 'stridx(v:val, prefix) > 0 && v:val =~# filter_pat'),
\ 'matchstr(v:val, map_pat)')
endfunction
endif
if exists('*uniq')
function! s:_uniq(list)
return uniq(a:list)
endfunction
else
function! s:_uniq(list)
let i = len(a:list) - 1
while 0 < i
if a:list[i] ==# a:list[i - 1]
call remove(a:list, i)
let i -= 2
else
let i -= 1
endif
endwhile
return a:list
endfunction
endif
function! s:_concat(lists)
let result_list = []
for list in a:lists
let result_list += list
endfor
return result_list
endfunction
function! s:_redir(cmd)
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
set verbose=0 verbosefile=
redir => res
silent! execute a:cmd
redir END
let [&verbose, &verbosefile] = [save_verbose, save_verbosefile]
return res
endfunction
function! vital#{s:self_version}#new()
return s:_import('')
endfunction
let s:self_file = s:_unify_path(expand('<sfile>'))

View File

@ -0,0 +1,237 @@
" Utilities for file copy/move/mkdir/etc.
let s:save_cpo = &cpo
set cpo&vim
let s:is_unix = has('unix')
let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95')
let s:is_cygwin = has('win32unix')
let s:is_mac = !s:is_windows && !s:is_cygwin
\ && (has('mac') || has('macunix') || has('gui_macvim') ||
\ (!isdirectory('/proc') && executable('sw_vers')))
" As of 7.4.122, the system()'s 1st argument is converted internally by Vim.
" Note that Patch 7.4.122 does not convert system()'s 2nd argument and
" return-value. We must convert them manually.
let s:need_trans = v:version < 704 || (v:version == 704 && !has('patch122'))
" Open a file.
function! s:open(filename) "{{{
let filename = fnamemodify(a:filename, ':p')
" Detect desktop environment.
if s:is_windows
" For URI only.
if s:need_trans
let filename = iconv(filename, &encoding, 'char')
endif
silent execute '!start rundll32 url.dll,FileProtocolHandler' filename
elseif s:is_cygwin
" Cygwin.
call system(printf('%s %s', 'cygstart',
\ shellescape(filename)))
elseif executable('xdg-open')
" Linux.
call system(printf('%s %s &', 'xdg-open',
\ shellescape(filename)))
elseif exists('$KDE_FULL_SESSION') && $KDE_FULL_SESSION ==# 'true'
" KDE.
call system(printf('%s %s &', 'kioclient exec',
\ shellescape(filename)))
elseif exists('$GNOME_DESKTOP_SESSION_ID')
" GNOME.
call system(printf('%s %s &', 'gnome-open',
\ shellescape(filename)))
elseif executable('exo-open')
" Xfce.
call system(printf('%s %s &', 'exo-open',
\ shellescape(filename)))
elseif s:is_mac && executable('open')
" Mac OS.
call system(printf('%s %s &', 'open',
\ shellescape(filename)))
else
" Give up.
throw 'Not supported.'
endif
endfunction "}}}
" Move a file.
" Dispatch s:move_exe() or s:move_vim().
" FIXME: Currently s:move_vim() does not support
" moving a directory.
function! s:move(src, dest) "{{{
if s:_has_move_exe() || isdirectory(a:src)
return s:move_exe(a:src, a:dest)
else
return s:move_vim(a:src, a:dest)
endif
endfunction "}}}
if s:is_unix
function! s:_has_move_exe()
return executable('mv')
endfunction
elseif s:is_windows
function! s:_has_move_exe()
return 1
endfunction
else
function! s:_has_move_exe()
throw 'vital: System.File._has_move_exe(): your platform is not supported'
endfunction
endif
" Move a file.
" Implemented by external program.
if s:is_unix
function! s:move_exe(src, dest)
if !s:_has_move_exe() | return 0 | endif
let [src, dest] = [a:src, a:dest]
call system('mv ' . shellescape(src) . ' ' . shellescape(dest))
return !v:shell_error
endfunction
elseif s:is_windows
function! s:move_exe(src, dest)
if !s:_has_move_exe() | return 0 | endif
let [src, dest] = [a:src, a:dest]
" Normalize successive slashes to one slash.
let src = substitute(src, '[/\\]\+', '\', 'g')
let dest = substitute(dest, '[/\\]\+', '\', 'g')
" src must not have trailing '\'.
let src = substitute(src, '\\$', '', 'g')
" All characters must be encoded to system encoding.
if s:need_trans
let src = iconv(src, &encoding, 'char')
let dest = iconv(dest, &encoding, 'char')
endif
let cmd_exe = (&shell =~? 'cmd\.exe$' ? '' : 'cmd /c ')
call system(cmd_exe . 'move /y ' . src . ' ' . dest)
return !v:shell_error
endfunction
else
function! s:move_exe()
throw 'vital: System.File.move_exe(): your platform is not supported'
endfunction
endif
" Move a file.
" Implemented by pure Vim script.
function! s:move_vim(src, dest) "{{{
return !rename(a:src, a:dest)
endfunction "}}}
" Copy a file.
" Dispatch s:copy_exe() or s:copy_vim().
function! s:copy(src, dest) "{{{
if s:_has_copy_exe()
return s:copy_exe(a:src, a:dest)
else
return s:copy_vim(a:src, a:dest)
endif
endfunction "}}}
if s:is_unix
function! s:_has_copy_exe()
return executable('cp')
endfunction
elseif s:is_windows
function! s:_has_copy_exe()
return 1
endfunction
else
function! s:_has_copy_exe()
throw 'vital: System.File._has_copy_exe(): your platform is not supported'
endfunction
endif
" Copy a file.
" Implemented by external program.
if s:is_unix
function! s:copy_exe(src, dest)
if !s:_has_copy_exe() | return 0 | endif
let [src, dest] = [a:src, a:dest]
call system('cp ' . shellescape(src) . ' ' . shellescape(dest))
return !v:shell_error
endfunction
elseif s:is_windows
function! s:copy_exe(src, dest)
if !s:_has_copy_exe() | return 0 | endif
let [src, dest] = [a:src, a:dest]
let src = substitute(src, '/', '\', 'g')
let dest = substitute(dest, '/', '\', 'g')
let cmd_exe = (&shell =~? 'cmd\.exe$' ? '' : 'cmd /c ')
call system(cmd_exe . 'copy /y ' . src . ' ' . dest)
return !v:shell_error
endfunction
else
function! s:copy_exe()
throw 'vital: System.File.copy_exe(): your platform is not supported'
endfunction
endif
" Copy a file.
" Implemented by pure Vim script.
function! s:copy_vim(src, dest) "{{{
let ret = writefile(readfile(a:src, "b"), a:dest, "b")
if ret == -1
return 0
endif
return 1
endfunction "}}}
" mkdir() but does not throw an exception.
" Returns true if success.
" Returns false if failure.
function! s:mkdir_nothrow(...) "{{{
try
return call('mkdir', a:000)
catch
return 0
endtry
endfunction "}}}
" Delete a file/directory.
if s:is_unix
function! s:rmdir(path, ...)
let flags = a:0 ? a:1 : ''
let cmd = flags =~# 'r' ? 'rm -r' : 'rmdir'
let cmd .= flags =~# 'f' && cmd ==# 'rm -r' ? ' -f' : ''
let ret = system(cmd . ' ' . shellescape(a:path))
if v:shell_error
let ret = iconv(ret, 'char', &encoding)
throw substitute(ret, '\n', '', 'g')
endif
endfunction
elseif s:is_windows
function! s:rmdir(path, ...)
let flags = a:0 ? a:1 : ''
if &shell =~? "sh$"
let cmd = flags =~# 'r' ? 'rm -r' : 'rmdir'
let cmd .= flags =~# 'f' && cmd ==# 'rm -r' ? ' -f' : ''
let ret = system(cmd . ' ' . shellescape(a:path))
else
" 'f' flag does not make sense.
let cmd = 'rmdir /Q'
let cmd .= flags =~# 'r' ? ' /S' : ''
let ret = system(cmd . ' "' . a:path . '"')
endif
if v:shell_error
let ret = iconv(ret, 'char', &encoding)
throw substitute(ret, '\n', '', 'g')
endif
endfunction
else
function! s:rmdir(...)
throw 'vital: System.File.rmdir(): your platform is not supported'
endfunction
endif
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et ts=2 sts=2 sw=2 tw=0:

View File

@ -0,0 +1,4 @@
previm
e8ec38a
System.File

View File

@ -0,0 +1,231 @@
*previm.txt* プレビュー用プラグイン
Version: 1.6
Author: kanno <akapanna@gmail.com>
==============================================================================
目次 *previm-contents*
概要 |previm-introduction|
依存プラグイン |previm-depends|
使い方 |previm-usage|
コマンド |previm-command|
関数 |previm-functions|
設定 |previm-settings|
open-browser.vimの使用 |previm-openbrowser|
更新履歴 |previm-changelog|
==============================================================================
概要 *previm-introduction*
Vimで編集した内容をブラウザでプレビューするための機能を提供します。
リアルタイムプレビューに近いことが可能です。
[対応フォーマット]
- Markdown
- textile
- reStructuredText(required rst2html.py)
最新版:
http://github.com/kannokanno/previm
==============================================================================
依存プラグイン *previm-depends*
[必須]
なし
[任意]
- open-browser.vim(https://github.com/tyru/open-browser.vim)
==============================================================================
使い方 *previm-usage*
Markdownの場合を例とします。他の形式についても基本的な操作は同じです。
1. .vimrcで |g:previm_open_cmd| を設定します。
(ただしopen-browser.vimを使用する場合は不要です)
2. |filetype| がMarkdownのファイルの編集を開始します。
3. |:PrevimOpen| を実行してブラウザを開きます。
4. 元のVimバッファに戻り編集を続けます。
5. 変更の度にブラウザの表示内容が更新されます。
注意:拡張子が`.md`の場合は`markdown`ではなく`modula2`として認識されてしまいます。
その場合は以下の設定を.vimrcに記述してください
" .vimrc
augroup PrevimSettings
autocmd!
autocmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown
augroup END
==============================================================================
コマンド *previm-command*
*:PrevimOpen*
:PrevimOpen
現在のファイルを対象としてブラウザを開きます。
==============================================================================
関数 *previm-functions*
previm#open({path}) *previm#open()*
{path} にはブラウザで開くURLを指定します。
previm#refresh() *previm#refresh()*
編集内容の更新を反映します。これによりブラウザの表示も更新されます。
==============================================================================
設定 *previm-settings*
g:previm_open_cmd *g:previm_open_cmd*
型:文字列
|:PrevimOpen| で実行するコマンドを指定します。このコマンドが指定されて
いない場合はopenbrowser#openを試みます。
|previm-openbrowser| も参照してください。
以下の設定例は、MacにてFirefoxで開く場合です。
>
" .vimrc
let g:previm_open_cmd = 'open -a Firefox'
<
g:previm_enable_realtime *g:previm_enable_realtime*
型:数値
リアルタイムに変更をプレビューするかどうかを設定します。
値が0なら以下のタイミングでのみ変更が反映されます。
* ファイル保存時
値が1ならば、ほぼリアルタイムにプレビューできます。
デフォルトでは0に設定されています。
なおプレビュー対象のファイルを開いた後でこの値を変えた場合は、
設定反映のためにプレビュー対象のファイルを開き直す必要があります。
>
" .vimrc
" リアルタイムにプレビューする
let g:previm_enable_realtime = 1
g:previm_disable_default_css *g:previm_disable_default_css*
型:数値
プレビュー時にデフォルトのCSSを適用しないようにします。
設定出来る有効な値は1のみです。それ以外の値は無視されます。
>
" .vimrc
" デフォルトのCSSを無効にする
let g:previm_disable_default_css = 1
g:previm_custom_css_path *g:previm_custom_css_path*
型:文字列
プレビュー時にユーザー定義のCSSを追加出来ます。
このCSSはデフォルトCSSの後に読み込まれます。
設定する値にはCSSファイルへの絶対パスを書いてください。
>
" .vimrc
" デフォルトのCSSに加えて独自のCSSも適用する
let g:previm_custom_css_path = '/Users/kanno/tmp/some.css'
" .vimrc
" デフォルトのCSSを使わず、独自のCSSのみ適用する
let g:previm_disable_default_css = 1
let g:previm_custom_css_path = '/Users/kanno/tmp/some.css'
g:previm_show_header *g:previm_show_header*
型:数値
値が1ならば、プレビュー時にヘッダーを表示します。
ヘッダーには編集しているファイル名と更新日時が表示されます。
値が0ならば、プレビュー時にヘッダーを表示しません。
デフォルトでは1に設定されています。
>
" .vimrc
let g:previm_show_header = 0
==============================================================================
open-browser.vimの使用 *previm-openbrowser*
プレビューブラウザを開くときは次のような処理になります。
1. |g:previm_open_cmd| が設定されていればそのコマンドを実行する
- |g:previm_open_cmd| が未定義、もしくは空文字の場合は 2 へ
2. openbrowser#open()でブラウザを開く
- open-browser.vimがインストールされていない場合は 3 へ
3. 実行できるコマンドがないので標準エラーにメッセージを出力して終了
このため、open-browser.vimを使う場合 |g:previm_open_cmd| の設定は不要です。
==============================================================================
更新履歴 *previm-changelog*
1.7.1 2015-08-17
- support hidden header
1.7 2015-08-15
- support mermaid(https://github.com/knsv/mermaid)
1.6 2014-09-15
- support realtime refresh
1.5.4 2014-09-06
- support custom css
1.5.3 2014-08-02
- support reStructuredText(required rst2html.py)
1.5.2 2014-07-27
- code block syntax highlighting
- update marked.js
1.5.1 2014-06-08
- cssのバグを修正
1.5 2014-04-05
- modula2の対応を記述
1.4 2014-03-29
- textile対応
1.3.2 2013-07-06
- ローカルの画像を参照できるようになった
- g:previm_open_cmdに半角空白が含まれる場合のバグを修正
1.3.1 2013-06-28
- showdown.js を marked に変更
1.3 2013-06-22
- fixed #4(Github issue)
- Windowsのディレクトリパス()のエスケープ処理追加
- IE8以前での動作対応(attachEvent対応追加)
- Windows環境での更新日表示対応追加
- Thanks id:sousu, id:beckorz
1.2 2013-06-16
- resolved reload issue in google chrome
- Thanks id:ArcCosine
1.1 2013-06-13
- previm-function.jsのエンコードにUTF-8を明示
1.0 2013-06-11
- 初版
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,232 @@
*previm.txt* Preview Plugin
Version: 1.6
Author: kanno <akapanna@gmail.com>
==============================================================================
CONTENTS *previm-contents*
Introduction |previm-introduction|
Dependencies |previm-depends|
Usage |previm-usage|
Commands |previm-command|
Functions |previm-functions|
Settings |previm-settings|
Using with open-browser.vim |previm-openbrowser|
Changelog |previm-changelog|
==============================================================================
INDRODUCTION *previm-introduction*
This plugin provides the functionality of displaying file previews on
browsers. It achieves something similar to real-time previewing.
[Available formats]
- Markdown
- textile
- reStructuredText(required rst2html.py)
Latest revision:
http://github.com/kannokanno/previm
==============================================================================
DEPENDENCIES *previm-depends*
[Required]
None
[Optional]
- open-browser.vim(https://github.com/tyru/open-browser.vim)
==============================================================================
USAGE *previm-usage*
This is an example of the case of markdown.
The basic operation is the same in other formats.
1. Set |g:previm_open_cmd| in your .vimrc. This is unnecessary if you are using
open-browser.vim.
2. Start editing a file with |filetype| of Markdown.
3. Open preview on browser with |:PrevimOpen|.
4. Go back to the buffer and edit some more.
5. Changes are reflected on the page shown in the browser each update.
Note: If `.md` files are recognized as `modula2` rather than `markdown`, add
the following to your .vimrc.
" .vimrc
augroup PrevimSettings
autocmd!
autocmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown
augroup END
==============================================================================
COMMANDS *previm-command*
*:PrevimOpen*
:PrevimOpen
Opens the current file on the browser.
==============================================================================
FUNCTIONS *previm-functions*
previm#open({path}) *previm#open()*
Set {path} to the URL to open in browser.
previm#refresh() *previm#refresh()*
Apply the changes made to the file. This will automatically update
the page shown in the browser.
==============================================================================
SETTINGS *previm-settings*
g:previm_open_cmd *g:previm_open_cmd*
Type:String
Specify the command to be executed with |:PrevimOpen|. openbrowser#open
is executed if no command is specified.
Also see |previm-openbrowser|.
The following sample configuration opens Firefox on Mac.
>
" .vimrc
let g:previm_open_cmd = 'open -a Firefox'
g:previm_enable_realtime *g:previm_enable_realtime*
Type:Num
You can select whether you want to preview the changes in real time.
Changes are reflected only at the timing if the value 0.
* When saving a file
If the value is 1, I can preview in near real-time.
It is set to 0 by default.
The case of changing this value after opening a file to preview is
You need to re-open the file to preview in order to reflect the setting.
>
" .vimrc
" Realtime preview
let g:previm_enable_realtime = 1
g:previm_disable_default_css *g:previm_disable_default_css*
Type:Num
I do not apply the default CSS when previewing.
Valid values that can be set only one. All other values are ignored.
>
" .vimrc
" I want to disable the default CSS
let g:previm_disable_default_css = 1
g:previm_custom_css_path *g:previm_custom_css_path*
Type:String
I can add a custom CSS during preview.
This CSS will be loaded after the default CSS.
Please write the absolute path to the CSS file to the set value.
>
" .vimrc
" Also apply your own CSS in addition to the default CSS
let g:previm_custom_css_path = '/Users/kanno/tmp/some.css'
" .vimrc
" Instead of using the default CSS and apply only your own CSS
let g:previm_disable_default_css = 1
let g:previm_custom_css_path = '/Users/kanno/tmp/some.css'
g:previm_show_header *g:previm_show_header*
Type:Num
If the value is 1, it will display a header at the time of preview.
The header displays the file name and update datetime that you are editing.
If the value is 0, it does not display the header at the time of preview.
It is set to 1 by default.
>
" .vimrc
let g:previm_show_header = 0
==============================================================================
USING WITH OPEN-BROWSER.VIM *previm-openbrowser*
The following steps are taken for choosing which browser to display the
preview on.
1. Attempt to execute command that is set to |g:previm_open_cmd|
- If |g:previm_open_cmd| is undefined or empty, proceed to step 2
2. Attempt open browser with openbrowser#open()
- If open-browser.vim is not installed, proceed to step 3
3. Exit after displaying message to standard error about not being able to
find any command to execute.
Thus, |g:previm_open_cmd| need not be configured when using open-browser.vim.
==============================================================================
CHANGELOG *previm-changelog*
1.7.1 2015-08-17
- support hidden header
1.7 2015-08-15
- support mermaid(https://github.com/knsv/mermaid)
1.6 2014-09-15
- support realtime refresh
1.5.4 2014-09-06
- support custom css
1.5.3 2014-08-02
- support reStructuredText(required rst2html.py)
1.5.2 2014-07-27
- code block syntax highlighting
- update marked.js
1.5.1 2014-06-08
- fix bug regarding css
1.5 2014-04-05
- add notice about modula2
1.4 2014-03-29
- add support for textile
1.3.2 2013-07-06
- local images can now be referenced
- fix bug when g:previm_open_cmd contains half-width space character
1.3.1 2013-06-28
- change showdown.js to "marked"
1.3 2013-06-22
- fixed #4(Github issue)
- escape Windows' directory path
- add support for browsers before IE8 (add support for attachEvent)
- add feature to display modified time under Windows environment
- Thanks id:sousu, id:beckorz
1.2 2013-06-16
- resolved reload issue in google chrome
- Thanks id:ArcCosine
1.1 2013-06-13
- explicitly state the usage of UTF-8 encoding in previm-function.js
1.0 2013-06-11
- first release
vim:tw=78:ts=8:ft=help:norl:noexpandtab

View File

@ -0,0 +1,32 @@
" AUTHOR: kanno <akapanna@gmail.com>
" License: This file is placed in the public domain.
if exists('g:loaded_previm') && g:loaded_previm
finish
endif
let g:loaded_previm = 1
let s:save_cpo = &cpo
set cpo&vim
function! s:setup_setting()
augroup Previm
autocmd! * <buffer>
if get(g:, "previm_enable_realtime", 0) ==# 1
" NOTE: It is too frequently in TextChanged/TextChangedI
autocmd CursorHold,CursorHoldI,InsertLeave,BufWritePost <buffer> call previm#refresh()
else
autocmd BufWritePost <buffer> call previm#refresh()
endif
augroup END
command! -buffer -nargs=0 PrevimOpen call previm#open(previm#make_preview_file_path('index.html'))
endfunction
augroup Previm
autocmd!
autocmd FileType *{mkd,markdown,rst,textile}* call <SID>setup_setting()
augroup END
let &cpo = s:save_cpo
unlet! s:save_cpo

View File

@ -0,0 +1,124 @@
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
-webkit-text-size-adjust: none;
}
.hljs-comment,
.diff .hljs-header,
.hljs-javadoc {
color: #998;
font-style: italic;
}
.hljs-keyword,
.css .rule .hljs-keyword,
.hljs-winutils,
.nginx .hljs-title,
.hljs-subst,
.hljs-request,
.hljs-status {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-hexcolor,
.ruby .hljs-constant {
color: #008080;
}
.hljs-string,
.hljs-tag .hljs-value,
.hljs-phpdoc,
.hljs-dartdoc,
.tex .hljs-formula {
color: #d14;
}
.hljs-title,
.hljs-id,
.scss .hljs-preprocessor {
color: #900;
font-weight: bold;
}
.hljs-list .hljs-keyword,
.hljs-subst {
font-weight: normal;
}
.hljs-class .hljs-title,
.hljs-type,
.vhdl .hljs-literal,
.tex .hljs-command {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-tag .hljs-title,
.hljs-rules .hljs-property,
.django .hljs-tag .hljs-keyword {
color: #000080;
font-weight: normal;
}
.hljs-attribute,
.hljs-variable,
.lisp .hljs-body {
color: #008080;
}
.hljs-regexp {
color: #009926;
}
.hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.lisp .hljs-keyword,
.clojure .hljs-keyword,
.scheme .hljs-keyword,
.tex .hljs-special,
.hljs-prompt {
color: #990073;
}
.hljs-built_in {
color: #0086b3;
}
.hljs-preprocessor,
.hljs-pragma,
.hljs-pi,
.hljs-doctype,
.hljs-shebang,
.hljs-cdata {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.diff .hljs-change {
background: #0086b3;
}
.hljs-chunk {
color: #aaa;
}

View File

@ -0,0 +1,260 @@
/* Flowchart variables */
/* Sequence Diagram variables */
/* Gantt chart variables */
.mermaid .label {
color: #333333;
}
.node rect,
.node circle,
.node polygon {
fill: #ececff;
stroke: #ccccff;
stroke-width: 1px;
}
.edgePath .path {
stroke: #333333;
}
.cluster rect {
fill: #ffffde !important;
rx: 4 !important;
stroke: #aaaa33 !important;
stroke-width: 1px !important;
}
.cluster text {
fill: #333333;
}
.actor {
stroke: #ccccff;
fill: #ececff;
}
text.actor {
fill: black;
stroke: none;
}
.actor-line {
stroke: grey;
}
.messageLine0 {
stroke-width: 1.5;
stroke-dasharray: "2 2";
marker-end: "url(#arrowhead)";
stroke: #333333;
}
.messageLine1 {
stroke-width: 1.5;
stroke-dasharray: "2 2";
stroke: #333333;
}
#arrowhead {
fill: #333333;
}
#crosshead path {
fill: #333333 !important;
stroke: #333333 !important;
}
.messageText {
fill: #333333;
stroke: none;
}
.labelBox {
stroke: #ccccff;
fill: #ececff;
}
.labelText {
fill: black;
stroke: none;
}
.loopText {
fill: black;
stroke: none;
}
.loopLine {
stroke-width: 2;
stroke-dasharray: "2 2";
marker-end: "url(#arrowhead)";
stroke: #ccccff;
}
.note {
stroke: #aaaa33;
fill: #fff5ad;
}
.noteText {
fill: black;
stroke: none;
font-family: 'trebuchet ms', verdana, arial;
font-size: 14px;
}
/** Section styling */
.section {
stroke: none;
opacity: 0.2;
}
.section0 {
fill: rgba(102, 102, 255, 0.49);
}
.section2 {
fill: #fff400;
}
.section1,
.section3 {
fill: white;
opacity: 0.2;
}
.sectionTitle0 {
fill: #333333;
}
.sectionTitle1 {
fill: #333333;
}
.sectionTitle2 {
fill: #333333;
}
.sectionTitle3 {
fill: #333333;
}
.sectionTitle {
text-anchor: start;
font-size: 11px;
text-height: 14px;
}
/* Grid and axis */
.grid .tick {
stroke: lightgrey;
opacity: 0.3;
shape-rendering: crispEdges;
}
.grid path {
stroke-width: 0;
}
/* Today line */
.today {
fill: none;
stroke: red;
stroke-width: 2px;
}
/* Task styling */
/* Default task */
.task {
stroke-width: 2;
}
.taskText {
text-anchor: middle;
font-size: 11px;
}
.taskTextOutsideRight {
fill: black;
text-anchor: start;
font-size: 11px;
}
.taskTextOutsideLeft {
fill: black;
text-anchor: end;
font-size: 11px;
}
/* Specific task settings for the sections*/
.taskText0,
.taskText1,
.taskText2,
.taskText3 {
fill: white;
}
.task0,
.task1,
.task2,
.task3 {
fill: #8a90dd;
stroke: #534fbc;
}
.taskTextOutside0,
.taskTextOutside2 {
fill: black;
}
.taskTextOutside1,
.taskTextOutside3 {
fill: black;
}
/* Active task */
.active0,
.active1,
.active2,
.active3 {
fill: #bfc7ff;
stroke: #534fbc;
}
.activeText0,
.activeText1,
.activeText2,
.activeText3 {
fill: black !important;
}
/* Completed task */
.done0,
.done1,
.done2,
.done3 {
stroke: grey;
fill: lightgrey;
stroke-width: 2;
}
.doneText0,
.doneText1,
.doneText2,
.doneText3 {
fill: black !important;
}
/* Tasks on the critical line */
.crit0,
.crit1,
.crit2,
.crit3 {
stroke: #ff8888;
fill: red;
stroke-width: 2;
}
.activeCrit0,
.activeCrit1,
.activeCrit2,
.activeCrit3 {
stroke: #ff8888;
fill: #bfc7ff;
stroke-width: 2;
}
.doneCrit0,
.doneCrit1,
.doneCrit2,
.doneCrit3 {
stroke: #ff8888;
fill: lightgrey;
stroke-width: 2;
cursor: pointer;
shape-rendering: crispEdges;
}
.doneCritText0,
.doneCritText1,
.doneCritText2,
.doneCritText3 {
fill: black !important;
}
.activeCritText0,
.activeCritText1,
.activeCritText2,
.activeCritText3 {
fill: black !important;
}
.titleText {
text-anchor: middle;
font-size: 18px;
fill: black;
}
/*
*/
text {
font-family: 'trebuchet ms', verdana, arial;
font-size: 14px;
}
.mermaid {
width:1200px;
}

View File

@ -0,0 +1,224 @@
#header {
border-bottom: 1px solid #ccc;
}
#last-modified {
padding-left: 10px;
}
/* GitHub-like styles based on ghf_marked.css of Docter (https://github.com/alampros/Docter) */
html {
background: #fff;
margin: 0;
padding: 0;
}
body {
font: 14px helvetica,arial,freesans,clean,sans-serif;
line-height: 1.6;
margin: 0 auto;
padding: 20px;
text-align: left;
color: #333;
width: auto;
max-width: 920px;
}
body > *:first-child {
margin-top: 0 !important;
}
body > *:last-child {
margin-bottom: 0 !important;
}
h1 {
font-size: 28px;
margin-bottom: 10px;
color: black;
}
h2 {
font-size: 24px;
margin: 20px 0 10px;
color: black;
border-bottom: 1px solid #ccc;
}
h3 {
font-size: 18px;
margin: 20px 0 10px;
}
h4 {
font-size: 16px;
font-weight: bold;
margin: 20px 0 10px;
}
h5 {
font-size: 14px;
font-weight: bold;
margin: 20px 0 10px;
}
h6 {
color: #777;
font-size: 14px;
font-weight: bold;
margin: 20px 0 10px;
}
hr {
}
p {
margin: 15px 0;
}
pre, code {
font: 12px 'Bitstream Vera Sans Mono','Courier',monospace;
}
.highlight pre, pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
padding: 6px 10px;
}
code {
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
margin: 0 2px;
padding: 0 5px;
}
pre code
{
white-space: pre;
border: none;
background: transparent;
margin: 0;
padding: 0;
}
a, a code {
color: #4183C4;
text-decoration: none;
}
blockquote
{
border-left: 4px solid #ddd;
padding: 0 15px;
color: #777777;
margin: 15px 0;
}
blockquote > :first-child {
margin-top: 0;
}
blockquote > :last-child {
margin-bottom: 0;
}
table
{
font-size: 14px;
border-collapse: collapse;
margin: 20px 0 0;
padding: 0;
}
table tr
{
border-top: 1px solid #ccc;
background-color: #fff;
margin: 0;
padding: 0;
}
table tr:nth-child(2n)
{
background-color: #f8f8f8;
}
table tr th[align="center"], table tr td[align="center"] {
text-align: center;
}
table tr th[align="right"], table tr td[align="right"] {
text-align: right;
}
table tr th, table tr td
{
border: 1px solid #ccc;
text-align: left;
margin: 0;
padding: 6px 13px;
}
ul, ol
{
margin: 15px 0;
}
ul li, ol li
{
margin-top: 7px;
margin-bottom: 7px;
}
dl {
padding: 0;
}
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
dl dt:first-child {
padding: 0;
}
dl dt > :first-child {
margin-top: 0;
}
dl dt > :last-child {
margin-bottom: 0;
}
dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
dl dd > :first-child {
margin-top: 0;
}
dl dd > :last-child {
margin-bottom: 0;
}
.shadow {
-webkit-box-shadow: 0 5px 15px #000;
-moz-box-shadow: 0 5px 15px #000;
box-shadow: 0 5px 15px #000;
}
@media screen and (min-width: 914px) {
body {
width: 854px;
margin:0 auto;
}
}
@media print {
table, pre {
page-break-inside: avoid;
}
}

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Preview</title>
<link type="text/css" href="css/previm.css" rel="stylesheet" media="all" />
<link type="text/css" href="css/lib/mermaid.css" rel="stylesheet" media="all" />
</head>
<body id="body">
<div id="header">
<span id="markdown-file-name">Loading...</span>
<small><span id="last-modified"></span></small>
</div>
<div id="preview"></div>
<div id="footer">
<script src="js/lib/marked.min.js"></script>
<script src="js/lib/highlight.pack.js"></script>
<script src="js/lib/textile.js"></script>
<script src="js/lib/mermaid.min.js"></script>
<script src="js/previm.js"></script>
<div id="monitor"></div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,119 @@
'use strict';
(function(_doc, _win) {
var REFRESH_INTERVAL = 1000;
var marked_renderer = new marked.Renderer();
var defaultCodeBlockRenderer = marked_renderer.code;
marked_renderer.code = function (code, language) {
if(language === 'mermaid'){
return '<div class="mermaid">' + code + '</div>';
} else {
return defaultCodeBlockRenderer.apply(this, arguments);
}
};
function transform(filetype, content) {
if(hasTargetFileType(filetype, ['markdown', 'mkd'])) {
return marked(content, { renderer: marked_renderer });
} else if(hasTargetFileType(filetype, ['rst'])) {
// It has already been converted by rst2html.py
return content;
} else if(hasTargetFileType(filetype, ['textile'])) {
return textile(content);
}
return 'Sorry. It is a filetype(' + filetype + ') that is not support<br /><br />' + content;
}
function hasTargetFileType(filetype, targetList) {
var ftlist = filetype.split('.');
for(var i=0;i<ftlist.length; i++) {
if(targetList.indexOf(ftlist[i]) > -1){
return true;
}
}
return false;
}
// NOTE: Experimental
// ここで動的にpageYOffsetを取得すると画像表示前の高さになってしまう
// そのため明示的にpageYOffsetを受け取るようにしている
function autoScroll(id, pageYOffset) {
var relaxed = 0.95;
var obj = document.getElementById(id);
if((_doc.documentElement.clientHeight + pageYOffset) / _doc.body.clientHeight > relaxed) {
obj.scrollTop = obj.scrollHeight;
} else {
obj.scrollTop = pageYOffset;
}
}
function style_header() {
if (typeof isShowHeader === 'function') {
var style = isShowHeader() ? '' : 'none';
_doc.getElementById('header').style.display = style;
}
}
function loadPreview() {
var needReload = false;
// These functions are defined as the file generated dynamically.
// generator-file: preview/autoload/previm.vim
// generated-file: preview/js/previm-function.js
if (typeof getFileName === 'function') {
if (_doc.getElementById('markdown-file-name').innerHTML !== getFileName()) {
_doc.getElementById('markdown-file-name').innerHTML = getFileName();
needReload = true;
}
} else {
needReload = true;
}
if (typeof getLastModified === 'function') {
if (_doc.getElementById('last-modified').innerHTML !== getLastModified()) {
_doc.getElementById('last-modified').innerHTML = getLastModified();
needReload = true;
}
} else {
needReload = true;
}
if (needReload && (typeof getContent === 'function') && (typeof getFileType === 'function')) {
var beforePageYOffset = _win.pageYOffset;
_doc.getElementById('preview').innerHTML = transform(getFileType(), getContent());
mermaid.init();
Array.prototype.forEach.call(_doc.querySelectorAll('pre code'), hljs.highlightBlock);
autoScroll('body', beforePageYOffset);
style_header();
}
}
_win.setInterval(function() {
var script = _doc.createElement('script');
script.type = 'text/javascript';
script.src = 'js/previm-function.js?t=' + new Date().getTime();
_addEventListener(script, 'load', (function() {
loadPreview();
_win.setTimeout(function() {
script.parentNode.removeChild(script);
}, 160);
})());
_doc.getElementsByTagName('head')[0].appendChild(script);
}, REFRESH_INTERVAL);
function _addEventListener(target, type, listener) {
if (target.addEventListener) {
target.addEventListener(type, listener, false);
} else if (target.attachEvent) {
// for IE6 - IE8
target.attachEvent('on' + type, function() { listener.apply(target, arguments); });
} else {
// do nothing
}
}
loadPreview();
})(document, window);

View File

@ -0,0 +1,2 @@
" setting for kannokanno/vimtest
let &runtimepath = expand('<sfile>:p:h:h')

View File

@ -0,0 +1,210 @@
let s:newline = "\\n"
let s:assert = themis#helper('assert')
let s:t = themis#suite('convert_to_content') "{{{
function! s:t.empty_lines()
let arg = []
let expected = ''
call s:assert.equals(previm#convert_to_content(arg), expected)
endfunction
function! s:t.not_exists_escaped()
let arg = ['aaabbb', 'あいうえお漢字']
let expected =
\ 'aaabbb' . s:newline
\ . 'あいうえお漢字'
call s:assert.equals(previm#convert_to_content(arg), expected)
endfunction
function! s:t.exists_backslash()
let arg = ['\(x -> x + 2)', 'あいうえお漢字']
let expected =
\ '\\(x -> x + 2)' . s:newline
\ . 'あいうえお漢字'
call s:assert.equals(previm#convert_to_content(arg), expected)
endfunction
function! s:t.exists_double_quotes()
let arg = ['he said. "Hello, john"', 'あいうえお漢字']
let expected =
\ 'he said. \"Hello, john\"' . s:newline
\ . 'あいうえお漢字'
call s:assert.equals(previm#convert_to_content(arg), expected)
endfunction
"}}}
let s:t = themis#suite('relative_to_absolute') "{{{
function! s:t.nothing_when_empty()
let arg_line = ''
let expected = ''
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, ''), expected)
endfunction
function! s:t.nothing_when_not_href()
let arg_line = 'previm.dummy.com/some/path/img.png'
let expected = 'previm.dummy.com/some/path/img.png'
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, ''), expected)
endfunction
function! s:t.nothing_when_absolute_by_http()
let arg_line = 'http://previm.dummy.com/some/path/img.png'
let expected = 'http://previm.dummy.com/some/path/img.png'
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, ''), expected)
endfunction
function! s:t.nothing_when_absolute_by_https()
let arg_line = 'https://previm.dummy.com/some/path/img.png'
let expected = 'https://previm.dummy.com/some/path/img.png'
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, ''), expected)
endfunction
function! s:t.nothing_when_absolute_by_file()
let arg_line = 'file://previm/some/path/img.png'
let expected = 'file://previm/some/path/img.png'
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, ''), expected)
endfunction
function! s:t.replace_path_when_relative()
let rel_path = 'previm/some/path/img.png'
let arg_line = printf('![img](%s)', rel_path)
let arg_dir = '/Users/foo/tmp'
let expected = printf('![img](file://localhost%s/%s)', arg_dir, rel_path)
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, arg_dir), expected)
endfunction
function! s:t.urlencoded_path()
let rel_path = 'previm\some\path\img.png'
let arg_line = printf('![img](%s)', rel_path)
let arg_dir = 'C:\Documents and Settings\folder'
let expected = '![img](file://localhost/C:\Documents%20and%20Settings\folder/previm\some\path\img.png)'
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, arg_dir), expected)
endfunction
function! s:t.with_title_from_double_quote()
let rel_path = 'previm\some\path\img.png'
let arg_line = printf('![img](%s "title")', rel_path)
let arg_dir = 'C:\Documents and Settings\folder'
let expected = '![img](file://localhost/C:\Documents%20and%20Settings\folder/previm\some\path\img.png "title")'
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, arg_dir), expected)
endfunction
function! s:t.with_title_from_single_quote()
let rel_path = 'previm\some\path\img.png'
let arg_line = printf("![img](%s 'title')", rel_path)
let arg_dir = 'C:\Documents and Settings\folder'
let expected = '![img](file://localhost/C:\Documents%20and%20Settings\folder/previm\some\path\img.png "title")'
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, arg_dir), expected)
endfunction
function! s:t.not_only_img()
let rel_path = 'previm/some/path/img.png'
let arg_line = printf('| a | ![img](%s) |', rel_path)
let arg_dir = '/Users/foo/tmp'
let expected = printf('| a | ![img](file://localhost%s/%s) |', arg_dir, rel_path)
call s:assert.equals(previm#relative_to_absolute_imgpath(arg_line, arg_dir), expected)
endfunction
"}}}
let s:t = themis#suite('fetch_imgpath_elements') "{{{
function! s:t.nothing_when_empty()
let arg = ''
let expected = s:empty_img_elements()
call s:assert.equals(previm#fetch_imgpath_elements(arg), expected)
endfunction
function! s:t.nothing_when_not_img_statement()
let arg = '## hogeほげ'
let expected = s:empty_img_elements()
call s:assert.equals(previm#fetch_imgpath_elements(arg), expected)
endfunction
function! s:t.get_alt_and_path()
let arg = '![IMG](path/img.png)'
let expected = {'alt': 'IMG', 'path': 'path/img.png', 'title': ''}
call s:assert.equals(previm#fetch_imgpath_elements(arg), expected)
endfunction
function! s:t.get_title_from_double_quote()
let arg = '![IMG](path/img.png "image")'
let expected = {'alt': 'IMG', 'path': 'path/img.png', 'title': 'image'}
call s:assert.equals(expected, previm#fetch_imgpath_elements(arg))
endfunction
function! s:t.get_title_from_single_quote()
let arg = "![IMG](path/img.png 'image')"
let expected = {'alt': 'IMG', 'path': 'path/img.png', 'title': 'image'}
call s:assert.equals(expected, previm#fetch_imgpath_elements(arg))
endfunction
function! s:empty_img_elements()
return {'alt': '', 'path': '', 'title': ''}
endfunction
"}}}
let s:t = themis#suite('refresh_css') "{{{
function! s:t.setup()
let self.exist_previm_disable_default_css = 0
if exists('g:previm_disable_default_css')
let self.tmp_previm_disable_default_css = g:previm_disable_default_css
let self.exist_previm_disable_default_css = 1
endif
let self.exist_previm_custom_css_path = 0
if exists('g:previm_custom_css_path')
let self.tmp_previm_custom_css_path = g:previm_custom_css_path
let self.exist_previm_custom_css_path = 1
endif
endfunction
function! s:t.teardown()
if self.exist_previm_disable_default_css
let g:previm_disable_default_css = self.tmp_previm_disable_default_css
else
unlet! g:previm_disable_default_css
endif
if self.exist_previm_custom_css_path
let g:previm_custom_css_path = self.tmp_previm_custom_css_path
else
unlet! g:previm_custom_css_path
endif
endfunction
function! s:t.default_content_if_not_exists_setting()
call previm#refresh_css()
let actual = readfile(previm#make_preview_file_path('css/previm.css'))
call s:assert.equals([
\ "@import url('origin.css');",
\ "@import url('lib/github.css');",
\ ], actual)
endfunction
function! s:t.default_content_if_invalid_setting()
let g:previm_disable_default_css = 2
call previm#refresh_css()
let actual = readfile(previm#make_preview_file_path('css/previm.css'))
call s:assert.equals([
\ "@import url('origin.css');",
\ "@import url('lib/github.css');",
\ ], actual)
endfunction
let s:base_dir = expand('<sfile>:p:h')
function! s:t.custom_content_if_exists_file()
let g:previm_disable_default_css = 1
let g:previm_custom_css_path = s:base_dir . '/dummy_user_custom.css'
call previm#refresh_css()
let actual = readfile(previm#make_preview_file_path('css/previm.css'))
call s:assert.equals(actual, ["@import url('user_custom.css');"])
endfunction
function! s:t.empty_if_not_exists_file()
let g:previm_disable_default_css = 1
let g:previm_custom_css_path = s:base_dir . '/not_exists.css'
call previm#refresh_css()
let actual = readfile(previm#make_preview_file_path('css/previm.css'))
call s:assert.equals(actual, [])
endfunction
"}}}

View File

@ -0,0 +1,46 @@
let s:t = themis#suite('valid filetype for using :PrevimOpen')
let s:assert = themis#helper('assert')
function! s:t.before()
let self._ft = &filetype
endfunction
function! s:t.after()
let &filetype = self._ft
call s:_clean_command()
endfunction
function! s:_clean_command()
if exists(':PrevimOpen') == 2
delcommand PrevimOpen
endif
endfunction
" helper
function! s:_assert_filetype(ft, expected)
let &filetype = a:ft
let actual = exists(':PrevimOpen')
if actual !=# a:expected
call s:assert.fail(printf("'%s': expected %d but actual %d", a:ft, a:expected, actual))
endif
endfunction
"""
function! s:t.invalid_filetype()
let not_exist_command = 0
for type in ['', 'rb', 'php']
call s:_assert_filetype(type, not_exist_command)
endfor
endfunction
function! s:t.valid_filetype()
let exist_command = 2
for type in [
\ 'markdown', 'mkd', 'rst', 'textile',
\ 'aaa.markdown', 'mkd.foo', 'bb.rst.cc', 'a.b.c.textile',
\]
call s:_assert_filetype(type, exist_command)
call s:_clean_command()
endfor
endfunction

View File

@ -54,17 +54,17 @@ compile their code or execute their script to find them.
At the time of this writing, syntastic has checking plugins for ActionScript,
Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, ASM,
BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq,
CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang,
eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars,
HSS, HTML, Jade, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM
intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C,
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and
iOS property lists, Puppet, Python, QML, R, Racket, Relax NG, reStructuredText,
RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX,
Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery,
YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] for details
about the corresponding supported checkers.
BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco,
Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir,
Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe,
Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP,
LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix,
Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML,
R, Racket, Relax NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim,
SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog,
VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, z80, Zope page templates, and
zsh. See the [wiki][3] for details about the corresponding supported checkers.
A number of third-party Vim plugins also provide checkers for syntastic,
for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12],

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.7.0-86'
let g:_SYNTASTIC_VERSION = '3.7.0-88'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1

View File

@ -68,6 +68,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'po': ['msgfmt'],
\ 'pod': ['podchecker'],
\ 'puppet': ['puppet', 'puppetlint'],
\ 'pug': ['pug_lint'],
\ 'python': ['python', 'flake8', 'pylint'],
\ 'qml': ['qmllint'],
\ 'r': [],

View File

@ -10,7 +10,7 @@
"============================================================================
if exists('g:loaded_syntastic_c_clang_check_checker')
finish
finish
endif
let g:loaded_syntastic_c_clang_check_checker = 1

View File

@ -10,7 +10,7 @@
"============================================================================
if exists('g:loaded_syntastic_c_clang_tidy_checker')
finish
finish
endif
let g:loaded_syntastic_c_clang_tidy_checker = 1

View File

@ -30,8 +30,8 @@ function! SyntaxCheckers_chef_foodcritic_GetLocList() dict
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'chef',
\ 'name': 'foodcritic'})
\ 'filetype': 'chef',
\ 'name': 'foodcritic'})
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -10,7 +10,7 @@
"============================================================================
if exists('g:loaded_syntastic_cpp_clang_check_checker')
finish
finish
endif
let g:loaded_syntastic_cpp_clang_check_checker = 1

View File

@ -10,7 +10,7 @@
"============================================================================
if exists('g:loaded_syntastic_cpp_clang_tidy_checker')
finish
finish
endif
let g:loaded_syntastic_cpp_clang_tidy_checker = 1

View File

@ -1,7 +1,7 @@
"============================================================================
"File: jade_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Ben Parnell <benjaminparnell.94@gmail.com>
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
@ -15,26 +15,10 @@ if exists('g:loaded_syntastic_jade_jade_lint_checker')
endif
let g:loaded_syntastic_jade_jade_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_jade_jade_lint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-r inline' })
let errorformat = '%f:%l:%c %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'jade',
\ 'name': 'jade_lint',
\ 'exec': 'jade-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
\ 'exec': 'jade-lint',
\ 'redirect': 'pug/pug_lint'})
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,40 @@
"============================================================================
"File: pug_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Ben Parnell <benjaminparnell.94@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_pug_pug_lint_checker')
finish
endif
let g:loaded_syntastic_pug_pug_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_pug_pug_lint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-r inline' })
let errorformat = '%f:%l:%c %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'pug',
\ 'name': 'pug_lint',
\ 'exec': 'pug-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -40,7 +40,7 @@ function! airline#themes#lucius#refresh()
let g:airline#themes#lucius#palette.visual.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning
let g:airline#themes#lucius#palette.visual_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning
let s:IA = airline#themes#get_highlight('StatusLineNC')
let s:IA = airline#themes#get_highlight('CursorLine')
let g:airline#themes#lucius#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
let g:airline#themes#lucius#palette.inactive_modified = {
\ 'airline_c': [ modified_group[0], '', modified_group[2], '', '' ]

View File

@ -5,6 +5,7 @@ let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0)
if s:taboo
let g:taboo_tabline = 0
@ -47,7 +48,7 @@ function! s:update_tabline()
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
return
" return, if buffer matches ignore pattern or is directory (netrw)
elseif empty(match)
elseif empty(match)
\ || match(match, s:ignore_bufadd_pat) > -1
\ || isdirectory(expand("<afile>"))
return
@ -57,11 +58,6 @@ function! s:update_tabline()
endif
call feedkeys("\<Plug>AirlineTablineRefresh")
call feedkeys("\<Plug>AirlineTablineRefresh")
"call feedkeys(',,', 't')
"call feedkeys(':unmap ,,')
" force re-evaluation of tabline setting
" disable explicit redraw, may cause E315
"redraw
endfunction
function! airline#extensions#tabline#load_theme(palette)
@ -92,6 +88,7 @@ function! airline#extensions#tabline#load_theme(palette)
" Theme for tabs on the right
let l:tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
let l:tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
let l:tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
let l:tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
@ -100,6 +97,7 @@ function! airline#extensions#tabline#load_theme(palette)
"Fall back to normal airline_c if modified airline_c isn't present
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
endif
call airline#highlighter#exec('airline_tab_right', l:tab_right)
call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right)
call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right)
call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right)
@ -163,3 +161,23 @@ function! airline#extensions#tabline#new_builder()
return airline#builder#new(builder_context)
endfunction
function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
let cur = bufnr('%')
if cur == a:bufnr
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
let group = 'airline_tabmod'
else
let group = 'airline_tabsel'
endif
else
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
let group = 'airline_tabmod_unsel'
elseif index(a:tab_bufs, a:bufnr) > -1
let group = 'airline_tab'
else
let group = 'airline_tabhid'
endif
endif
return group
endfunction

View File

@ -5,6 +5,7 @@ scriptencoding utf-8
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let s:spc = g:airline_symbols.space
let s:current_bufnr = -1
@ -64,23 +65,8 @@ function! airline#extensions#tabline#buffers#get()
continue
endif
if cur == nr
if g:airline_detect_modified && getbufvar(nr, '&modified')
let group = 'airline_tabmod'
else
let group = 'airline_tabsel'
endif
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
else
if g:airline_detect_modified && getbufvar(nr, '&modified')
let group = 'airline_tabmod_unsel'
elseif index(tab_bufs, nr) > -1
let group = 'airline_tab'
else
let group = 'airline_tabhid'
endif
endif
let group = airline#extensions#tabline#group_of_bufnr(tab_bufs, nr)
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
if s:buffer_idx_mode
if len(s:number_map) > 0
call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
@ -97,7 +83,7 @@ function! airline#extensions#tabline#buffers#get()
call b.split()
call b.add_section('airline_tabfill', '')
if s:show_tab_type
call b.add_section('airline_tabtype', ' buffers ')
call b.add_section_spaced('airline_tabtype', s:buffers_label)
endif
let s:current_bufnr = cur

View File

@ -7,6 +7,9 @@ let s:current_bufnr = -1
let s:current_tabnr = -1
let s:current_tabline = ''
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
function! airline#extensions#tabline#ctrlspace#off()
augroup airline_tabline_ctrlspace
autocmd!
@ -41,7 +44,7 @@ function! airline#extensions#tabline#ctrlspace#get()
let b = airline#extensions#tabline#new_builder()
call b.add_section_spaced('airline_tabtype', 'buffers')
call b.add_section_spaced('airline_tabtype', s:buffers_label)
let s:buffer_list = ctrlspace#api#BufferList(cur_tab)
for buffer in s:buffer_list
@ -88,7 +91,7 @@ function! airline#extensions#tabline#ctrlspace#get()
call b.add_section_spaced(group, tab.title.ctrlspace#api#TabBuffersNumber(tab.index))
endfor
call b.add_section_spaced('airline_tabtype', 'tabs')
call b.add_section_spaced('airline_tabtype', s:tabs_label)
let s:current_bufnr = cur_buf
let s:current_tabnr = cur_tab

View File

@ -1,11 +1,14 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1)
let s:spc = g:airline_symbols.space
let s:current_bufnr = -1
let s:current_tabnr = -1
@ -39,19 +42,20 @@ function! airline#extensions#tabline#tabs#get()
endif
let b = airline#extensions#tabline#new_builder()
for i in range(1, tabpagenr('$'))
if i == curtab
let group = 'airline_tabsel'
let group = 'airline_tabsel_right'
if g:airline_detect_modified
for bi in tabpagebuflist(i)
if getbufvar(bi, '&modified')
let group = 'airline_tabmod'
let group = 'airline_tabmod_right'
endif
endfor
endif
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
let s:current_modified = (group == 'airline_tabmod_right') ? 1 : 0
else
let group = 'airline_tab'
let group = 'airline_tab_right'
endif
let val = '%('
if s:show_tab_nr
@ -66,14 +70,22 @@ function! airline#extensions#tabline#tabs#get()
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
endfor
call b.add_raw('%T')
call b.add_section('airline_tabfill', '')
call b.split()
call b.add_section('airline_tabfill', '')
if s:show_close_button
call b.add_section('airline_tab', ' %999X'.s:close_symbol.' ')
call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ')
endif
if s:show_tab_type
call b.add_section('airline_tabtype', ' tabs ')
if s:show_splits == 1
let buffers = tabpagebuflist(curtab)
for nr in buffers
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr)
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
endfor
elseif s:show_tab_type == 1
call b.add_section_spaced('airline_tabtype', s:tabs_label)
endif
let s:current_bufnr = curbuf

View File

@ -518,9 +518,15 @@ eclim <https://eclim.org>
* enable/disable displaying index of the buffer.
Note: If you're using ctrlspace the tabline shows your tabs on the right and
buffer on the left. Also none of the tabline switches is currently
buffer on the left. Also none of the above tabline switches is currently
supported!
* rename label for buffers (default: 'buffers')
let g:airline#extensions#tabline#buffers_label = 'b'
* rename label for tabs (default: 'tabs')
let g:airline#extensions#tabline#tabs_label = 't'
When enabled, numbers will be displayed in the tabline and mappings will be
exposed to allow you to select a buffer directly. Up to 9 mappings will be
exposed. >

View File

@ -16,6 +16,7 @@ mayansmoke https://github.com/vim-scripts/mayansmoke
nerdtree https://github.com/scrooloose/nerdtree
nginx.vim https://github.com/vim-scripts/nginx.vim
open_file_under_cursor.vim https://github.com/amix/open_file_under_cursor.vim
previm https://github.com/kannokanno/previm
snipmate-snippets https://github.com/scrooloose/snipmate-snippets
tlib https://github.com/vim-scripts/tlib
vim-addon-mw-utils https://github.com/MarcWeber/vim-addon-mw-utils

View File

@ -85,6 +85,14 @@ map <leader>nb :NERDTreeFromBookmark
map <leader>nf :NERDTreeFind<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Previm - awesome markdown and mermaid interation!
" Remember - your file has to be set as type markdown.
" do this with :set ft=markdown
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" command is :PrevimOpen
let g:previm_open_cmd = 'open -a Safari'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => vim-multiple-cursors
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""