4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When editing a compressed files, marks are lost.
12 Solution: Add the ":lockmarks" modifier and use it in the gzip plugin.
13 Make exists() also check for command modifiers, so that the
14 existence of ":lockmarks" can be checked for.
15 Also add ":keepmarks" to avoid that marks are deleted when
17 When deleting lines put marks 'A - 'Z and '0 - '9 at the first
18 deleted line instead of clearing the mark. They were kept in the
20 Avoid that the gzip plugin puts deleted text in registers.
21 Files: runtime/doc/motion.txt, runtime/plugin/gzip.vim, src/ex_cmds.c,
22 src/ex_docmd.c, src/mark.c, src/structs.h
25 *** ../vim-6.2.189/runtime/doc/motion.txt Sun Jun 1 12:20:33 2003
26 --- runtime/doc/motion.txt Sat Jan 17 16:37:22 2004
29 ! *motion.txt* For Vim version 6.2. Last change: 2003 May 27
32 VIM REFERENCE MANUAL by Bram Moolenaar
34 ! *motion.txt* For Vim version 6.2. Last change: 2004 Jan 17
37 VIM REFERENCE MANUAL by Bram Moolenaar
41 Lowercase marks 'a to 'z are remembered as long as the file remains in the
42 buffer list. If you remove the file from the buffer list, all its marks are
43 lost. If you delete a line that contains a mark, that mark is erased.
45 + To delete a mark: Create a new line, position the mark there, delete the line.
46 + E.g.: "o<Esc>mxdd". This does change the file though. Using "u" won't work,
47 + it also restores marks.
49 Lowercase marks can be used in combination with operators. For example: "d't"
50 deletes the lines from the cursor position to mark 't'. Hint: Use mark 't' for
51 Top, 'b' for Bottom, etc.. Lowercase marks are restored when using undo and
55 [` [count] times to lowercase mark before the cursor.
59 + :loc[kmarks] {command} *:loc* *:lockmarks*
60 + Execute {command} without adjusting marks. This is
61 + useful when changing text in a way that the line count
62 + will be the same when the change has completed.
63 + WARNING: When the line count does change, marks below
64 + the change will keep their line number, thus move to
66 + These items will not be adjusted for deleted/inserted
68 + - lower case letter marks 'a - 'z
69 + - upper case letter marks 'A - 'Z
70 + - numbered marks '0 - '9
71 + - last insert position '^
72 + - last change position '.
73 + - the Visual area '< and '>
74 + - line numbers in placed signs
75 + - line numbers in quickfix positions
76 + - positions in the |jumplist|
77 + - positions in the |tagstack|
78 + These items will still be adjusted:
79 + - previous context mark ''
80 + - the cursor position
81 + - the view of a window on a buffer
85 + :kee[pmarks] {command} *:kee* *:keepmarks*
86 + Currently only has effect for the filter command
88 + - When the number of lines after filtering is equal to
89 + or larger than before, all marks are kept at the
91 + - When the number of lines decreases, the marks in the
92 + ilnes that disappeared are deleted.
93 + In any case the marks below the filtered text have
94 + their line numbers adjusted, thus stick to the text,
96 + When the 'R' flag is missing from 'cpoptions' this has
97 + the same effect as using ":keepmarks".
99 ==============================================================================
100 8. Jumps *jump-motions*
102 *** ../vim-6.2.189/runtime/plugin/gzip.vim Mon Dec 29 21:04:38 2003
103 --- runtime/plugin/gzip.vim Mon Jan 12 17:39:39 2004
106 " Vim plugin for editing compressed files.
107 " Maintainer: Bram Moolenaar <Bram@vim.org>
108 ! " Last Change: 2003 Dec 22
111 " - this plugin was already loaded
113 " Vim plugin for editing compressed files.
114 " Maintainer: Bram Moolenaar <Bram@vim.org>
115 ! " Last Change: 2004 Jan 12
118 " - this plugin was already loaded
121 call system(a:cmd . " " . tmpe)
122 " delete the compressed lines; remember the line number
123 let l = line("'[") - 1
125 " read in the uncompressed lines "'[-1r tmp"
127 ! execute "silent " . l . "r " . tmp
128 " if buffer became empty, delete trailing blank line
133 " delete the temp file and the used buffers
135 call system(a:cmd . " " . tmpe)
136 " delete the compressed lines; remember the line number
137 let l = line("'[") - 1
138 ! if exists(":lockmarks")
143 " read in the uncompressed lines "'[-1r tmp"
145 ! if exists(":lockmarks")
146 ! execute "silent lockmarks " . l . "r " . tmp
148 ! execute "silent " . l . "r " . tmp
151 " if buffer became empty, delete trailing blank line
156 " delete the temp file and the used buffers
157 *** ../vim-6.2.189/src/ex_cmds.c Fri Jan 9 15:02:40 2004
158 --- src/ex_cmds.c Sun Jan 18 16:18:17 2004
165 + linenr_T read_linecount;
172 if (u_save((linenr_T)(line2), (linenr_T)(line2 + 1)) == FAIL)
174 redraw_curbuf_later(VALID);
175 + read_linecount = curbuf->b_ml.ml_line_count;
176 if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap,
177 READ_FILTER) == FAIL)
185 + if (cmdmod.keepmarks || vim_strchr(p_cpo, CPO_REMMARK) == NULL)
187 + read_linecount = curbuf->b_ml.ml_line_count - read_linecount;
188 + if (read_linecount >= linecount)
189 + /* move all marks from old lines to new lines */
190 + mark_adjust(line1, line2, linecount, 0L);
193 + /* move marks from old lines to new lines, delete marks
194 + * that are in deleted lines */
195 + mark_adjust(line1, line1 + read_linecount - 1,
197 + mark_adjust(line1 + read_linecount, line2, MAXLNUM, 0L);
202 * Put cursor on first filtered line for ":range!cmd".
203 * Adjust '[ and '] (set by buf_write()).
204 *** ../vim-6.2.189/src/ex_docmd.c Sun Jan 18 20:46:13 2004
205 --- src/ex_docmd.c Fri Jan 16 17:20:17 2004
209 p = skipwhite(skipdigits(ea.cmd));
212 + /* When adding an entry, also modify cmd_exists(). */
213 case 'a': if (!checkforcmd(&ea.cmd, "aboveleft", 3))
222 + case 'k': if (!checkforcmd(&ea.cmd, "keepmarks", 3))
224 + cmdmod.keepmarks = TRUE;
227 /* ":hide" and ":hide | cmd" are not modifiers */
228 case 'h': if (p != ea.cmd || !checkforcmd(&p, "hide", 3)
229 || *p == NUL || ends_excmd(*p))
235 ! case 'l': if (!checkforcmd(&ea.cmd, "leftabove", 5))
238 cmdmod.split |= WSP_ABOVE;
243 ! case 'l': if (checkforcmd(&ea.cmd, "lockmarks", 3))
245 ! cmdmod.lockmarks = TRUE;
249 ! if (!checkforcmd(&ea.cmd, "leftabove", 5))
252 cmdmod.split |= WSP_ABOVE;
261 + static struct cmdmod
282 + /* Check command modifiers. */
283 + for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
285 + for (j = 0; name[j] != NUL; ++j)
286 + if (name[j] != cmdmods[i].name[j])
288 + if (name[j] == NUL && j >= cmdmods[i].minlen)
289 + return (cmdmods[i].name[j] == NUL ? 2 : 1);
292 + /* Check built-in commands and user defined commands. */
294 ea.cmdidx = (cmdidx_T)0;
295 if (find_command(&ea, &full) == NULL)
296 *** ../vim-6.2.189/src/mark.c Sun Jan 18 20:58:01 2004
297 --- src/mark.c Fri Jan 16 11:56:14 2004
302 /* named marks, lower case and upper case */
303 ! for (i = 0; i < NMARKS; i++)
305 ! one_adjust(&(curbuf->b_namedm[i].lnum));
306 ! if (namedfm[i].fmark.fnum == fnum)
307 ! one_adjust(&(namedfm[i].fmark.mark.lnum));
309 ! for (i = NMARKS; i < NMARKS + EXTRA_MARKS; i++)
311 ! if (namedfm[i].fmark.fnum == fnum)
312 ! one_adjust(&(namedfm[i].fmark.mark.lnum));
315 ! /* previous context mark */
316 ! one_adjust(&(curwin->w_pcmark.lnum));
318 ! /* previous pcmark */
319 ! one_adjust(&(curwin->w_prev_pcmark.lnum));
321 ! /* last Insert position */
322 ! one_adjust(&(curbuf->b_last_insert.lnum));
324 ! /* last change position */
325 ! one_adjust(&(curbuf->b_last_change.lnum));
329 ! one_adjust_nodel(&(curbuf->b_visual_start.lnum));
330 ! one_adjust_nodel(&(curbuf->b_visual_end.lnum));
334 ! /* quickfix marks */
335 ! qf_mark_adjust(line1, line2, amount, amount_after);
339 * Adjust items in all windows related to the current buffer.
344 ! /* Marks in the jumplist. When deleting lines, this may create
345 ! * duplicate marks in the jumplist, they will be removed later. */
346 ! for (i = 0; i < win->w_jumplistlen; ++i)
347 ! if (win->w_jumplist[i].fmark.fnum == fnum)
348 ! one_adjust_nodel(&(win->w_jumplist[i].fmark.mark.lnum));
351 if (win->w_buffer == curbuf)
353 ! /* marks in the tag stack */
354 ! for (i = 0; i < win->w_tagstacklen; i++)
355 ! if (win->w_tagstack[i].fmark.fnum == fnum)
356 ! one_adjust_nodel(&(win->w_tagstack[i].fmark.mark.lnum));
359 /* the displayed Visual area */
363 /* named marks, lower case and upper case */
364 ! if (!cmdmod.lockmarks)
366 ! for (i = 0; i < NMARKS; i++)
368 ! one_adjust(&(curbuf->b_namedm[i].lnum));
369 ! if (namedfm[i].fmark.fnum == fnum)
370 ! one_adjust_nodel(&(namedfm[i].fmark.mark.lnum));
372 ! for (i = NMARKS; i < NMARKS + EXTRA_MARKS; i++)
374 ! if (namedfm[i].fmark.fnum == fnum)
375 ! one_adjust_nodel(&(namedfm[i].fmark.mark.lnum));
378 ! /* last Insert position */
379 ! one_adjust(&(curbuf->b_last_insert.lnum));
381 ! /* last change position */
382 ! one_adjust(&(curbuf->b_last_change.lnum));
386 ! one_adjust_nodel(&(curbuf->b_visual_start.lnum));
387 ! one_adjust_nodel(&(curbuf->b_visual_end.lnum));
391 ! /* quickfix marks */
392 ! qf_mark_adjust(line1, line2, amount, amount_after);
396 + sign_mark_adjust(line1, line2, amount, amount_after);
400 + /* previous context mark */
401 + one_adjust(&(curwin->w_pcmark.lnum));
403 + /* previous pcmark */
404 + one_adjust(&(curwin->w_prev_pcmark.lnum));
407 * Adjust items in all windows related to the current buffer.
412 ! if (!cmdmod.lockmarks)
413 ! /* Marks in the jumplist. When deleting lines, this may create
414 ! * duplicate marks in the jumplist, they will be removed later. */
415 ! for (i = 0; i < win->w_jumplistlen; ++i)
416 ! if (win->w_jumplist[i].fmark.fnum == fnum)
417 ! one_adjust_nodel(&(win->w_jumplist[i].fmark.mark.lnum));
420 if (win->w_buffer == curbuf)
422 ! if (!cmdmod.lockmarks)
423 ! /* marks in the tag stack */
424 ! for (i = 0; i < win->w_tagstacklen; i++)
425 ! if (win->w_tagstack[i].fmark.fnum == fnum)
426 ! one_adjust_nodel(&(win->w_tagstack[i].fmark.mark.lnum));
429 /* the displayed Visual area */
434 diff_mark_adjust(line1, line2, amount, amount_after);
438 - sign_mark_adjust(line1, line2, amount, amount_after);
443 *** ../vim-6.2.189/src/structs.h Sun Nov 2 15:27:38 2003
444 --- src/structs.h Tue Jan 13 12:57:23 2004
448 # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
449 int confirm; /* TRUE to invoke yes/no dialog */
451 + int keepmarks; /* TRUE when ":keepmarks" was used */
452 + int lockmarks; /* TRUE when ":lockmarks" was used */
456 *** ../vim-6.2.189/src/version.c Sun Jan 18 21:04:53 2004
457 --- src/version.c Sun Jan 18 21:07:07 2004
461 { /* Add new patch number below this line */
467 ARTHUR: Well, I AM king...
468 DENNIS: Oh king, eh, very nice. An' how'd you get that, eh? By exploitin'
469 the workers -- by 'angin' on to outdated imperialist dogma which
470 perpetuates the economic an' social differences in our society! If
471 there's ever going to be any progress--
472 The Quest for the Holy Grail (Monty Python)
474 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
475 /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
476 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
477 \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///