diff --git a/sources_non_forked/vim-marked b/sources_non_forked/vim-marked deleted file mode 160000 index a7c1cba2..00000000 --- a/sources_non_forked/vim-marked +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a7c1cba232cabd96af800f82aad21cc180a09764 diff --git a/sources_non_forked/vim-marked/README.markdown b/sources_non_forked/vim-marked/README.markdown new file mode 100644 index 00000000..2ce98952 --- /dev/null +++ b/sources_non_forked/vim-marked/README.markdown @@ -0,0 +1,22 @@ +# marked.vim + +Open the current Markdown buffer in [Marked.app](http://markedapp.com/). + +## Usage + +This plugin adds the following commands to Markdown buffers: + + :MarkedOpen[!] Open the current Markdown buffer in Marked.app. + Call with a bang to prevent Marked.app from stealing + focus from Vim. + + :MarkedQuit Close the current Markdown buffer in Marked.app. + Quit Marked.app if no other documents are open. + +If you run `:MarkedOpen`, the document in Marked.app will be automatically +closed when Vim exists, and Marked.app will quit if no other documents are +open. + +## License + +Same as Vim itself, see `:help license`. diff --git a/sources_non_forked/vim-marked/plugin/marked.vim b/sources_non_forked/vim-marked/plugin/marked.vim new file mode 100644 index 00000000..1009d513 --- /dev/null +++ b/sources_non_forked/vim-marked/plugin/marked.vim @@ -0,0 +1,55 @@ +" marked.vim +" Author: Joshua Priddle +" URL: https://github.com/itspriddle/vim-marked +" Version: 0.4.0 +" License: Same as Vim itself (see :help license) + +if &cp || exists("g:marked_loaded") && g:marked_loaded + finish +endif +let g:marked_loaded = 1 +let s:save_cpo = &cpo +set cpo&vim + +function s:OpenMarked(background) + let l:filename = expand("%:p") + silent exe "!open -a Marked.app ".(a:background ? '-g' : '')." '".l:filename."'" + + silent exe "augroup marked_autoclose_".l:filename + autocmd! + silent exe 'autocmd VimLeavePre * call s:QuitMarked("'.l:filename.'")' + augroup END + redraw! +endfunction + +function s:QuitMarked(path) + silent exe "augroup marked_autoclose_".a:path + autocmd! + augroup END + silent exe "augroup! marked_autoclose_".a:path + + let cmd = " -e 'try'" + let cmd .= " -e 'if application \"Marked\" is running then'" + let cmd .= " -e 'tell application \"Marked\"'" + let cmd .= " -e 'close (first document whose path is equal to \"".a:path."\")'" + let cmd .= " -e 'if count of every window is equal to 0 then'" + let cmd .= " -e 'quit'" + let cmd .= " -e 'end if'" + let cmd .= " -e 'end tell'" + let cmd .= " -e 'end if'" + let cmd .= " -e 'end try'" + + silent exe "!osascript ".cmd + redraw! +endfunction + +augroup marked_commands + autocmd! + autocmd FileType markdown,mkd command! -buffer -bang MarkedOpen :call s:OpenMarked(0) + autocmd FileType markdown,mkd command! -buffer MarkedQuit :call s:QuitMarked(expand('%:p')) +augroup END + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:ft=vim:fdm=marker:ts=2:sw=2:sts=2:et