Lines Matching +defs:first +defs:line

11  * ex_cmds.c: some functions for command line commands
224 * Now try to move the line as much as possible to
247 * Get the length of the current line, excluding trailing white space.
253 char_u *line;
254 char_u *first;
259 /* find the first non-blank character */
260 line = ml_get_curline();
261 first = skipwhite(line);
264 for (last = first + STRLEN(first);
265 last > first && vim_iswhite(last[-1]); --last)
269 len = linetabsize(line); /* get line length */
271 *has_tab = (vim_strrchr(first, TAB) != NULL);
278 * contain the longest line being sorted. */
291 linenr_T lnum; /* line number */
329 /* We need to copy one line into "sortbuf1", because there is no
330 * guarantee that the first pointer becomes invalid when obtaining the
343 /* If two lines have the same value, preserve the original line order. */
374 /* Sorting one line is really quick! */
449 * Make an array with all line numbers. This avoids having to copy all
451 * When sorting on strings "start_col_nr" is the offset in the line, for
453 * matching and number conversion only has to be done once per line.
454 * Also get the longest line length for allocating "sortbuf".
513 /* Allocate a buffer that can hold the longest line. */
521 /* Sort the array of line numbers. Note: can't be interrupted! */
592 int did_undo; /* called u_save for current line */
595 linenr_T first_line = 0; /* first changed line */
596 linenr_T last_line = 0; /* last changed line */
721 * :move command - move lines line1-line2 to line dest
735 linenr_T last_line; /* Last line in file after adding new text */
769 * will be set there since these line numbers did not exist until we added
808 MSG(_("1 line moved"));
863 /* need to use vim_strsave() because the line will be unlocked within
1275 * Put cursor on first filtered line for ":range!cmd".
1282 write_lnum_adjust(-linecount); /* adjust last line
1291 * Put cursor on last new line for ":r !cmd".
1297 beginline(BL_WHITE | BL_FIX); /* cursor on first non-blank */
1386 msg_putchar('\r'); /* put cursor at start of line */
1399 msg_putchar('\n'); /* may shift screen one line up */
1422 /* This windgoto is required for when the '\n' resulted in a "delete line
1667 viminfo_error(errnum, message, line)
1670 char_u *line;
1672 vim_snprintf((char *)IObuff, IOSIZE, _("%sviminfo: %s in line: "),
1674 STRNCAT(IObuff, line, IOSIZE - STRLEN(IObuff) - 1);
1730 * write_viminfo() -- Write the viminfo file. The old one is read in first so
2114 * first part of the viminfo file which contains everything but the marks that
2138 case '<': /* long line - ignored */
2139 /* A comment or empty line. */
2238 * Read a line from the viminfo file.
2250 * remove '\n' at the end of the line
2254 * Check for a long line as written by viminfo_writestring().
2274 /* Line too long? File messed up? Skip next line. */
2327 * For a long line:
2328 * - write " CTRL-V <length> \n " in first line
2329 * - write " < <string> \n " in second line
2348 * line. Take into account that some room is needed for what comes before
2397 msg_puts_attr(numbuf, hl_attr(HLF_N)); /* Highlight line nrs */
2403 * Print a text line. Also in silent mode ("ex -s").
2798 /* We only try the first entry in 'directory', without checking if
3004 * 'lnum' is the line number for the cursor in the new file (if non-zero).
3091 * newlnum: if > 0: put cursor on this line number (if possible)
3094 * if ECMD_ONE: use first line
3102 * window, NULL when splitting the window first. When not NULL info
3339 /* May jump to last used line number for a loaded buffer or when asked
3499 curwin->w_p_nu = 0; /* no line numbers */
3500 curwin->w_p_rnu = 0; /* no relative line numbers */
3577 * Sync first so that this is a separate undo-able action. */
3618 /* don't redraw until the cursor is in the right line */
3760 else if (newlnum > 0) /* line number from caller or old position */
3777 else /* no line number, go to last line in Ex mode */
3883 static int append_indent = 0; /* autoindent for first line */
3904 /* First autoindent comes from the line we start on */
3911 /* when the buffer is empty append to line 0 and delete the dummy line */
4050 /* ":append" on the line above the deleted lines. */
4230 * Perform a substitution from line eap->line1 to line eap->line2 using the
4244 static int do_all = FALSE; /* do multiple substitutions per line */
4248 static int do_print = FALSE; /* print last line with subs. */
4249 static int do_list = FALSE; /* list last line with subs. */
4250 static int do_number = FALSE; /* list last line with line nr*/
4261 linenr_T first_line = 0; /* first changed line */
4262 linenr_T last_line= 0; /* below last changed line AFTER the
4267 char_u *sub_firstline; /* allocated copy of first sub line */
4462 if (*cmd && *cmd != '"') /* if not end-of-line or comment */
4506 * Check for a match on each line.
4531 linenr_T sub_firstlnum; /* nr of first sub line */
4544 * Mostly equal to matchcol, except for the first
4551 * lnum The line number where we found the start of
4552 * the match. Can be below the line we searched
4555 * sub_firstlnum The line number in the buffer where to look
4558 * line breaks.
4561 * - When the substitute string contains a line break, the part up
4562 * to the line break is inserted in the text, but the copy of
4563 * the original line is kept. "sub_firstlnum" is adjusted for
4565 * - When the matched pattern contains a line break, the old line
4566 * is taken from the line at the end of the pattern. The lines
4574 * Make a copy of the old line, so it won't be taken away when
4575 * updating the screen or handling a multi-line match. The "old_"
4582 /* At first match, remember current cursor position. */
4590 * Loop until nothing more to replace in this line.
4595 * 5. break if there isn't another match in this line
4599 /* Advance "lnum" to the line where the match starts. The
4600 * match does not start in the first line when there is a line
4621 /* Save the line number of the last change for the final
4627 * 1. Match empty string does not count, except for first
4636 /* We already were at the end of the line. Don't look
4637 * for a match in this line again. */
4655 /* For a multi-line match, put matchcol at the NUL at
4656 * the end of the line and set nmatch to one, so that
4657 * we continue looking for a match on the next line.
4816 /* For a multi-line match, put matchcol at the NUL at
4817 * the end of the line and set nmatch to one, so that
4818 * we continue looking for a match on the next line.
4844 /* When the match included the "$" of the last line it may
4845 * go beyond the last line of the buffer. */
4853 * - result so far in new_start (not for first sub in line)
4917 /* Move the cursor to the start of the line, to avoid that it
4918 * is beyond the end of the line after the substitution. */
4921 /* For a multi-line match, make a copy of the last matched
4922 * line and continue in that one. */
4928 /* When going beyond the last line, stop substituting. */
4948 * Now the trick is to replace CTRL-M chars with a real line
4950 * the text. The line break can be avoided by preceding the
4975 /* All line numbers increase. */
4979 /* move the cursor to the new line, like Vi */
5000 * the end of the line, except that a pattern like
5002 * "line2" when there is a \zs in the pattern after a line
5014 * Replace the line in the buffer when needed. This is
5016 * The check for nmatch_tl is needed for when multi-line
5023 * need to replace the line first (using \zs after \n).
5036 * Copy the rest of the line, that didn't match.
5038 * the line as reference, because the substitute may
5100 * 5. break if there isn't another match in this line
5105 * searching, do the next search in the line where we
5119 vim_free(sub_firstline); /* free the copy of the original line */
5129 * the line number before the change (same as adding the number of
5136 vim_free(sub_firstline); /* may have to free allocated copy of the line */
5208 "%s", _(" on 1 line"));
5236 * This is implemented in two passes: first we scan the file for the pattern and
5237 * set a mark for each line that (not) matches. secondly we execute the command
5238 * for each line that has a mark. This is required because after deleting
5245 linenr_T lnum; /* line number according to old situation */
5247 int type; /* first char of cmd: 'v' or 'g' */
5317 * pass 1: set marks for each (not) matching line
5321 /* a match on this line? */
5333 * pass 2: execute the command for each line that has been marked
5340 smsg((char_u *)_("Pattern found in every line: %s"), pat);
5362 linenr_T lnum; /* line number according to old situation */
5394 check_cursor(); /* cursor may be beyond the end of the line */
5397 * line may move it on the screen */
5526 * A ":help" command ends at the first LF, or at a '|' that is
5576 /* Find first item with the requested language. */
5598 /* The first match (in the requested language) is the best match. */
5871 * Replace "*" with ".*" and "?" with "." to match command line
5984 char_u *line;
6000 line = ml_get_buf(curbuf, lnum, FALSE);
6001 len = (int)STRLEN(line);
6002 if (in_example && len > 0 && !vim_iswhite(line[0]))
6004 /* End of example: non-white or '<' in first column. */
6005 if (line[0] == '<')
6007 /* blank-out a '<' in the first column */
6008 line = ml_get_buf(curbuf, lnum, TRUE);
6009 line[0] = ' ';
6015 if (line[len - 1] == '>' && (len == 1 || line[len - 2] == ' '))
6018 line = ml_get_buf(curbuf, lnum, TRUE);
6019 line[len - 1] = ' ';
6022 else if (line[len - 1] == '~')
6024 /* blank-out a '~' at the end of line (header marker) */
6025 line = ml_get_buf(curbuf, lnum, TRUE);
6026 line[len - 1] = ' ';
6034 * This uses the very first line in the help file.
6040 line = ml_get_buf(curbuf, lnum, FALSE);
6041 if (strstr((char *)line, "*local-additions*") != NULL)
6405 /* Detect utf-8 file by a non-ASCII char in the first line. */
6424 if (utf8 == MAYBE) /* first file */
6435 p1 = vim_strchr(IObuff, '*'); /* find first '*' */
6448 * followed by a white character or end-of-line.
6575 int sn_line_hl; /* highlight ID for line */
6851 /* first arg could be placed sign id */
6876 * Check for line={lnum} name={name} and file={fname} or buffer={nr}.
6881 if (STRNCMP(arg, "line=", 5) == 0)
6983 /* ":sign place {id} line={lnum} name={name} file={fname}":
7085 * If "line" is TRUE: line highl, if FALSE: text highl.
7088 sign_get_attr(typenr, line)
7090 int line;
7097 if (line)
7207 "line=", "name=", "file=", "buffer=", NULL
7229 * Handle command line completion for :sign command.
7263 * Expand first argument of subcmd when possible.
7353 * Opens the first argument in a window. When there are two or more arguments
7368 * Check if the first argument is already being edited in a window. If
7396 /* ":drop file ...": Edit the first argument. Jump to an existing
7433 /* Fake a ":sfirst" or ":first" command edit the first argument. */