mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.0.0863: a remote command does not work in the terminal window
Problem: A remote command starting with CTRL-\ CTRL-N does not work in the terminal window. (Christian J. Robinson) Solution: Use CTRL-\ CTRL-N as a prefix or a Normal mode command.
This commit is contained in:
@@ -61,6 +61,11 @@ the job. For example:
|
|||||||
'termkey' . send a CTRL-W to the job in the terminal
|
'termkey' . send a CTRL-W to the job in the terminal
|
||||||
'termkey' N go to terminal Normal mode, see below
|
'termkey' N go to terminal Normal mode, see below
|
||||||
'termkey' CTRL-N same as CTRL-W N
|
'termkey' CTRL-N same as CTRL-W N
|
||||||
|
*t_CTRL-\_CTRL-N*
|
||||||
|
The special key combination CTRL-\ CTRL-N can be used to prefix one Normal
|
||||||
|
mode command. This is especially useful for remote commands, when you don't
|
||||||
|
know whether Vim currently has focus in a terminal window. Note that only one
|
||||||
|
Normal mode command can be used.
|
||||||
|
|
||||||
|
|
||||||
Size ~
|
Size ~
|
||||||
@@ -142,6 +147,23 @@ displayed.
|
|||||||
In Terminal mode the statusline and window title show "(Terminal)". If the
|
In Terminal mode the statusline and window title show "(Terminal)". If the
|
||||||
job ends while in Terminal mode this changes to "(Terminal-finished)".
|
job ends while in Terminal mode this changes to "(Terminal-finished)".
|
||||||
|
|
||||||
|
Environment variables are used to pass information to the running job:
|
||||||
|
TERM name of the terminal, 'term'
|
||||||
|
ROWS number of rows in the terminal initially
|
||||||
|
LINES same as ROWS
|
||||||
|
COLUMNS number of columns in the terminal initially
|
||||||
|
COLORS number of colors, 't_Co' (256*256*256 in the GUI)
|
||||||
|
VIM_SERVERNAME v:servername
|
||||||
|
|
||||||
|
The |client-server| feature can be used to communicate with the Vim instance
|
||||||
|
where the job was started. This only works when v:servername is not empty.
|
||||||
|
If needed you can set it with: >
|
||||||
|
call remote_startserver('vim-server')
|
||||||
|
|
||||||
|
In the job you can then do something like: >
|
||||||
|
vim --servername $VIM_SERVERNAME --remote +123 some_file.c
|
||||||
|
This will open the file "some_file.c" and put the cursor on line 123.
|
||||||
|
|
||||||
|
|
||||||
Unix ~
|
Unix ~
|
||||||
|
|
||||||
|
@@ -52,6 +52,9 @@
|
|||||||
* - make term_getcursor() return type (none/block/bar/underline) and
|
* - make term_getcursor() return type (none/block/bar/underline) and
|
||||||
* attributes (color, blink, etc.)
|
* attributes (color, blink, etc.)
|
||||||
* - To set BS correctly, check get_stty(); Pass the fd of the pty.
|
* - To set BS correctly, check get_stty(); Pass the fd of the pty.
|
||||||
|
* For the GUI fill termios with default values, perhaps like pangoterm:
|
||||||
|
* http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134
|
||||||
|
* Also get the NL behavior from there.
|
||||||
* - do not store terminal window in viminfo. Or prefix term:// ?
|
* - do not store terminal window in viminfo. Or prefix term:// ?
|
||||||
* - add a character in :ls output
|
* - add a character in :ls output
|
||||||
* - add 't' to mode()
|
* - add 't' to mode()
|
||||||
@@ -64,7 +67,8 @@
|
|||||||
* - support minimal size when 'termsize' is "rows*cols".
|
* - support minimal size when 'termsize' is "rows*cols".
|
||||||
* - support minimal size when 'termsize' is empty?
|
* - support minimal size when 'termsize' is empty?
|
||||||
* - implement "term" for job_start(): more job options when starting a
|
* - implement "term" for job_start(): more job options when starting a
|
||||||
* terminal.
|
* terminal. Might allow reading stdin from a file or buffer, sending stderr
|
||||||
|
* to a file or /dev/null, but something must be connected to the terminal.
|
||||||
* - support ":term NONE" to open a terminal with a pty but not running a job
|
* - support ":term NONE" to open a terminal with a pty but not running a job
|
||||||
* in it. The pty can be passed to gdb to run the executable in.
|
* in it. The pty can be passed to gdb to run the executable in.
|
||||||
* - if the job in the terminal does not support the mouse, we can use the
|
* - if the job in the terminal does not support the mouse, we can use the
|
||||||
@@ -862,6 +866,8 @@ term_vgetc()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Send keys to terminal.
|
* Send keys to terminal.
|
||||||
|
* Return FAIL when the key needs to be handled in Normal mode.
|
||||||
|
* Return OK when the key was dropped or sent to the terminal.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
send_keys_to_term(term_T *term, int c, int typed)
|
send_keys_to_term(term_T *term, int c, int typed)
|
||||||
@@ -1038,7 +1044,7 @@ terminal_loop(void)
|
|||||||
mch_stop_job(curbuf->b_term->tl_job, (char_u *)"quit");
|
mch_stop_job(curbuf->b_term->tl_job, (char_u *)"quit");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (c == (termkey == 0 ? Ctrl_W : termkey))
|
if (c == (termkey == 0 ? Ctrl_W : termkey) || c == Ctrl_BSL)
|
||||||
{
|
{
|
||||||
int prev_c = c;
|
int prev_c = c;
|
||||||
|
|
||||||
@@ -1054,7 +1060,15 @@ terminal_loop(void)
|
|||||||
/* job finished while waiting for a character */
|
/* job finished while waiting for a character */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (termkey == 0 && c == '.')
|
if (prev_c == Ctrl_BSL)
|
||||||
|
{
|
||||||
|
if (c == Ctrl_N)
|
||||||
|
/* CTRL-\ CTRL-N : execute one Normal mode command. */
|
||||||
|
return OK;
|
||||||
|
/* Send both keys to the terminal. */
|
||||||
|
send_keys_to_term(curbuf->b_term, prev_c, TRUE);
|
||||||
|
}
|
||||||
|
else if (termkey == 0 && c == '.')
|
||||||
{
|
{
|
||||||
/* "CTRL-W .": send CTRL-W to the job */
|
/* "CTRL-W .": send CTRL-W to the job */
|
||||||
c = Ctrl_W;
|
c = Ctrl_W;
|
||||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
863,
|
||||||
/**/
|
/**/
|
||||||
862,
|
862,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user