0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

updated for version 7.0171

This commit is contained in:
Bram Moolenaar 2005-12-16 21:49:31 +00:00
parent bca84a12bd
commit 12033fb4bf
8 changed files with 69 additions and 38 deletions

View File

@ -1,9 +1,10 @@
" Vim Plugin: Edit the file with an existing Vim if possible " Vim Plugin: Edit the file with an existing Vim if possible
" Maintainer: Bram Moolenaar " Maintainer: Bram Moolenaar
" Last Change: 2005 Dec 11 " Last Change: 2005 Dec 15
" This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32) " This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
" $VIM/vimfiles/plugin directory. " $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you
" automatically use the latest version.
" This plugin serves two purposes: " This plugin serves two purposes:
" 1. On startup, if we were invoked with one file name argument and the file " 1. On startup, if we were invoked with one file name argument and the file
@ -43,6 +44,7 @@ func s:EditElsewhere(filename)
endif endif
call remote_expr(servername, "foreground()") call remote_expr(servername, "foreground()")
if remote_expr(servername, "exists('*EditExisting')")
" Make sure the file is visible in a window (not hidden). " Make sure the file is visible in a window (not hidden).
" If v:swapcommand exists and is set, send it to the server. " If v:swapcommand exists and is set, send it to the server.
if exists("v:swapcommand") if exists("v:swapcommand")
@ -51,6 +53,7 @@ func s:EditElsewhere(filename)
else else
call remote_expr(servername, "EditExisting('" . fname_esc . "', '')") call remote_expr(servername, "EditExisting('" . fname_esc . "', '')")
endif endif
endif
if !(has('vim_starting') && has('gui_running') && has('gui_win32')) if !(has('vim_starting') && has('gui_running') && has('gui_win32'))
" Tell the user what is happening. Not when the GUI is starting " Tell the user what is happening. Not when the GUI is starting

View File

@ -2,7 +2,7 @@
" Language: sed " Language: sed
" Maintainer: Haakon Riiser <hakonrk@fys.uio.no> " Maintainer: Haakon Riiser <hakonrk@fys.uio.no>
" URL: http://folk.uio.no/hakonrk/vim/syntax/sed.vim " URL: http://folk.uio.no/hakonrk/vim/syntax/sed.vim
" Last Change: 2003 May 11 " Last Change: 2005 Dec 15
" For version 5.x: Clear all syntax items " For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded " For version 6.x: Quit when a syntax file was already loaded
@ -21,7 +21,7 @@ syn match sedAddress "\d\+\~\d\+"
syn region sedAddress matchgroup=Special start="[{,;]\s*/\(\\/\)\="lc=1 skip="[^\\]\(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta syn region sedAddress matchgroup=Special start="[{,;]\s*/\(\\/\)\="lc=1 skip="[^\\]\(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta
syn region sedAddress matchgroup=Special start="^\s*/\(\\/\)\=" skip="[^\\]\(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta syn region sedAddress matchgroup=Special start="^\s*/\(\\/\)\=" skip="[^\\]\(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta
syn match sedComment "^\s*#.*$" syn match sedComment "^\s*#.*$"
syn match sedFunction "[dDgGhHlnNpPqx=]\s*\($\|;\)" contains=sedSemicolon,sedWhitespace syn match sedFunction "[dDgGhHlnNpPqQx=]\s*\($\|;\)" contains=sedSemicolon,sedWhitespace
syn match sedLabel ":[^;]*" syn match sedLabel ":[^;]*"
syn match sedLineCont "^\(\\\\\)*\\$" contained syn match sedLineCont "^\(\\\\\)*\\$" contained
syn match sedLineCont "[^\\]\(\\\\\)*\\$"ms=e contained syn match sedLineCont "[^\\]\(\\\\\)*\\$"ms=e contained

View File

@ -681,6 +681,7 @@ goto_buffer(eap, start, dir, count)
/* Quitting means closing the split window, nothing else. */ /* Quitting means closing the split window, nothing else. */
win_close(curwin, TRUE); win_close(curwin, TRUE);
swap_exists_action = SEA_NONE; swap_exists_action = SEA_NONE;
swap_exists_did_quit = TRUE;
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
/* Restore the error/interrupt/exception state if not discarded by a /* Restore the error/interrupt/exception state if not discarded by a
@ -719,6 +720,7 @@ handle_swap_exists(old_curbuf)
* buffer. If that buffer is gone or the same as the current one, * buffer. If that buffer is gone or the same as the current one,
* open a new, empty buffer. */ * open a new, empty buffer. */
swap_exists_action = SEA_NONE; /* don't want it again */ swap_exists_action = SEA_NONE; /* don't want it again */
swap_exists_did_quit = TRUE;
close_buffer(curwin, curbuf, DOBUF_UNLOAD); close_buffer(curwin, curbuf, DOBUF_UNLOAD);
if (!buf_valid(old_curbuf) || old_curbuf == curbuf) if (!buf_valid(old_curbuf) || old_curbuf == curbuf)
old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED); old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
@ -4402,6 +4404,7 @@ ex_buffer_all(eap)
win_close(curwin, TRUE); win_close(curwin, TRUE);
--open_wins; --open_wins;
swap_exists_action = SEA_NONE; swap_exists_action = SEA_NONE;
swap_exists_did_quit = TRUE;
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
/* Restore the error/interrupt/exception state if not /* Restore the error/interrupt/exception state if not

View File

@ -2108,7 +2108,7 @@ op_colon(oap)
} }
/* /*
* Handle the "gy" operator: call 'operatorfunc'. * Handle the "g@" operator: call 'operatorfunc'.
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
void void
@ -7724,7 +7724,7 @@ nv_g_cmd(cap)
* "gu" Change text to lower case. * "gu" Change text to lower case.
* "gU" Change text to upper case. * "gU" Change text to upper case.
* "g?" rot13 encoding * "g?" rot13 encoding
* "gy" call 'operatorfunc' * "g@" call 'operatorfunc'
*/ */
case 'q': case 'q':
case 'w': case 'w':
@ -7734,7 +7734,7 @@ nv_g_cmd(cap)
case 'u': case 'u':
case 'U': case 'U':
case '?': case '?':
case 'y': case '@':
nv_operator(cap); nv_operator(cap);
break; break;

View File

@ -3548,19 +3548,21 @@ mch_call_shell(cmd, options)
static char envbuf_Rows[20]; static char envbuf_Rows[20];
static char envbuf_Columns[20]; static char envbuf_Columns[20];
# endif # endif
int did_settmode = FALSE; /* TRUE when settmode(TMODE_RAW) called */ int did_settmode = FALSE; /* settmode(TMODE_RAW) called */
out_flush(); out_flush();
if (options & SHELL_COOKED) if (options & SHELL_COOKED)
settmode(TMODE_COOK); /* set to normal mode */ settmode(TMODE_COOK); /* set to normal mode */
/*
* 1: find number of arguments
* 2: separate them and built argv[]
*/
newcmd = vim_strsave(p_sh); newcmd = vim_strsave(p_sh);
if (newcmd == NULL) /* out of memory */ if (newcmd == NULL) /* out of memory */
goto error; goto error;
/*
* Do this loop twice:
* 1: find number of arguments
* 2: separate them and build argv[]
*/
for (i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
{ {
p = newcmd; p = newcmd;
@ -3655,6 +3657,7 @@ mch_call_shell(cmd, options)
# ifdef __BEOS__ # ifdef __BEOS__
beos_cleanup_read_thread(); beos_cleanup_read_thread();
# endif # endif
if ((pid = fork()) == -1) /* maybe we should use vfork() */ if ((pid = fork()) == -1) /* maybe we should use vfork() */
{ {
MSG_PUTS(_("\nCannot fork\n")); MSG_PUTS(_("\nCannot fork\n"));
@ -3728,17 +3731,24 @@ mch_call_shell(cmd, options)
{ {
# ifdef HAVE_SETSID # ifdef HAVE_SETSID
/* Create our own process group, so that the child and all its
* children can be kill()ed. Don't do this when using pipes,
* because stdin is not a tty, we would loose /dev/tty. */
if (p_stmp)
(void)setsid(); (void)setsid();
# endif # endif
# ifdef FEAT_GUI # ifdef FEAT_GUI
if (pty_slave_fd >= 0)
{
/* push stream discipline modules */ /* push stream discipline modules */
if (options & SHELL_COOKED) if (options & SHELL_COOKED)
SetupSlavePTY(pty_slave_fd); SetupSlavePTY(pty_slave_fd);
# ifdef TIOCSCTTY # ifdef TIOCSCTTY
/* try to become controlling tty (probably doesn't work, /* Try to become controlling tty (probably doesn't work,
* unless run by root) */ * unless run by root) */
ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL); ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL);
# endif # endif
}
# endif # endif
/* Simulate to have a dumb terminal (for now) */ /* Simulate to have a dumb terminal (for now) */
# ifdef HAVE_SETENV # ifdef HAVE_SETENV
@ -3895,7 +3905,7 @@ mch_call_shell(cmd, options)
old_State = State; old_State = State;
State = EXTERNCMD; /* don't redraw at window resize */ State = EXTERNCMD; /* don't redraw at window resize */
if (options & SHELL_WRITE && toshell_fd >= 0) if ((options & SHELL_WRITE) && toshell_fd >= 0)
{ {
/* Fork a process that will write the lines to the /* Fork a process that will write the lines to the
* external program. */ * external program. */
@ -3976,6 +3986,8 @@ mch_call_shell(cmd, options)
* Don't do this when filtering and terminal is in cooked * Don't do this when filtering and terminal is in cooked
* mode, the shell command will handle the I/O. Avoids * mode, the shell command will handle the I/O. Avoids
* that a typed password is echoed for ssh or gpg command. * that a typed password is echoed for ssh or gpg command.
* Don't get characters when the child has already
* finished (wait_pid == 0).
* Don't get extra characters when we already have one. * Don't get extra characters when we already have one.
* Don't read characters unless we didn't get output for a * Don't read characters unless we didn't get output for a
* while, avoids that ":r !ls" eats typeahead. * while, avoids that ":r !ls" eats typeahead.
@ -3989,6 +4001,7 @@ mch_call_shell(cmd, options)
|| gui.in_use || gui.in_use
#endif #endif
) )
&& wait_pid == 0
&& (ta_len > 0 && (ta_len > 0
|| (noread_cnt > 4 || (noread_cnt > 4
&& (len = ui_inchar(ta_buf, && (len = ui_inchar(ta_buf,
@ -4207,6 +4220,11 @@ mch_call_shell(cmd, options)
break; break;
} }
/* If we already detected the child has finished break the
* loop now. */
if (wait_pid == pid)
break;
/* /*
* Check if the child still exists, before checking for * Check if the child still exists, before checking for
* typed characters (otherwise we would loose typeahead). * typed characters (otherwise we would loose typeahead).
@ -4219,9 +4237,13 @@ mch_call_shell(cmd, options)
if ((wait_pid == (pid_t)-1 && errno == ECHILD) if ((wait_pid == (pid_t)-1 && errno == ECHILD)
|| (wait_pid == pid && WIFEXITED(status))) || (wait_pid == pid && WIFEXITED(status)))
{ {
/* Don't break the loop yet, try reading more
* characters from "fromshell_fd" first. When using
* pipes there might still be something to read and
* then we'll break the loop at the "break" above. */
wait_pid = pid; wait_pid = pid;
break;
} }
else
wait_pid = 0; wait_pid = 0;
} }
finished: finished:

View File

@ -2419,7 +2419,8 @@ get_tagfname(first, buf)
, TRUE, found_tagfile_cb, NULL); , TRUE, found_tagfile_cb, NULL);
hf_idx = 0; hf_idx = 0;
} }
else if (hf_idx >= tag_fnames.ga_len)
if (hf_idx >= tag_fnames.ga_len)
{ {
/* Not found in 'runtimepath', use 'helpfile', if it exists and /* Not found in 'runtimepath', use 'helpfile', if it exists and
* wasn't used yet, replacing "help.txt" with "tags". */ * wasn't used yet, replacing "help.txt" with "tags". */

View File

@ -1201,7 +1201,7 @@ typedef enum
#define OP_FOLDDEL 24 /* "zd" delete folds */ #define OP_FOLDDEL 24 /* "zd" delete folds */
#define OP_FOLDDELREC 25 /* "zD" delete folds recursively */ #define OP_FOLDDELREC 25 /* "zD" delete folds recursively */
#define OP_FORMAT2 26 /* "gw" format operator, keeps cursor pos */ #define OP_FORMAT2 26 /* "gw" format operator, keeps cursor pos */
#define OP_FUNCTION 27 /* "gy" call 'operatorfunc' */ #define OP_FUNCTION 27 /* "g@" call 'operatorfunc' */
/* /*
* Motion types, used for operators and for yank/delete registers. * Motion types, used for operators and for yank/delete registers.

View File

@ -146,16 +146,18 @@ char osver[] = "";
#if !defined(CYGWIN) && (defined(CYGWIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__)) #if !defined(CYGWIN) && (defined(CYGWIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__))
# define CYGWIN # define CYGWIN
#endif #endif
#if defined(MSDOS) || defined(WIN32) || defined(OS2) || defined(CYGWIN) #if defined(MSDOS) || defined(WIN32) || defined(OS2)
# define BIN_READ(yes) ((yes) ? "rb" : "rt") # define BIN_READ(yes) ((yes) ? "rb" : "rt")
# define BIN_WRITE(yes) ((yes) ? "wb" : "wt") # define BIN_WRITE(yes) ((yes) ? "wb" : "wt")
# define BIN_CREAT(yes) ((yes) ? (O_CREAT|O_BINARY) : O_CREAT) # define BIN_CREAT(yes) ((yes) ? (O_CREAT|O_BINARY) : O_CREAT)
# define BIN_ASSIGN(fp, yes) setmode(fileno(fp), (yes) ? O_BINARY : O_TEXT) # define BIN_ASSIGN(fp, yes) setmode(fileno(fp), (yes) ? O_BINARY : O_TEXT)
# if defined(CYGWIN)
# define PATH_SEP '/'
# else
# define PATH_SEP '\\' # define PATH_SEP '\\'
# endif #elif defined(CYGWIN)
# define BIN_READ(yes) ((yes) ? "rb" : "rt")
# define BIN_WRITE(yes) ((yes) ? "wb" : "w")
# define BIN_CREAT(yes) ((yes) ? (O_CREAT|O_BINARY) : O_CREAT)
# define BIN_ASSIGN(fp, yes) ((yes) ? (void) setmode(fileno(fp), O_BINARY) : (void) (fp))
# define PATH_SEP '/'
#else #else
# ifdef VMS # ifdef VMS
# define BIN_READ(dummy) "r" # define BIN_READ(dummy) "r"