Permalink
Browse files

retab, cleanup

1 parent 9784b97 commit dea6f3585684eab5b4f39667193e09c77eb85dc7 @tangledhelix committed Nov 5, 2012
Showing with 63 additions and 55 deletions.
  1. +12 −8 README.md
  2. +7 −7 doc/octopress.txt
  3. +2 −3 ftplugin/octopress.vim
  4. +24 −19 plugin/octopress.vim
  5. +18 −18 syntax/octopress.vim
View
@@ -9,17 +9,21 @@ If you use [Pathogen][] (and you really should):
[pathogen]: https://github.com/tpope/vim-pathogen
- cd ~/.vim/bundle
- git clone https://github.com/tangledhelix/vim-octopress.git octopress
+```
+cd ~/.vim/bundle
+git clone https://github.com/tangledhelix/vim-octopress.git octopress
+```
To install the old-fashioned way:
- git clone https://github.com/tangledhelix/vim-octopress.git
- cd vim-octopress
- for i in ftplugin syntax ; do
- mkdir -p ~/.vim/$i
- cp $i/octopress.vim ~/.vim/$i
- done
+```
+git clone https://github.com/tangledhelix/vim-octopress.git
+cd vim-octopress
+for i in ftplugin syntax; do
+ mkdir -p ~/.vim/$i
+ cp $i/octopress.vim ~/.vim/$i
+done
+```
For more information, see `:help octopress`
View
@@ -18,14 +18,14 @@ https://github.com/tangledhelix/vim-octopress
*g:octopress_default_format* *octopress-default-format*
By default, Octopress will assume a file's base syntax is Markdown, unless:
- - The filename ends in .textile, which will switch to Textile mode
- - The buffer is unnamed and "g:octopress_default_format" is "textile"
+ - The filename ends in .textile, which will switch to Textile mode
+ - The buffer is unnamed and 'g:octopress_default_format' is 'textile'
Example:
- let g:octopress_default_format = "textile"
+ let g:octopress_default_format = 'textile'
-The default format is "markdown" unless otherwise specified.
+The default format is 'markdown' unless otherwise specified.
*octopress-textile*
Though the default format is Markdown, Textile is supported as well. You
@@ -61,8 +61,8 @@ The :Octopress command
clean Clean caches (pygments, gist, sass)
*g:octopress_rake_executable*
-By default, "rake" is taken from your path. If you want to use a different
-rake, specify its path in octopress_rake_executable.
+By default, 'rake' is taken from your path. If you want to use a different
+rake, specify its path in 'g:octopress_rake_executable'.
- let g:octopress_rake_executable = "/path/to/rake"
+ let g:octopress_rake_executable = '/path/to/rake'
View
@@ -3,13 +3,12 @@
" Maintainer: Dan Lowe (dan@tangledhelix.com)
" URL: https://github.com/tangledhelix/vim-octopress
-if exists("b:did_ftplugin")
- finish
+if exists('b:did_ftplugin')
+ finish
endif
" This mostly loads HTML-related code, so it should not interfere
" with Textile.
runtime! ftplugin/markdown.vim
-
unlet! b:did_ftplugin
View
@@ -1,35 +1,40 @@
" octopress.vim - Wrapper for Octopress Rake commands
" Language: Octopress (Markdown/Textile with Liquid)
-" Maintainer: Dan Lowe <dan@tangledhelix.com>
+" Maintainer: Dan Lowe (dan@tangledhelix.com)
" URL: https://github.com/tangledhelix/vim-octopress
+"
+" TODO: store state of swapfile, then restore it.
+" only change state if it was set previously.
-if exists("g:loaded_octopress") || &cp
- finish
+if exists('g:loaded_octopress') || &cp
+ finish
endif
let g:loaded_octopress = 1
-if !exists("g:octopress_rake_executable")
- let g:octopress_rake_executable = "rake"
+if exists('g:octopress_rake_executable')
+ let b:octopress_rake_executable = g:octopress_rake_executable
+else
+ let b:octopress_rake_executable = 'rake'
endif
function! s:Octopress(task)
- redraw!
- if a:task == "watch" || a:task == "preview"
- echo "Sorry, background tasks are not supported."
- return
- elseif a:task == "generate" || a:task == "deploy" || a:task == "gen_deploy" || a:task == "push" || a:task == "rsync" || a:task == "clean"
- if a:task == "deploy" || a:task == "gen_deploy" || a:task == "rsync"
- execute "set noswapfile"
- endif
- execute "!rake " . a:task
- else
- echo "I don't know about that Octopress task."
- endif
- redraw!
+ redraw!
+ if a:task == 'watch' || a:task == 'preview'
+ echo 'Sorry, background tasks are not supported.'
+ return
+ elseif a:task == 'generate' || a:task == 'deploy' || a:task == 'gen_deploy' || a:task == 'push' || a:task == 'rsync' || a:task == 'clean'
+ if a:task == 'deploy' || a:task == 'gen_deploy' || a:task == 'rsync'
+ execute 'set noswapfile'
+ endif
+ execute '!' . b:octopress_rake_executable . ' ' . a:task
+ else
+ echo 'I don't know about that Octopress task.'
+ endif
+ redraw!
endfunction
function! s:Complete(ArgLead, CmdLine, CursorPos)
- return "clean\ndeploy\ngen_deploy\ngenerate\npush\nrsync\n"
+ return "clean\ndeploy\ngen_deploy\ngenerate\npush\nrsync\n"
endfunction
command! -bang -nargs=* -complete=custom,s:Complete Octopress call s:Octopress(<q-args>)
View
@@ -1,33 +1,33 @@
" Vim syntax file
" Language: Octopress (Markdown/Textile with Liquid)
-" Maintainer: Dan Lowe <dan@tangledhelix.com>
+" Maintainer: Dan Lowe (dan@tangledhelix.com)
" URL: https://github.com/tangledhelix/vim-octopress
-if exists("b:current_syntax")
- finish
+if exists('b:current_syntax')
+ finish
endif
-if !exists("g:octopress_default_format")
- let g:octopress_default_format = "markdown"
+if !exists('g:octopress_default_format')
+ let g:octopress_default_format = 'markdown'
endif
-let b:filename = expand("%:t")
+let b:filename = expand('%:t')
if empty(b:filename)
- let b:octopress_filetype = g:octopress_default_format
+ let b:octopress_filetype = g:octopress_default_format
else
- let b:octopress_fname_result = matchlist(b:filename, '\m\.\([^.]\+\)$')
- let b:octopress_fname_exten = b:octopress_fname_result[1]
- if b:octopress_fname_exten == "textile"
- let b:octopress_filetype = "textile"
- else
- let b:octopress_filetype = "markdown"
- endif
+ let b:octopress_fname_result = matchlist(b:filename, '\m\.\([^.]\+\)$')
+ let b:octopress_fname_exten = b:octopress_fname_result[1]
+ if b:octopress_fname_exten == 'textile'
+ let b:octopress_filetype = 'textile'
+ else
+ let b:octopress_filetype = 'markdown'
+ endif
endif
-if b:octopress_filetype == "textile"
- runtime! syntax/textile.vim
+if b:octopress_filetype == 'textile'
+ runtime! syntax/textile.vim
else
- runtime! syntax/markdown.vim
+ runtime! syntax/markdown.vim
endif
unlet! b:current_syntax
@@ -63,5 +63,5 @@ HiLink octopressBacktickBlock Underlined
delcommand HiLink
-let b:current_syntax = "octopress"
+let b:current_syntax = 'octopress'

0 comments on commit dea6f35

Please sign in to comment.