Have option to dump hook output into new buffer
ahw opened this issue · comments
Andrew commented
Instead of just executing silently all the time. Sometimes you want to see the output of the hook script. It'd be cool if it put it in a new buffer and then put the cursor back to the window you were previously in so you could just execute :w
and watch this new buffer update.
http://vim.wikia.com/wiki/Display_output_of_shell_commands_in_new_window
Andrew commented
:help cmdline-ranges
Line numbers may be specified with: *:range* *E14* *{address}*
{number} an absolute line number
. the current line *:.*
$ the last line in the file *:$*
% equal to 1,$ (the entire file) *:%*
't position of mark t (lowercase) *:'*
'T position of mark T (uppercase); when the mark is in
another file it cannot be used in a range
/{pattern}[/] the next line where {pattern} matches *:/*
?{pattern}[?] the previous line where {pattern} matches *:?*
\/ the next line where the previously used search
pattern matches
\? the previous line where the previously used search
pattern matches
\& the next line where the previously used substitute
pattern matches
:help :silent
:sil[ent][!] {command} Execute {command} silently. Normal messages will not
be given or added to the message history.
When [!] is added, error messages will also be
skipped, and commands and mappings will not be aborted
when an error is detected. |v:errmsg| is still set.
When [!] is not used, an error message will cause
further messages to be displayed normally.
Redirection, started with |:redir|, will continue as
usual, although there might be small differences.
This will allow redirecting the output of a command
without seeing it on the screen. Example: >
:redir >/tmp/foobar
:silent g/Aap/p
:redir END
< To execute a Normal mode command silently, use the
|:normal| command. For example, to search for a
string without messages: >
:silent exe "normal /path\<CR>"
< ":silent!" is useful to execute a command that may
fail, but the failure is to be ignored. Example: >
:let v:errmsg = ""
:silent! /^begin
:if v:errmsg != ""
: ... pattern was not found
< ":silent" will also avoid the hit-enter prompt. When
using this for an external command, this may cause the
screen to be messed up. Use |CTRL-L| to clean it up
then.
":silent menu ..." defines a menu that will not echo a
Command-line command. The command will still produce
messages though. Use ":silent" in the command itself
to avoid that: ":silent menu .... :silent command".
Andrew commented
Finished in https://github.com/ahw/vim-hooks/releases/tag/1.4.0. It's pretty awesome.