Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
272 lines (156 sloc) 7.79 KB
*vimconsole.txt* This is immediate-window for Vim script.
Author : rbtnn <naru123456789@gmail.com>
LICENSE: MIT license (see LICENSE.txt)
CONTENTS *vimconsole-contents*
Variables |vimconsole-variables|
Commands |vimconsole-commands|
Functions |vimconsole-functions|
Key Mappings |vimconsole-key-mappings|
FAQ |vimconsole-faq|
==============================================================================
This is Immediate Window for Vim script.
It is like Google Chrome Developer Console.
This use |PrettyPrint()| if install https://github.com/thinca/vim-prettyprint.
==============================================================================
VARIABLES *vimconsole-variables*
* g:vimconsole#split_rule *g:vimconsole#split_rule*
Split position rule. This can have one of following values.
default: 'bottom'
'top', 'bottom', 'right', 'left'
* g:vimconsole#width *g:vimconsole#width*
Use it as VimConsole's window width if the type is Number.
Use it evaluated as VimConsole's window width if the type is String.
default: '&columns / 2'
* g:vimconsole#height *g:vimconsole#height*
Use it as VimConsole's window height if the type is Number.
Use it evaluated as VimConsole's window height if the type is String.
default: '&lines / 2'
* g:vimconsole#auto_redraw *g:vimconsole#auto_redraw*
When print to VimConsole, call |vimconsole#redraw()|automatically.
default: 0
* g:vimconsole#enable_quoted_string *g:vimconsole#enable_quoted_string*
Print a string with single-quote, if its type is string.
default: 1
* g:vimconsole#hooks *g:vimconsole#looks*
This value is `{}`. This can have following keys.
Calling a hook function, does not call any hook function.
on_logged: This is a function reference.
If g:vimconsole#hooks has this key, call this after logging by
a logging function (vimconsole#log, vimconsole#warn,... ,etc.).
Example:
>
function! g:vimconsole#hooks.on_logged(context)
" `a:context`'s value is such as `{ 'tag' : 'vimconsole#assert' }`.
call vimconsole#log(a:context.tag)
endfunction
<
on_pre_redraw: This is a function reference.
If g:vimconsole#hooks has this key,
call this before redrawing VimConsole.
Example:
>
function! g:vimconsole#hooks.on_pre_redraw(context)
" `a:context`'s value is such as `{ 'tag' : 'vimconsole#redraw' }`.
call vimconsole#log(a:context.tag)
endfunction
<
on_post_redraw: This is a function reference.
If g:vimconsole#hooks has this key,
call this after redrawing VimConsole.
Example:
>
function! g:vimconsole#hooks.on_post_redraw(context)
" `a:context`'s value is such as `{ 'tag' : 'vimconsole#redraw' }`.
call vimconsole#log(a:context.tag)
endfunction
<
* g:vimconsole#eval_function_name *g:vimconsole#eval_function_name*
This value is a function name.
(signature: string -> string or string -> [string])
It is used for evaluate a character string from prompt.
default: 'eval'
Example:
>
" Use like a shell.
let g:vimconsole#eval_function_name = 'vimproc#system'
" VimConsole>ls
" README.md autoload doc plugin vimconsole.png
<
* g:vimconsole#no_default_key_mappings *g:vimconsole#no_default_key_mappings*
Does not set default key mappings.
* g:vimconsole#session_type *g:vimconsole#session_type*
This value is a session-type of vimconsole.vim.
session-type is one of values(`'t:'`,`'g:'`).
default: `'t:'`
* g:vimconsole#startinsert *g:vimconsole#startinsert*
This value is to start Insert mode on VimConsole.
==============================================================================
COMMANDS *vimconsole-commands*
* :VimConsoleLog {obj} *VimConsoleLog*
Print to VimConsole.
Same as `vimconsole#log({obj},...)`.
* :VimConsoleOpen[!] *VimConsoleOpen*
Open VimConsole if it is closed.
Do nothing when VimConsole is opened (don't call vimconsole#redraw).
If with bang, force call vimconsole#redraw.
* :VimConsoleClose *VimConsoleClose*
Close VimConsole.
* :VimConsoleToggle *VimConsoleToggle*
Toggle VimConsole.
* :VimConsoleClear *VimConsoleClear*
Clear logs of VimConsole.
* :VimConsoleRedraw[!] *VimConsoleRedraw*
Redraw VimConsole.
If with bang, call vimconsole#clear before to redraw.
==============================================================================
FUNCTIONS *vimconsole-functions*
* vimconsole#assert(expr,obj,...) *vimconsole#assert()*
It is like javascript's `console.assert({expr},{obj},...)`.
This behavior is printf({obj}, ...) to VimConsole if `0 < a:0`.
* vimconsole#log(obj,...) *vimconsole#log()*
It is like javascript's `console.log({obj},...)`.
This behavior is printf({obj}, ...) to VimConsole if `0 < a:0`.
* vimconsole#winopen([{bang}]) *vimconsole#winopen()*
Same as |VimConsoleOpen|.
* vimconsole#winclose() *vimconsole#winclose()*
Same as |VimConsoleClose|.
* vimconsole#wintoggle() *vimconsole#wintoggle()*
Same as |VimConsoleToggle|.
* vimconsole#clear() *vimconsole#clear()*
Same as |VimConsoleClear|.
* vimconsole#redraw([{bang}]) *vimconsole#redraw()*
Same as |VimConsoleRedraw|.
* vimconsole#is_open() *vimconsole#is_open()*
1 is returned if VimConsole is opened.
0 is returned if VimConsole is closed.
------------------------------------------------------------------------------
KEY MAPPINGS *vimconsole-key-mappings*
<Plug>(vimconsole_close) *<Plug>(vimconsole_close)*
Same as |VimConsoleClose|.
<Plug>(vimconsole_clear) *<Plug>(vimconsole_clear)*
Same as |VimConsoleClear|.
<Plug>(vimconsole_redraw) *<Plug>(vimconsole_redraw)*
Same as |VimConsoleRedraw|.
<Plug>(vimconsole_next_prompt) *<Plug>(vimconsole_next_prompt)*
Move to next prompt from cursor.
<Plug>(vimconsole_previous_prompt) *<Plug>(vimconsole_previous_prompt)*
Move to previous prompt from cursor.
==============================================================================
FAQ *vimconsole-faq*
Q: I want to fix highlight and syntax when reload `.vimrc`.
A: You can use below setting in `.vimrc`.
>
if vimconsole#is_open()
call vimconsole#winopen('!')
endif
<
Q: I want to scroll until the end of logs automatically.
A: You can use below setting in `.vimrc`.
>
let g:vimconsole#hooks = {}
function! g:vimconsole#hooks.on_post_redraw(context)
normal G$l
endfunction
<
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:
You can’t perform that action at this time.