mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
Added the undofile() function. Updated runtime files.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
" Vim compiler file
|
" Vim compiler file
|
||||||
" Compiler: GNU C Compiler
|
" Compiler: GNU C Compiler
|
||||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||||
" Latest Revision: 2009-05-01
|
" Latest Revision: 2010-05-30
|
||||||
|
|
||||||
if exists("current_compiler")
|
if exists("current_compiler")
|
||||||
finish
|
finish
|
||||||
@@ -18,7 +18,11 @@ CompilerSet errorformat=
|
|||||||
\\"%f\"%*\\D%l:\ %m,
|
\\"%f\"%*\\D%l:\ %m,
|
||||||
\%-G%f:%l:\ %trror:\ (Each\ undeclared\ identifier\ is\ reported\ only\ once,
|
\%-G%f:%l:\ %trror:\ (Each\ undeclared\ identifier\ is\ reported\ only\ once,
|
||||||
\%-G%f:%l:\ %trror:\ for\ each\ function\ it\ appears\ in.),
|
\%-G%f:%l:\ %trror:\ for\ each\ function\ it\ appears\ in.),
|
||||||
|
\%f:%l:%c:\ %terror:\ %m,
|
||||||
|
\%f:%l:%c:\ %tarning:\ %m,
|
||||||
\%f:%l:%c:\ %m,
|
\%f:%l:%c:\ %m,
|
||||||
|
\%f:%l:\ %terror:\ %m,
|
||||||
|
\%f:%l:\ %tarning:\ %m,
|
||||||
\%f:%l:\ %m,
|
\%f:%l:\ %m,
|
||||||
\\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m,
|
\\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m,
|
||||||
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
|
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
|
||||||
|
@@ -1943,6 +1943,7 @@ tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
|
|||||||
to chars in {tostr}
|
to chars in {tostr}
|
||||||
trunc( {expr} Float truncate Float {expr}
|
trunc( {expr} Float truncate Float {expr}
|
||||||
type( {name}) Number type of variable {name}
|
type( {name}) Number type of variable {name}
|
||||||
|
undofile( {name}) String undo file name for {name}
|
||||||
values( {dict}) List values in {dict}
|
values( {dict}) List values in {dict}
|
||||||
virtcol( {expr}) Number screen column of cursor or mark
|
virtcol( {expr}) Number screen column of cursor or mark
|
||||||
visualmode( [expr]) String last visual mode used
|
visualmode( [expr]) String last visual mode used
|
||||||
@@ -5767,6 +5768,15 @@ type({expr}) The result is a Number, depending on the type of {expr}:
|
|||||||
:if type(myvar) == type({})
|
:if type(myvar) == type({})
|
||||||
:if type(myvar) == type(0.0)
|
:if type(myvar) == type(0.0)
|
||||||
|
|
||||||
|
undofile({name}) *undofile()*
|
||||||
|
Return the name of the undo file that would be used for a file
|
||||||
|
with name {name} when writing. This uses the 'undodir'
|
||||||
|
option, finding directories that exist. It does not check if
|
||||||
|
the undo file exist.
|
||||||
|
Useful in combination with |:wundo| and |:rundo|.
|
||||||
|
When compiled without the +persistent_undo option this always
|
||||||
|
returns an empty string.
|
||||||
|
|
||||||
values({dict}) *values()*
|
values({dict}) *values()*
|
||||||
Return a |List| with all the values of {dict}. The |List| is
|
Return a |List| with all the values of {dict}. The |List| is
|
||||||
in arbitrary order.
|
in arbitrary order.
|
||||||
|
@@ -775,7 +775,7 @@ is suitable for complex input, such as CJK.
|
|||||||
For Chinese, there's a great XIM server named "xcin", you can input both
|
For Chinese, there's a great XIM server named "xcin", you can input both
|
||||||
Traditional and Simplified Chinese characters. And it can accept other
|
Traditional and Simplified Chinese characters. And it can accept other
|
||||||
locale if you make a correct input table. Xcin can be found at:
|
locale if you make a correct input table. Xcin can be found at:
|
||||||
http://xcin.linux.org.tw/
|
http://cle.linux.org.tw/xcin/
|
||||||
Others are scim: http://scim.freedesktop.org/ and fcitx:
|
Others are scim: http://scim.freedesktop.org/ and fcitx:
|
||||||
http://www.fcitx.org/
|
http://www.fcitx.org/
|
||||||
|
|
||||||
@@ -963,10 +963,10 @@ WHAT IS GLOBAL IME *global-ime*
|
|||||||
language version of Global IME at same place.
|
language version of Global IME at same place.
|
||||||
|
|
||||||
- Global IME detailed information.
|
- Global IME detailed information.
|
||||||
http://www.microsoft.com/windows/ie/features/ime.asp
|
http://search.microsoft.com/results.aspx?q=global+ime
|
||||||
|
|
||||||
- Active Input Method Manager (Global IME)
|
- Active Input Method Manager (Global IME)
|
||||||
http://msdn.microsoft.com/workshop/misc/AIMM/aimm.asp
|
http://msdn.microsoft.com/en-us/library/aa741221(v=VS.85).aspx
|
||||||
|
|
||||||
Support for Global IME is an experimental feature.
|
Support for Global IME is an experimental feature.
|
||||||
|
|
||||||
|
@@ -585,6 +585,7 @@ when using ":w"), therefore Vim requires using a ! after the command, e.g.:
|
|||||||
Messages like this appear when starting up. This is not a Vim problem, your
|
Messages like this appear when starting up. This is not a Vim problem, your
|
||||||
X11 configuration is wrong. You can find a hint on how to solve this here:
|
X11 configuration is wrong. You can find a hint on how to solve this here:
|
||||||
http://groups.yahoo.com/group/solarisonintel/message/12179.
|
http://groups.yahoo.com/group/solarisonintel/message/12179.
|
||||||
|
[this URL is no longer valid]
|
||||||
|
|
||||||
*W10* >
|
*W10* >
|
||||||
Warning: Changing a readonly file
|
Warning: Changing a readonly file
|
||||||
|
@@ -183,7 +183,8 @@ anyway you need an additional tool which gives you access to the clipboard
|
|||||||
from within a vio application. The freeware package clipbrd.zip by Stefan
|
from within a vio application. The freeware package clipbrd.zip by Stefan
|
||||||
Gruendel can be used for this purpose. You might download the package
|
Gruendel can be used for this purpose. You might download the package
|
||||||
including precompiled binaries and all sources from:
|
including precompiled binaries and all sources from:
|
||||||
http://www.stellarcom.org/vim/index.html
|
http://www.os2site.com/sw/util/clipboard/index.html
|
||||||
|
http://download.uni-hd.de/ftp/pub/os2/pmtools/
|
||||||
|
|
||||||
Installation of this package is straight forward: just put the two executables
|
Installation of this package is straight forward: just put the two executables
|
||||||
that come with this package into a directory within your PATH for Vim should
|
that come with this package into a directory within your PATH for Vim should
|
||||||
|
@@ -490,7 +490,7 @@ Traditional Chinese fonts available at:
|
|||||||
|
|
||||||
You can find descriptions of the various fonts in the read me file at
|
You can find descriptions of the various fonts in the read me file at
|
||||||
|
|
||||||
http://examples.oreilly.com/cjkvinfo/adobe/00README
|
http://examples.oreilly.de/english_examples/cjkvinfo/adobe/00README
|
||||||
|
|
||||||
Please read your printer documentation on how to install new fonts.
|
Please read your printer documentation on how to install new fonts.
|
||||||
|
|
||||||
|
@@ -828,7 +828,8 @@ startup vimrc: >
|
|||||||
DESKTOP *desktop.vim* *ft-desktop-syntax*
|
DESKTOP *desktop.vim* *ft-desktop-syntax*
|
||||||
|
|
||||||
Primary goal of this syntax file is to highlight .desktop and .directory files
|
Primary goal of this syntax file is to highlight .desktop and .directory files
|
||||||
according to freedesktop.org standard: http://pdx.freedesktop.org/Standards/
|
according to freedesktop.org standard:
|
||||||
|
http://standards.freedesktop.org/desktop-entry-spec/latest/
|
||||||
But actually almost none implements this standard fully. Thus it will
|
But actually almost none implements this standard fully. Thus it will
|
||||||
highlight all Unix ini files. But you can force strict highlighting according
|
highlight all Unix ini files. But you can force strict highlighting according
|
||||||
to standard by placing this in your vimrc file: >
|
to standard by placing this in your vimrc file: >
|
||||||
|
@@ -7867,6 +7867,7 @@ undo-tree undo.txt /*undo-tree*
|
|||||||
undo-two-ways undo.txt /*undo-two-ways*
|
undo-two-ways undo.txt /*undo-two-ways*
|
||||||
undo.txt undo.txt /*undo.txt*
|
undo.txt undo.txt /*undo.txt*
|
||||||
undo_ftplugin usr_41.txt /*undo_ftplugin*
|
undo_ftplugin usr_41.txt /*undo_ftplugin*
|
||||||
|
undofile() eval.txt /*undofile()*
|
||||||
unicode mbyte.txt /*unicode*
|
unicode mbyte.txt /*unicode*
|
||||||
unix os_unix.txt /*unix*
|
unix os_unix.txt /*unix*
|
||||||
unlisted-buffer windows.txt /*unlisted-buffer*
|
unlisted-buffer windows.txt /*unlisted-buffer*
|
||||||
|
@@ -30,10 +30,6 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
|
|||||||
*known-bugs*
|
*known-bugs*
|
||||||
-------------------- Known bugs and current work -----------------------
|
-------------------- Known bugs and current work -----------------------
|
||||||
|
|
||||||
Fixes for broken URLs:
|
|
||||||
Benjamin Haskell, 2010 May 25
|
|
||||||
Christian Brabandt, 2010 May 26, two messages
|
|
||||||
|
|
||||||
Cursor positioning wrong with 0x200e character. (John Becket, 2010 May 6)
|
Cursor positioning wrong with 0x200e character. (John Becket, 2010 May 6)
|
||||||
|
|
||||||
E315 when trying to change a file in FileChangedRO autocommand event.
|
E315 when trying to change a file in FileChangedRO autocommand event.
|
||||||
@@ -1094,7 +1090,6 @@ Vim 7.3:
|
|||||||
Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi
|
Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi
|
||||||
- Persistent undo bugs / fixes:
|
- Persistent undo bugs / fixes:
|
||||||
- Need to check all values for evil manipulation.
|
- Need to check all values for evil manipulation.
|
||||||
- Add undofile(name): get undo file name for buffer "name".
|
|
||||||
- patch for unused functions. (Dominique Pelle, 2010 May 29)
|
- patch for unused functions. (Dominique Pelle, 2010 May 29)
|
||||||
- Also crypt the undo file.
|
- Also crypt the undo file.
|
||||||
- Also crypt the swap file, each block separately. Change mf_write() and
|
- Also crypt the swap file, each block separately. Change mf_write() and
|
||||||
|
@@ -243,12 +243,26 @@ respectively:
|
|||||||
You can use these in autocommands to explicitly specify the name of the
|
You can use these in autocommands to explicitly specify the name of the
|
||||||
history file. E.g.: >
|
history file. E.g.: >
|
||||||
|
|
||||||
au BufReadPost * rundo %:h/UNDO/%:t
|
au BufReadPost * call ReadUndo()
|
||||||
au BufWritePost * wundo %:h/UNDO/%:t
|
au BufWritePost * call WriteUndo()
|
||||||
|
func ReadUndo()
|
||||||
|
if filereadable(expand('%:h'). '/UNDO/' . expand('%:t'))
|
||||||
|
rundo %:h/UNDO/%:t
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
func WriteUndo()
|
||||||
|
let dirname = expand('%:h') . '/UNDO'
|
||||||
|
if !isdirectory(dirname)
|
||||||
|
call mkdir(dirname)
|
||||||
|
endif
|
||||||
|
wundo %:h/UNDO/%:t
|
||||||
|
endfunc
|
||||||
|
|
||||||
You should keep 'undofile' off, otherwise you end up with two undo files for
|
You should keep 'undofile' off, otherwise you end up with two undo files for
|
||||||
every write.
|
every write.
|
||||||
Note: I did not verify this always works!
|
|
||||||
|
You can use the |undofile()| function to find out the file name that Vim would
|
||||||
|
use.
|
||||||
|
|
||||||
Note that while reading/writing files and 'undofile' is set most errors will
|
Note that while reading/writing files and 'undofile' is set most errors will
|
||||||
be silent, unless 'verbose' is set. With :wundo and :rundo you will get more
|
be silent, unless 'verbose' is set. With :wundo and :rundo you will get more
|
||||||
|
@@ -89,10 +89,10 @@ Without it the toolbar and signs will be disabled.
|
|||||||
|
|
||||||
The XPM library is provide by Arnaud Le Hors of the French National Institute
|
The XPM library is provide by Arnaud Le Hors of the French National Institute
|
||||||
for Research in Computer Science and Control. It can be downloaded from
|
for Research in Computer Science and Control. It can be downloaded from
|
||||||
http://koala.ilog.fr/ftp/pub/xpm. The current release, as of this writing, is
|
http://cgit.freedesktop.org/xorg/lib/libXpm. The current release, as of this
|
||||||
xpm-3.4k-solaris.tgz, which is a gzip'ed tar file. If you create the directory
|
writing, is xpm-3.4k-solaris.tgz, which is a gzip'ed tar file. If you create
|
||||||
/usr/local/xpm and untar the file there you can use the uncommented lines in
|
the directory /usr/local/xpm and untar the file there you can use the
|
||||||
the Makefile without changing them. If you use another xpm directory you will
|
uncommented lines in the Makefile without changing them. If you use another
|
||||||
need to change the XPM_DIR in src/Makefile.
|
xpm directory you will need to change the XPM_DIR in src/Makefile.
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
vim:tw=78:ts=8:ft=help:norl:
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: YAML (YAML Ain't Markup Language)
|
" Language: YAML (YAML Ain't Markup Language)
|
||||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||||
" Latest Revision: 2006-04-19
|
" Latest Revision: 2010-05-30
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
@@ -17,7 +17,7 @@ syn region yamlComment display oneline start='\%(^\|\s\)#' end='$'
|
|||||||
|
|
||||||
syn match yamlNodeProperty '!\%(![^\\^% ]\+\|[^!][^:/ ]*\)'
|
syn match yamlNodeProperty '!\%(![^\\^% ]\+\|[^!][^:/ ]*\)'
|
||||||
|
|
||||||
syn match yamlAnchor '&.\+'
|
syn match yamlAnchor '&[^ \t]\+'
|
||||||
|
|
||||||
syn match yamlAlias '\*.\+'
|
syn match yamlAlias '\*.\+'
|
||||||
|
|
||||||
|
19
src/eval.c
19
src/eval.c
@@ -731,6 +731,7 @@ static void f_tr __ARGS((typval_T *argvars, typval_T *rettv));
|
|||||||
static void f_trunc __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_trunc __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
#endif
|
#endif
|
||||||
static void f_type __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_type __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
|
static void f_undofile __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
static void f_values __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_values __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
static void f_virtcol __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_virtcol __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
static void f_visualmode __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_visualmode __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
@@ -7825,6 +7826,7 @@ static struct fst
|
|||||||
{"trunc", 1, 1, f_trunc},
|
{"trunc", 1, 1, f_trunc},
|
||||||
#endif
|
#endif
|
||||||
{"type", 1, 1, f_type},
|
{"type", 1, 1, f_type},
|
||||||
|
{"undofile", 1, 1, f_undofile},
|
||||||
{"values", 1, 1, f_values},
|
{"values", 1, 1, f_values},
|
||||||
{"virtcol", 1, 1, f_virtcol},
|
{"virtcol", 1, 1, f_virtcol},
|
||||||
{"visualmode", 0, 1, f_visualmode},
|
{"visualmode", 0, 1, f_visualmode},
|
||||||
@@ -17583,6 +17585,23 @@ f_type(argvars, rettv)
|
|||||||
rettv->vval.v_number = n;
|
rettv->vval.v_number = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "undofile(name)" function
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
f_undofile(argvars, rettv)
|
||||||
|
typval_T *argvars;
|
||||||
|
typval_T *rettv;
|
||||||
|
{
|
||||||
|
rettv->v_type = VAR_STRING;
|
||||||
|
#ifdef FEAT_PERSISTENT_UNDO
|
||||||
|
rettv->vval.v_string = u_get_undo_file_name(get_tv_string(&argvars[0]),
|
||||||
|
FALSE);
|
||||||
|
#else
|
||||||
|
rettv->vval.v_string = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "values(dict)" function
|
* "values(dict)" function
|
||||||
*/
|
*/
|
||||||
|
@@ -7,8 +7,9 @@ int u_inssub __ARGS((linenr_T lnum));
|
|||||||
int u_savedel __ARGS((linenr_T lnum, long nlines));
|
int u_savedel __ARGS((linenr_T lnum, long nlines));
|
||||||
int undo_allowed __ARGS((void));
|
int undo_allowed __ARGS((void));
|
||||||
void u_compute_hash __ARGS((char_u *hash));
|
void u_compute_hash __ARGS((char_u *hash));
|
||||||
void u_read_undo __ARGS((char_u *name, char_u *hash));
|
char_u *u_get_undo_file_name __ARGS((char_u *buf_ffname, int reading));
|
||||||
void u_write_undo __ARGS((char_u *name, int forceit, buf_T *buf, char_u *hash));
|
void u_write_undo __ARGS((char_u *name, int forceit, buf_T *buf, char_u *hash));
|
||||||
|
void u_read_undo __ARGS((char_u *name, char_u *hash));
|
||||||
void u_undo __ARGS((int count));
|
void u_undo __ARGS((int count));
|
||||||
void u_redo __ARGS((int count));
|
void u_redo __ARGS((int count));
|
||||||
void undo_time __ARGS((long step, int sec, int absolute));
|
void undo_time __ARGS((long step, int sec, int absolute));
|
||||||
|
@@ -100,7 +100,6 @@ static void u_freebranch __ARGS((buf_T *buf, u_header_T *uhp, u_header_T **uhpp)
|
|||||||
static void u_freeentries __ARGS((buf_T *buf, u_header_T *uhp, u_header_T **uhpp));
|
static void u_freeentries __ARGS((buf_T *buf, u_header_T *uhp, u_header_T **uhpp));
|
||||||
static void u_freeentry __ARGS((u_entry_T *, long));
|
static void u_freeentry __ARGS((u_entry_T *, long));
|
||||||
#ifdef FEAT_PERSISTENT_UNDO
|
#ifdef FEAT_PERSISTENT_UNDO
|
||||||
static char_u *u_get_undo_file_name __ARGS((char_u *, int reading));
|
|
||||||
static void corruption_error __ARGS((char *msg, char_u *file_name));
|
static void corruption_error __ARGS((char *msg, char_u *file_name));
|
||||||
static void u_free_uhp __ARGS((u_header_T *uhp));
|
static void u_free_uhp __ARGS((u_header_T *uhp));
|
||||||
static int serialize_uep __ARGS((u_entry_T *uep, FILE *fp));
|
static int serialize_uep __ARGS((u_entry_T *uep, FILE *fp));
|
||||||
@@ -698,7 +697,7 @@ u_compute_hash(hash)
|
|||||||
* When "reading" is FALSE use the first name where the directory exists.
|
* When "reading" is FALSE use the first name where the directory exists.
|
||||||
* Returns NULL when there is no place to write or no file to read.
|
* Returns NULL when there is no place to write or no file to read.
|
||||||
*/
|
*/
|
||||||
static char_u *
|
char_u *
|
||||||
u_get_undo_file_name(buf_ffname, reading)
|
u_get_undo_file_name(buf_ffname, reading)
|
||||||
char_u *buf_ffname;
|
char_u *buf_ffname;
|
||||||
int reading;
|
int reading;
|
||||||
|
Reference in New Issue
Block a user