mirror of
https://github.com/akelge/zsh
synced 2025-07-04 21:49:05 +00:00
Added GetLatestScript update plugin and updated all plugins
This commit is contained in:
@ -3,15 +3,60 @@
|
||||
The ConqueTerm plugin will turn a Vim buffer into a terminal emulator, allowing
|
||||
you to run and interact with a shell or shell application inside the buffer.
|
||||
|
||||
1. Installation |conque-term-installation|
|
||||
2. Usage |conque-term-usage|
|
||||
3. Config Options |conque-term-options|
|
||||
4. VimScript API |conque-term-api|
|
||||
5. Misc |conque-term-misc|
|
||||
1. Installation |conque-term-setup|
|
||||
1.1 Requirements for Unix |conque-term-requirements|
|
||||
1.2 Requirements for Windows |conque-term-windows|
|
||||
1.3 Installation |conque-term-installation|
|
||||
2. Usage |conque-term-usage|
|
||||
2.1 General Usage |conque-term-gen-usage|
|
||||
2.2 Special keys |conque-term-special-keys|
|
||||
2.2.1 Send text to Conque |conque-term-send|
|
||||
2.2.2 Toggle terminal input mode |conque-term-input-mode|
|
||||
2.2.3 Sending the <Esc> key press |conque-term-esc|
|
||||
3. Configuration |conque-term-options|
|
||||
3.1 General |conque-config-general|
|
||||
3.1.1 Python version |ConqueTerm_PyVersion|
|
||||
3.1.2 Fast mode |ConqueTerm_FastMode|
|
||||
3.1.3 Color support |ConqueTerm_Color|
|
||||
3.1.4 Session Support |ConqueTerm_SessionSupport|
|
||||
3.1.5 Keep updating terminal buffer |ConqueTerm_ReadUnfocused|
|
||||
3.1.6 Insert mode when entering buffer |ConqueTerm_InsertOnEnter|
|
||||
3.1.7 Close buffer when program exits |ConqueTerm_CloseOnEnd|
|
||||
3.1.8 Hide start messages |ConqueTerm_StartMessages|
|
||||
3.1.9 Regex for highlighting your prompt |ConqueTerm_PromptRegex|
|
||||
3.1.10 Syntax type |ConqueTerm_Syntax|
|
||||
3.2 Keyboard |conque-config-keyboard|
|
||||
3.2.1 The <Esc> key |ConqueTerm_EscKey|
|
||||
3.2.2 Toggle terminal input mode |ConqueTerm_ToggleKey|
|
||||
3.2.3 Enable <C-w> in insert mode |ConqueTerm_CWInsert|
|
||||
3.2.4 Execute current file in Conque |ConqueTerm_ExecFileKey|
|
||||
3.2.5 Send current file contents to Conque|ConqueTerm_SendFileKey|
|
||||
3.2.6 Send selected text to Conque |ConqueTerm_SendVisKey|
|
||||
3.2.7 Function Keys |ConqueTerm_SendFunctionKeys|
|
||||
3.3 Unix |conque-config-unix|
|
||||
3.3.1 Choose your terminal type |ConqueTerm_TERM|
|
||||
3.4 Windows |conque-config-windows|
|
||||
3.4.1 Python executable |ConqueTerm_PyExe|
|
||||
3.4.2 Windows character code page |ConqueTerm_CodePage|
|
||||
3.4.3 Terminal color method |ConqueTerm_ColorMode|
|
||||
4. VimScript API |conque-term-api|
|
||||
4.1 conque_term#open() |conque-term-open|
|
||||
4.2 conque_term#subprocess() |conque-term-subprocess|
|
||||
4.3 conque_term#get_instance() |conque-term-get-instance|
|
||||
4.4 CONQUE_OBJECT.write() |conque-term-write|
|
||||
4.5 CONQUE_OBJECT.writeln() |conque-term-writeln|
|
||||
4.6 CONQUE_OBJECT.read() |conque-term-read|
|
||||
4.7 CONQUE_OBJECT.set_callback() |conque-term-set-callback|
|
||||
4.8 CONQUE_OBJECT.close() |conque-term-close|
|
||||
4.9 Registering functions |conque-term-events|
|
||||
5. Misc |conque-term-misc|
|
||||
5.1 Known bugs |conque-term-bugs|
|
||||
5.2 Contribute |conque-term-contribute|
|
||||
5.3 Feedback |conque-term-feedback|
|
||||
|
||||
==============================================================================
|
||||
|
||||
1. Installation *conque-term-installation*
|
||||
1. Installation *conque-term-setup*
|
||||
|
||||
Conque is designed for both Unix and Windows operating systems, however the
|
||||
requirements are slightly different. Please check section below corresponding
|
||||
@ -49,7 +94,7 @@ If you are compiling Vim + Python from source on Windows, the requirements
|
||||
become only Vim 7.3+ and Python 2.7+.
|
||||
|
||||
|
||||
1.3 Installation *conque-term-installation-instructions*
|
||||
1.3 Installation *conque-term-installation*
|
||||
|
||||
Download the latest vimball from http://conque.googlecode.com
|
||||
|
||||
@ -66,6 +111,8 @@ installed.
|
||||
|
||||
2. Usage *conque-term-usage*
|
||||
|
||||
2.1 General Usage *conque-term-gen-usage*
|
||||
|
||||
Type :ConqueTerm <command> to launch an application in the current buffer. Eg:
|
||||
>
|
||||
:ConqueTerm bash
|
||||
@ -85,21 +132,30 @@ scroll back through the history. Most all Vim functionality will work, such
|
||||
as searching, yanking or highlighting text.
|
||||
|
||||
|
||||
2.1 Special keys *conque-term-special-keys*
|
||||
2.2 Special keys *conque-term-special-keys*
|
||||
|
||||
There are several keys which can be configured to have special behavior with
|
||||
Conque.
|
||||
|
||||
Send text to Conque *conque-term-F9*
|
||||
2.2.1 Send text to Conque *conque-term-send*
|
||||
|
||||
If you want to send some text from a file you are editing in another buffer
|
||||
to be run in Conque, select the desired text visually then press the <F9>
|
||||
key. If you have multiple Conque buffers, the text will be sent to the most
|
||||
recently created buffer. Alternatively you can yank the text, switch to your
|
||||
terminal, then paste it with the normal 'p' key. This feature can be
|
||||
configured to use a different key with the |ConqueTerm_SendVisKey| option.
|
||||
Conque gives you three different commands to send text from a different
|
||||
buffer, probably a source code file, to the Conque terminal buffer. All three
|
||||
are configurable to use your choice of key combinations.
|
||||
|
||||
Toggle terminal input mode *conque-term-F8*
|
||||
To send a visually selected range of text to an existing terminal buffer,
|
||||
press the <F9> key.
|
||||
|
||||
To send the entire contents of the file you are editing to an existing
|
||||
terminal buffer, press the <F10> key.
|
||||
|
||||
Finally, to execute the current file in a new terminal buffer press the <F11>
|
||||
key. This will split the screen with a new Conque buffer. The file you are
|
||||
editing must be executable for this command to work.
|
||||
|
||||
See |conque-term-options| for information about configuring these commands.
|
||||
|
||||
2.2.2 Toggle terminal input mode *conque-term-input-mode*
|
||||
|
||||
If you want to use insert mode to edit the terminal screen, press <F8>. You
|
||||
will now be able to edit the terminal output freely without your cursor
|
||||
@ -112,17 +168,22 @@ until you press <F8> again to resume.
|
||||
You can configure Conque to use a different key with the |ConqueTerm_ToggleKey|
|
||||
option.
|
||||
|
||||
Sending the <Esc> key press *conque-term-Esc*
|
||||
2.2.3 Sending the <Esc> key press *conque-term-esc*
|
||||
|
||||
By default if you press the <Esc> key in a Conque buffer you will leave insert
|
||||
mode. But what if you want the key press to be sent to your terminal? There
|
||||
are two options. By default, pressing <Esc> twice will send one <Esc> key
|
||||
press to the terminal, while pressing it once will leave insert mode.
|
||||
mode. But what if you want the <Esc> character to be sent to your terminal?
|
||||
There are two options. By default, pressing <Esc> twice will send one <Esc>
|
||||
character to the terminal and you will remain in insert mode, while pressing
|
||||
it once will leave insert mode.
|
||||
|
||||
Alternatively you can use the |ConqueTerm_EscKey| option to choose a
|
||||
different key for leaving insert mode. If a custom key is set, then all <Esc>
|
||||
key presses will be sent to the terminal.
|
||||
|
||||
2.3 Registering functions *conque-term-register*
|
||||
|
||||
Conque allows you to write your own VimScript functions which will be called
|
||||
at certain events. See the API section |conque-term-events| for more.
|
||||
|
||||
==============================================================================
|
||||
|
||||
@ -130,8 +191,75 @@ key presses will be sent to the terminal.
|
||||
|
||||
You can set the following options in your .vimrc (default values shown)
|
||||
|
||||
3.1 General *conque-config-general*
|
||||
|
||||
3.1 Insert mode when entering buffer *ConqueTerm_InsertOnEnter*
|
||||
3.1.1 Python version *ConqueTerm_PyVersion*
|
||||
|
||||
Conque will work with either Python 2.x or 3.x, assuming the interfaces have
|
||||
been installed. By default it will try to use Python 2 first, then will try
|
||||
Python 3. If you want Conque to use Python 3, set this variable to 3.
|
||||
|
||||
Note: even if you set this to 3, if you don't have the python3 interface
|
||||
Conque will fall back to using Python 2.
|
||||
>
|
||||
let g:ConqueTerm_PyVersion = 2
|
||||
<
|
||||
3.1.2 Fast Mode *ConqueTerm_FastMode*
|
||||
|
||||
Disable features which could make Conque run slowly. This includes most
|
||||
terminal colors and some unicode support. Set this to 1 to enable fast mode.
|
||||
>
|
||||
let g:ConqueTerm_FastMode = 0
|
||||
<
|
||||
3.1.3 Color support *ConqueTerm_Color*
|
||||
|
||||
Terminal colors have the potential to slow down terminal screen rendering,
|
||||
depending on how many colors are used and how fast the computer is. This
|
||||
option allows you to choose how much color support will be enabled.
|
||||
|
||||
If set to 0, terminal colors will be disabled. This will allow the terminal to
|
||||
render most quickly. Syntax highlighting will still work. For example
|
||||
highlighting quoted strings or MySQL output.
|
||||
|
||||
If set to 1, terminal colors will be enabled, but only for the most recent 200
|
||||
lines of terminal output. Older output will be periodically stripped of color
|
||||
highlighting to keep the display responsive.
|
||||
|
||||
If set to 2, terminal colors will always be enabled. If your programs don't
|
||||
use color output very frequently this is a good choice.
|
||||
|
||||
Note: Color support is automatically disabled in "fast mode".
|
||||
>
|
||||
let g:ConqueTerm_Color = 1
|
||||
<
|
||||
3.1.4 Session Support *ConqueTerm_SessionSupport*
|
||||
|
||||
Vim's :mksession command allows you to save your current buffer configuration
|
||||
to a file, which can be loaded at a later time after you've closed Vim.
|
||||
|
||||
By default, Conque buffers are not restored. This is mostly for safety
|
||||
reasons; you may not want Vim to automatically re-run a destructive command.
|
||||
|
||||
However, if you're not working with missile launch code, and want Vim to
|
||||
restart your Conque buffers when you load a session file, set this variable
|
||||
to 1. Note your original subprocess and shell output will not be restored, but
|
||||
the same command will be started in your buffer.
|
||||
>
|
||||
let g:ConqueTerm_SessionSupport = 0
|
||||
<
|
||||
3.1.5 Keep updating terminal buffer *ConqueTerm_ReadUnfocused*
|
||||
|
||||
If set to 1 then your Conque buffers will continue to update after you've
|
||||
switched to another buffer.
|
||||
|
||||
Note: Conque buffers may continue to update, but they will not scroll down as
|
||||
new lines are added beyond the bottom of the visible buffer area. This is a
|
||||
limitation of the Vim scripting language for which I haven't found a
|
||||
workaround.
|
||||
>
|
||||
let g:ConqueTerm_ReadUnfocused = 1
|
||||
<
|
||||
3.1.6 Insert mode when entering buffer *ConqueTerm_InsertOnEnter*
|
||||
|
||||
If set to 1 then you will automatically go into insert mode when you enter the
|
||||
buffer. This diverges from normal Vim behavior. If 0 you will still be in
|
||||
@ -139,17 +267,41 @@ normal mode.
|
||||
>
|
||||
let g:ConqueTerm_InsertOnEnter = 0
|
||||
<
|
||||
3.2 Enable <C-w> in insert mode *ConqueTerm_CWInsert*
|
||||
3.1.7 Close buffer when program exits *ConqueTerm_CloseOnEnd*
|
||||
|
||||
If set to 1 then you can leave the Conque buffer using the <C-w> commands
|
||||
while you're still in insert mode. If set to 0 then the <C-w> character will
|
||||
be sent to the terminal. If both this option and ConqueTerm_InsertOnEnter are
|
||||
set you can go in and out of the terminal buffer while never leaving insert
|
||||
mode.
|
||||
If you want your terminal buffer to be closed and permanently deleted when the
|
||||
program running inside of it exits, set this option to 1. Otherwise the buffer
|
||||
will become a simple text buffer after the program exits, and you can edit the
|
||||
program output in insert mode.
|
||||
>
|
||||
let g:ConqueTerm_CWInsert = 0
|
||||
let g:ConqueTerm_CloseOnEnd = 0
|
||||
<
|
||||
3.3 Use a custom key for leaving insert mode *ConqueTerm_EscKey*
|
||||
3.1.8 Show start messages *ConqueTerm_StartMessages*
|
||||
|
||||
Display warning messages when starting up ConqueTerm if your system is
|
||||
configured incorrectly.
|
||||
>
|
||||
let g:ConqueTerm_StartMessages = 1
|
||||
<
|
||||
3.1.9 Regex for highlighting your prompt *ConqueTerm_PromptRegex*
|
||||
|
||||
Use this regular expression for sytax highlighting your terminal prompt. Your
|
||||
terminal will generally run faster if you use Vim highlighting instead of
|
||||
terminal colors for your prompt. You can also use it to do more advanced
|
||||
syntax highlighting for the prompt line.
|
||||
>
|
||||
let g:ConqueTerm_PromptRegex = '^\w\+@[0-9A-Za-z_.-]\+:[0-9A-Za-z_./\~,:-]\+\$'
|
||||
<
|
||||
3.1.10 Choose Vim syntax type *ConqueTerm_Syntax*
|
||||
|
||||
Set the buffer syntax. The default 'conque' has highlighting for MySQL, but
|
||||
not much else.
|
||||
>
|
||||
let g:ConqueTerm_Syntax = 'conque'
|
||||
<
|
||||
3.2 Keyboard *conque-config-keyboard*
|
||||
|
||||
3.2.1 The <Esc> key *ConqueTerm_EscKey*
|
||||
|
||||
If a custom key is set, then all <Esc> key presses will be sent to the
|
||||
terminal and you must use this custom key to leave insert mode. If left to the
|
||||
@ -162,14 +314,7 @@ Picking a control key, such as <C-k> will be your best bet.
|
||||
>
|
||||
let g:ConqueTerm_EscKey = '<Esc>'
|
||||
<
|
||||
3.4 Send selected text to Conque *ConqueTerm_SendVisKey*
|
||||
|
||||
Use this key to send the currently selected text to the most recently created
|
||||
Conque buffer.
|
||||
>
|
||||
let g:ConqueTerm_SendVisKey = '<F9>'
|
||||
<
|
||||
3.5 Toggle terminal input mode *ConqueTerm_ToggleKey*
|
||||
3.2.2 Toggle terminal input mode *ConqueTerm_ToggleKey*
|
||||
|
||||
Press this key to pause terminal input and output display. You will then be
|
||||
able to edit the terminal screen as if it were a normal text buffer. Press
|
||||
@ -177,15 +322,52 @@ this key again to resume terminal mode.
|
||||
>
|
||||
let g:ConqueTerm_ToggleKey = '<F8>'
|
||||
<
|
||||
3.6 Enable or disable colors *ConqueTerm_Color*
|
||||
3.2.3 Enable <C-w> in insert mode *ConqueTerm_CWInsert*
|
||||
|
||||
Set to 1 to enable colors, 0 to disable. Syntax highlighting in Vim can be
|
||||
slow if your terminal is color intensive. Disabling color can make the
|
||||
terminal render significantly faster.
|
||||
If set to 1 then you can leave the Conque buffer using the <C-w> commands
|
||||
while you're still in insert mode. If set to 0 then the <C-w> character will
|
||||
be sent to the terminal. If both this option and ConqueTerm_InsertOnEnter are
|
||||
set you can go in and out of the terminal buffer while never leaving insert
|
||||
mode.
|
||||
>
|
||||
let g:ConqueTerm_Color = 1
|
||||
let g:ConqueTerm_CWInsert = 0
|
||||
<
|
||||
3.7 Choose your terminal type, Unix ONLY *ConqueTerm_TERM*
|
||||
3.2.4 Execute current file in Conque *ConqueTerm_ExecFileKey*
|
||||
|
||||
Press this key to execute the file you're currently editing in a Conque
|
||||
buffer. Is equivelent to running the command :ConqueTermSplit YOUR_FILE. Your
|
||||
file must be executable for this command to work correctly.
|
||||
>
|
||||
let g:ConqueTerm_ExecFileKey = '<F11>'
|
||||
<
|
||||
3.2.5 Send current file contents to Conque *ConqueTerm_SendFileKey*
|
||||
|
||||
Press this key to send your entire file contents to the most recently opened
|
||||
Conque buffer as keyboard input.
|
||||
>
|
||||
let g:ConqueTerm_SendFileKey = '<F10>'
|
||||
<
|
||||
3.2.6 Send selected text to Conque *ConqueTerm_SendVisKey*
|
||||
|
||||
Use this key to send the currently selected text to the most recently created
|
||||
Conque buffer.
|
||||
>
|
||||
let g:ConqueTerm_SendVisKey = '<F9>'
|
||||
<
|
||||
3.2.7 Function Keys *ConqueTerm_SendFunctionKeys*
|
||||
|
||||
By default, function keys (the F1-F12 row at the top of your keyboard) are not
|
||||
passed to the terminal. Set this option to 1 to send these key events.
|
||||
|
||||
Note: Unless you configured |ConqueTerm_SendVisKey| and |ConqueTerm_ToggleKey|
|
||||
to use different keys, <F8> and <F9> will not be sent to the terminal even if
|
||||
you set this option to 1.
|
||||
>
|
||||
let g:ConqueTerm_SendFunctionKeys = 0
|
||||
<
|
||||
3.3 Unix *conque-config-unix*
|
||||
|
||||
3.3.1 Choose your terminal type, Unix ONLY *ConqueTerm_TERM*
|
||||
|
||||
Use this option to tell Conque what type of terminal it should identify itself
|
||||
as. Conque officially uses the more limited VT100 terminal type for
|
||||
@ -197,55 +379,9 @@ results may vary depending on which programs you're running.
|
||||
>
|
||||
let g:ConqueTerm_TERM = 'vt100'
|
||||
<
|
||||
3.8 Choose Vim syntax type *ConqueTerm_Syntax*
|
||||
3.4 Windows *conque-config-windows*
|
||||
|
||||
Set the buffer syntax. The default 'conque' has highlighting for MySQL, but
|
||||
not much else.
|
||||
>
|
||||
let g:ConqueTerm_Syntax = 'conque'
|
||||
<
|
||||
3.9 Keep updating terminal buffer *ConqueTerm_ReadUnfocused*
|
||||
|
||||
If set to 1 then your Conque buffers will continue to update after you've
|
||||
switched to another buffer.
|
||||
|
||||
Note: Conque buffers may continue to update, but they will not scroll down as
|
||||
new lines are added beyond the bottom of the visible buffer area. This is a
|
||||
limitation of the Vim scripting language for which I haven't found a
|
||||
workaround.
|
||||
>
|
||||
let g:ConqueTerm_ReadUnfocused = 1
|
||||
<
|
||||
3.10 Regex for highlighting your prompt *ConqueTerm_PromptRegex*
|
||||
|
||||
Use this regular expression for sytax highlighting your terminal prompt. Your
|
||||
terminal will generally run faster if you use Vim highlighting instead of
|
||||
terminal colors for your prompt. You can also use it to do more advanced
|
||||
syntax highlighting for the prompt line.
|
||||
>
|
||||
let g:ConqueTerm_PromptRegex = '^\w\+@[0-9A-Za-z_.-]\+:[0-9A-Za-z_./\~,:-]\+\$'
|
||||
<
|
||||
3.11 Close buffer when program exits *ConqueTerm_CloseOnEnd*
|
||||
|
||||
If you want your terminal buffer to be closed and permanently deleted when the
|
||||
program running inside of it exits, set this option to 1. Otherwise the buffer
|
||||
will become a simple text buffer after the program exits, and you can edit the
|
||||
program output in insert mode.
|
||||
>
|
||||
let g:ConqueTerm_CloseOnEnd = 0
|
||||
<
|
||||
3.12 Python version *ConqueTerm_PyVersion*
|
||||
|
||||
Conque will work with either Python 2.x or 3.x, assuming the interfaces have
|
||||
been installed. By default it will try to use Python 2 first, then will try
|
||||
Python 3. If you want Conque to use Python 3, set this variable to 3.
|
||||
|
||||
Note: even if you set this to 3, if you don't have the python3 interface
|
||||
Conque will fall back to using Python 2.
|
||||
>
|
||||
let g:ConqueTerm_PyVersion = 2
|
||||
<
|
||||
3.13 Python executable, Windows ONLY *ConqueTerm_PyExe*
|
||||
3.4.1 Python executable, Windows ONLY *ConqueTerm_PyExe*
|
||||
|
||||
The Windows version of Conque needs to know the path to the python.exe
|
||||
executable for the version of Python Conque is using. If you installed Python
|
||||
@ -256,18 +392,27 @@ For example, you might set this to 'C:\Program Files\Python27\python.exe'
|
||||
>
|
||||
let g:ConqueTerm_PyExe = ''
|
||||
<
|
||||
3.14 Function Keys *ConqueTerm_SendFunctionKeys*
|
||||
3.4.2 Windows character code page *ConqueTerm_CodePage*
|
||||
|
||||
By default, function keys (the F1-F12 row at the top of your keyboard) are not
|
||||
passed to the terminal. Set this option to 1 to send these key events.
|
||||
Set the "code page" Windows will use for your console. Leave this value set to
|
||||
zero to use the environment code page.
|
||||
|
||||
Note: Unless you configured |ConqueTerm_SendVisKey| and |ConqueTerm_ToggleKey|
|
||||
to use different keys, <F8> and <F9> will not be sent to the terminal even if
|
||||
you set this option to 1.
|
||||
Note: Displaying unicode characters on Conque for Windows needs work.
|
||||
>
|
||||
let g:ConqueTerm_SendFunctionKeys = 0
|
||||
let g:ConqueTerm_CodePage = 0
|
||||
<
|
||||
3.4.3 Terminal color method, Windows ONLY *ConqueTerm_ColorMode*
|
||||
|
||||
Vim syntax highlighting by coordinate (e.g. the 3-7th characters on the 42nd
|
||||
line) can be very slow. If you set this variable to 'conceal', you can use
|
||||
the new conceal feature to render terminal colors. Requires Vim 7.3 and only
|
||||
works on the Windows version of Conque. This will make colors render faster,
|
||||
however it will also add hidden characters to the screen, which may be
|
||||
annoying if you're copying and pasting terminal output out of the Conque
|
||||
buffer. Set this to an empty string '' to disable concealed highlighting.
|
||||
>
|
||||
let g:ConqueTerm_ColorMode = 'conceal'
|
||||
<
|
||||
==============================================================================
|
||||
|
||||
4. VimScript API (Beta) *conque-term-api*
|
||||
@ -329,7 +474,7 @@ Example:
|
||||
>
|
||||
nnoremap <F4> :call conque_term#get_instance().writeln('clear')<CR>
|
||||
<
|
||||
4.4 CONQUE_OBJECT.write(text) *conque-term-write*
|
||||
4.4 CONQUE_OBJECT.write({text}) *conque-term-write*
|
||||
|
||||
Once you have a terminal object from open(), subprocess() or get_instance()
|
||||
you can send text input to it with the write() method.
|
||||
@ -341,7 +486,7 @@ Examples:
|
||||
call my_terminal.write("whoami\n")
|
||||
call my_terminal.write("\<C-c>")
|
||||
<
|
||||
4.5 CONQUE_OBJECT.writeln(text) *conque-term-writeln*
|
||||
4.5 CONQUE_OBJECT.writeln({text}) *conque-term-writeln*
|
||||
|
||||
The same as write() except adds a \n character to the end if your input.
|
||||
|
||||
@ -418,6 +563,45 @@ Example:
|
||||
call term.read(5000)
|
||||
call term.close()
|
||||
<
|
||||
4.9 Registering functions *conque-term-events*
|
||||
|
||||
Conque provides the option to register callback functions which will be
|
||||
executed at several different events. The currently available events are:
|
||||
|
||||
after_startup After your application has loaded into the buffer.
|
||||
buffer_enter When you switch to a Conque buffer.
|
||||
buffer_leave When you leave a Conque buffer.
|
||||
|
||||
You may use the function conque_term#register_function(event, function_name)
|
||||
to add additional hooks at a particular event. The second argument should be
|
||||
the name of a callback function which has one parameter, the current
|
||||
terminal object (see|conque-term-api|for more about terminal objects).
|
||||
|
||||
For example:
|
||||
>
|
||||
function MyConqueStartup(term)
|
||||
|
||||
" set buffer syntax using the name of the program currently running
|
||||
let syntax_associations = { 'ipython': 'python', 'irb': 'ruby' }
|
||||
|
||||
if has_key(syntax_associations, a:term.program_name)
|
||||
execute 'setlocal syntax=' . syntax_associations[a:term.program_name]
|
||||
else
|
||||
execute 'setlocal syntax=' . a:term.program_name
|
||||
endif
|
||||
|
||||
" shrink window height to 10 rows
|
||||
resize 10
|
||||
|
||||
" silly example of terminal api usage
|
||||
if a:term.program_name == 'bash'
|
||||
call a:term.writeln('svn up ~/projects/*')
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
call conque_term#register_function('after_startup', 'MyConqueStartup')
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
|
||||
|
Reference in New Issue
Block a user