Skip to content

Commit

Permalink
Add a post-writing hook
Browse files Browse the repository at this point in the history
  • Loading branch information
kana committed Mar 28, 2010
1 parent d5e0f1d commit 03c7e84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions autoload/metarw.vim
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ function! s:write(scheme, fakepath, line1, line2, event_name) "{{{2
if v:errmsg != ''
let _ = ['error', 'Failed to write: ' . v:errmsg]
endif

if _[0] != 'error' && 3 <= len(_)
execute _[2]
endif
endif
if _[0] !=# 'error'
\ && a:event_name ==# 'BufWriteCmd' && a:fakepath ==# bufname('')
Expand Down
7 changes: 7 additions & 0 deletions doc/metarw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ metarw#{scheme}#write({fakepath}, {line1}, {line2}, {append-p})
"write" The second item must be a string which
will be given to |:write| to write the
content of {fakepath}.

The third item is optional; if it is
given, it must be a string which is
a Vim script and it will be
|:execute|d after writing.
*metarw#{scheme}#write()-done*
"done" The rest items are just ignored. This
type means that writing is already
Expand Down Expand Up @@ -296,6 +301,8 @@ CHANGELOG *metarw-changelog*
- Refine the document.
- |metarw#{scheme}#write()|:
- Fix a bug that some kind of errors are not handled properly.
- Add a way to execute a script after writing. See
|metarw#{scheme}#write()-write| for the details.

0.0.3 2008-08-30T03:11:55+09:00 *metarw-changelog-0.0.3*
- |metarw#{scheme}#write()|:
Expand Down

0 comments on commit 03c7e84

Please sign in to comment.