mirror of
https://github.com/vim/vim.git
synced 2025-08-26 20:03:41 -04:00
updated for version 7.0037
This commit is contained in:
parent
f7889b6c73
commit
5f2bb9f584
@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 09
|
*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 11
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -223,7 +223,7 @@ and a variable name: >
|
|||||||
This works like: >
|
This works like: >
|
||||||
:let var1 = mylist[0]
|
:let var1 = mylist[0]
|
||||||
:let var2 = mylist[1]
|
:let var2 = mylist[1]
|
||||||
:let rest = mjlist[2:]
|
:let rest = mylist[2:]
|
||||||
|
|
||||||
Except that there is no error if there are only two items. "rest" will be an
|
Except that there is no error if there are only two items. "rest" will be an
|
||||||
empty list then.
|
empty list then.
|
||||||
@ -248,6 +248,7 @@ examples: >
|
|||||||
:call extend(list, [1, 2]) " extend the list with two more items
|
:call extend(list, [1, 2]) " extend the list with two more items
|
||||||
:let i = remove(list, 3) " remove item 3
|
:let i = remove(list, 3) " remove item 3
|
||||||
:let l = remove(list, 3, -1) " remove items 3 to last item
|
:let l = remove(list, 3, -1) " remove items 3 to last item
|
||||||
|
:call filter(list, #& =~ 'x'#) " remove items with an 'x'
|
||||||
|
|
||||||
Changing the oder of items in a list: >
|
Changing the oder of items in a list: >
|
||||||
:call sort(list) " sort a list alphabetically
|
:call sort(list) " sort a list alphabetically
|
||||||
@ -274,6 +275,9 @@ Note that all items in the list should be of the same type, otherwise this
|
|||||||
results in an error |E706|. To avoid this |:unlet| the variable at the end of
|
results in an error |E706|. To avoid this |:unlet| the variable at the end of
|
||||||
the loop.
|
the loop.
|
||||||
|
|
||||||
|
If all you want to do is modify each item in the list then the |map()|
|
||||||
|
function might be a simpler method than a for loop.
|
||||||
|
|
||||||
Just like the |:let| command, |:for| also accepts a list of variables. This
|
Just like the |:let| command, |:for| also accepts a list of variables. This
|
||||||
requires the argument to be a list of lists. >
|
requires the argument to be a list of lists. >
|
||||||
:for [lnum, col] in [[1, 3], [2, 8], [3, 0]]
|
:for [lnum, col] in [[1, 3], [2, 8], [3, 0]]
|
||||||
@ -304,8 +308,10 @@ Functions that are useful with a List: >
|
|||||||
:let i = index(list, 'x') " index of first 'x' in list
|
:let i = index(list, 'x') " index of first 'x' in list
|
||||||
:let lines = getline(1, 10) " get ten text lines from buffer
|
:let lines = getline(1, 10) " get ten text lines from buffer
|
||||||
:call append('$', lines) " append text lines in buffer
|
:call append('$', lines) " append text lines in buffer
|
||||||
:let list = str2list("a b c") " create list from items in a string
|
:let list = split("a b c") " create list from items in a string
|
||||||
|
:let string = join(list, ', ') " create string from list items
|
||||||
:let s = string() " String representation of a list
|
:let s = string() " String representation of a list
|
||||||
|
:call map(list, #'>> ' . &#) " prepend ">> " to each item
|
||||||
|
|
||||||
|
|
||||||
1.4 More about variables ~
|
1.4 More about variables ~
|
||||||
@ -377,6 +383,7 @@ Expression syntax summary, from least to most significant:
|
|||||||
|expr9| number number constant
|
|expr9| number number constant
|
||||||
"string" string constant, backslash is special
|
"string" string constant, backslash is special
|
||||||
'string' string constant
|
'string' string constant
|
||||||
|
#string# string constant
|
||||||
[expr1, ...] List
|
[expr1, ...] List
|
||||||
&option option value
|
&option option value
|
||||||
(expr1) nested expression
|
(expr1) nested expression
|
||||||
@ -676,8 +683,8 @@ literal-string *literal-string* *E115*
|
|||||||
Note that single quotes are used.
|
Note that single quotes are used.
|
||||||
|
|
||||||
This string is taken as it is. No backslashes are removed or have a special
|
This string is taken as it is. No backslashes are removed or have a special
|
||||||
meaning. A literal-string cannot contain a single quote. Use a normal,
|
meaning. A literal-string cannot contain a single quote. Use a double-quoted
|
||||||
double-quoted string for that.
|
string or sharp-string for that.
|
||||||
|
|
||||||
Single quoted strings are useful for patterns, so that backslashes do not need
|
Single quoted strings are useful for patterns, so that backslashes do not need
|
||||||
to be doubled. These two commands are equivalent: >
|
to be doubled. These two commands are equivalent: >
|
||||||
@ -685,6 +692,17 @@ to be doubled. These two commands are equivalent: >
|
|||||||
if a =~ '\s*'
|
if a =~ '\s*'
|
||||||
|
|
||||||
|
|
||||||
|
sharp-string *sharp-string*
|
||||||
|
---------------
|
||||||
|
#string# string constant *expr-#*
|
||||||
|
|
||||||
|
Most characters in the string are taken as-is. Only the '#' character is
|
||||||
|
special: It needs to be double to get one.
|
||||||
|
|
||||||
|
Sharp-strings are useful when a string may contain single quotes, double
|
||||||
|
quotes and/or backslashes.
|
||||||
|
|
||||||
|
|
||||||
option *expr-option* *E112* *E113*
|
option *expr-option* *E112* *E113*
|
||||||
------
|
------
|
||||||
&option option value, local value if possible
|
&option option value, local value if possible
|
||||||
@ -1146,7 +1164,8 @@ col( {expr}) Number column nr of cursor or mark
|
|||||||
confirm( {msg} [, {choices} [, {default} [, {type}]]])
|
confirm( {msg} [, {choices} [, {default} [, {type}]]])
|
||||||
Number number of choice picked by user
|
Number number of choice picked by user
|
||||||
copy( {expr}) any make a shallow copy of {expr}
|
copy( {expr}) any make a shallow copy of {expr}
|
||||||
count( {list}, {expr} [, {ic}]) Number count how many {expr} are in {list}
|
count( {list}, {expr} [, {start} [, {ic}]])
|
||||||
|
Number count how many {expr} are in {list}
|
||||||
cscope_connection( [{num} , {dbpath} [, {prepend}]])
|
cscope_connection( [{num} , {dbpath} [, {prepend}]])
|
||||||
Number checks existence of cscope connection
|
Number checks existence of cscope connection
|
||||||
cursor( {lnum}, {col}) Number position cursor at {lnum}, {col}
|
cursor( {lnum}, {col}) Number position cursor at {lnum}, {col}
|
||||||
@ -1157,13 +1176,17 @@ diff_filler( {lnum}) Number diff filler lines about {lnum}
|
|||||||
diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col}
|
diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col}
|
||||||
empty( {expr}) Number TRUE if {expr} is empty
|
empty( {expr}) Number TRUE if {expr} is empty
|
||||||
escape( {string}, {chars}) String escape {chars} in {string} with '\'
|
escape( {string}, {chars}) String escape {chars} in {string} with '\'
|
||||||
|
eval( {string}) any evaluate {string} into its value
|
||||||
eventhandler( ) Number TRUE if inside an event handler
|
eventhandler( ) Number TRUE if inside an event handler
|
||||||
executable( {expr}) Number 1 if executable {expr} exists
|
executable( {expr}) Number 1 if executable {expr} exists
|
||||||
exists( {expr}) Number TRUE if {expr} exists
|
exists( {expr}) Number TRUE if {expr} exists
|
||||||
expand( {expr}) String expand special keywords in {expr}
|
expand( {expr}) String expand special keywords in {expr}
|
||||||
filereadable( {file}) Number TRUE if {file} is a readable file
|
filereadable( {file}) Number TRUE if {file} is a readable file
|
||||||
|
filter( {list}, {expr}) List remove from {list} where {expr} is 0
|
||||||
|
finddir( {name}[, {path}[, {count}]])
|
||||||
|
String Find directory {name} in {path}
|
||||||
findfile( {name}[, {path}[, {count}]])
|
findfile( {name}[, {path}[, {count}]])
|
||||||
String Find fine {name} in {path}
|
String Find file {name} in {path}
|
||||||
filewritable( {file}) Number TRUE if {file} is a writable file
|
filewritable( {file}) Number TRUE if {file} is a writable file
|
||||||
fnamemodify( {fname}, {mods}) String modify file name
|
fnamemodify( {fname}, {mods}) String modify file name
|
||||||
foldclosed( {lnum}) Number first line of fold at {lnum} if closed
|
foldclosed( {lnum}) Number first line of fold at {lnum} if closed
|
||||||
@ -1203,7 +1226,8 @@ hlID( {name}) Number syntax ID of highlight group {name}
|
|||||||
hostname() String name of the machine Vim is running on
|
hostname() String name of the machine Vim is running on
|
||||||
iconv( {expr}, {from}, {to}) String convert encoding of {expr}
|
iconv( {expr}, {from}, {to}) String convert encoding of {expr}
|
||||||
indent( {lnum}) Number indent of line {lnum}
|
indent( {lnum}) Number indent of line {lnum}
|
||||||
index( {list}, {expr} [, {ic}]) Number index in {list} where {expr} appears
|
index( {list}, {expr} [, {start} [, {ic}]])
|
||||||
|
Number index in {list} where {expr} appears
|
||||||
input( {prompt} [, {text}]) String get input from the user
|
input( {prompt} [, {text}]) String get input from the user
|
||||||
inputdialog( {p} [, {t} [, {c}]]) String like input() but in a GUI dialog
|
inputdialog( {p} [, {t} [, {c}]]) String like input() but in a GUI dialog
|
||||||
inputrestore() Number restore typeahead
|
inputrestore() Number restore typeahead
|
||||||
@ -1211,6 +1235,7 @@ inputsave() Number save and clear typeahead
|
|||||||
inputsecret( {prompt} [, {text}]) String like input() but hiding the text
|
inputsecret( {prompt} [, {text}]) String like input() but hiding the text
|
||||||
insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}]
|
insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}]
|
||||||
isdirectory( {directory}) Number TRUE if {directory} is a directory
|
isdirectory( {directory}) Number TRUE if {directory} is a directory
|
||||||
|
join( {list} [, {sep}]) String join {list} items into one String
|
||||||
len( {expr}) Number the length of {expr}
|
len( {expr}) Number the length of {expr}
|
||||||
libcall( {lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
|
libcall( {lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
|
||||||
libcallnr( {lib}, {func}, {arg}) Number idem, but return a Number
|
libcallnr( {lib}, {func}, {arg}) Number idem, but return a Number
|
||||||
@ -1218,6 +1243,7 @@ line( {expr}) Number line nr of cursor, last line or mark
|
|||||||
line2byte( {lnum}) Number byte count of line {lnum}
|
line2byte( {lnum}) Number byte count of line {lnum}
|
||||||
lispindent( {lnum}) Number Lisp indent for line {lnum}
|
lispindent( {lnum}) Number Lisp indent for line {lnum}
|
||||||
localtime() Number current time
|
localtime() Number current time
|
||||||
|
map( {list}, {expr}) List change each item in {list} to {expr}
|
||||||
maparg( {name}[, {mode}]) String rhs of mapping {name} in mode {mode}
|
maparg( {name}[, {mode}]) String rhs of mapping {name} in mode {mode}
|
||||||
mapcheck( {name}[, {mode}]) String check for mappings matching {name}
|
mapcheck( {name}[, {mode}]) String check for mappings matching {name}
|
||||||
match( {expr}, {pat}[, {start}[, {count}]])
|
match( {expr}, {pat}[, {start}[, {count}]])
|
||||||
@ -1258,10 +1284,10 @@ setreg( {n}, {v}[, {opt}]) Number set register to value and type
|
|||||||
setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val}
|
setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val}
|
||||||
simplify( {filename}) String simplify filename as much as possible
|
simplify( {filename}) String simplify filename as much as possible
|
||||||
sort( {list} [, {func}]) List sort {list}, using {func} to compare
|
sort( {list} [, {func}]) List sort {list}, using {func} to compare
|
||||||
str2list( {expr} [, {pat}]) List make List from {pat} separated {expr}
|
split( {expr} [, {pat}]) List make List from {pat} separated {expr}
|
||||||
strftime( {format}[, {time}]) String time in specified format
|
strftime( {format}[, {time}]) String time in specified format
|
||||||
stridx( {haystack}, {needle}) Number first index of {needle} in {haystack}
|
stridx( {haystack}, {needle}) Number first index of {needle} in {haystack}
|
||||||
string( {expr}) String {expr} converted to a String
|
string( {expr}) String String representation of {expr} value
|
||||||
strlen( {expr}) Number length of the String {expr}
|
strlen( {expr}) Number length of the String {expr}
|
||||||
strpart( {src}, {start}[, {len}])
|
strpart( {src}, {start}[, {len}])
|
||||||
String {len} characters of {src} at {start}
|
String {len} characters of {src} at {start}
|
||||||
@ -1571,9 +1597,10 @@ copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
|
|||||||
changing an item changes the contents of both Lists. Also see
|
changing an item changes the contents of both Lists. Also see
|
||||||
|deepcopy()|.
|
|deepcopy()|.
|
||||||
|
|
||||||
count({list}, {expr} [, {ic}]) *count()*
|
count({list}, {expr} [, {start} [, {ic}]]) *count()*
|
||||||
Return the number of times an item with value {expr} appears
|
Return the number of times an item with value {expr} appears
|
||||||
in List {list}.
|
in List {list}.
|
||||||
|
If {start} is given then don't count items with a lower index.
|
||||||
When {ic} is given and it's non-zero then case is ignored.
|
When {ic} is given and it's non-zero then case is ignored.
|
||||||
|
|
||||||
|
|
||||||
@ -1690,7 +1717,13 @@ escape({string}, {chars}) *escape()*
|
|||||||
:echo escape('c:\program files\vim', ' \')
|
:echo escape('c:\program files\vim', ' \')
|
||||||
< results in: >
|
< results in: >
|
||||||
c:\\program\ files\\vim
|
c:\\program\ files\\vim
|
||||||
<
|
|
||||||
|
< *eval()*
|
||||||
|
eval({string}) Evaluate {string} and return the result. Especially useful to
|
||||||
|
turn the result of |string()| back into the original value.
|
||||||
|
This works for Numbers, Strings and composites of them.
|
||||||
|
Also works for Funcrefs that refer to existing functions.
|
||||||
|
|
||||||
eventhandler() *eventhandler()*
|
eventhandler() *eventhandler()*
|
||||||
Returns 1 when inside an event handler. That is that Vim got
|
Returns 1 when inside an event handler. That is that Vim got
|
||||||
interrupted while waiting for the user to type a character,
|
interrupted while waiting for the user to type a character,
|
||||||
@ -1845,7 +1878,7 @@ extend({list1}, {list2} [, {idx}]) *extend()*
|
|||||||
Append {list2} to {list1}.
|
Append {list2} to {list1}.
|
||||||
If {idx} is given insert the items of {list2} before item
|
If {idx} is given insert the items of {list2} before item
|
||||||
{idx} in {list1}. When {idx} is zero insert before the first
|
{idx} in {list1}. When {idx} is zero insert before the first
|
||||||
item. When {idx} is equal to len({list1}) {list2} is
|
item. When {idx} is equal to len({list1}) then {list2} is
|
||||||
appended.
|
appended.
|
||||||
{list1} is changed when {list2} is not empty.
|
{list1} is changed when {list2} is not empty.
|
||||||
{list2} remains unchanged.
|
{list2} remains unchanged.
|
||||||
@ -1866,6 +1899,23 @@ filereadable({file}) *filereadable()*
|
|||||||
*file_readable()*
|
*file_readable()*
|
||||||
Obsolete name: file_readable().
|
Obsolete name: file_readable().
|
||||||
|
|
||||||
|
|
||||||
|
filter({list}, {expr}) *filter()* *E712*
|
||||||
|
For each item in {list} evaluate {expr} and when the result is
|
||||||
|
zero remove the item from the List.
|
||||||
|
Inside {expr} the symbol "&" stands for the existing
|
||||||
|
item. Example: >
|
||||||
|
:call filter(mylist, #& !~ "OLD"#)
|
||||||
|
< Removes the items where "OLD" appears.
|
||||||
|
Note that {expr} is an expression that evaluates to an
|
||||||
|
expression. Often it is good to use a |sharp-string| to avoid
|
||||||
|
having to double backslashes.
|
||||||
|
The operation is done in-place. If you want a list to remain
|
||||||
|
unmodified make a copy first: >
|
||||||
|
:let l = filter(copy(mylist), #& =~ "KEEP"#)
|
||||||
|
< Returns {list}.
|
||||||
|
|
||||||
|
|
||||||
finddir({name}[, {path}[, {count}]]) *finddir()*
|
finddir({name}[, {path}[, {count}]]) *finddir()*
|
||||||
Find directory {name} in {path}.
|
Find directory {name} in {path}.
|
||||||
If {path} is omitted or empty then 'path' is used.
|
If {path} is omitted or empty then 'path' is used.
|
||||||
@ -2036,7 +2086,7 @@ getcmdline() *getcmdline()*
|
|||||||
:cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
|
:cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
|
||||||
< Also see |getcmdpos()| and |setcmdpos()|.
|
< Also see |getcmdpos()| and |setcmdpos()|.
|
||||||
|
|
||||||
getcmdpos({pos}) *getcmdpos()*
|
getcmdpos() *getcmdpos()*
|
||||||
Return the position of the cursor in the command line as a
|
Return the position of the cursor in the command line as a
|
||||||
byte count. The first column is 1.
|
byte count. The first column is 1.
|
||||||
Only works when editing the command line, thus requires use of
|
Only works when editing the command line, thus requires use of
|
||||||
@ -2358,9 +2408,10 @@ indent({lnum}) The result is a Number, which is indent of line {lnum} in the
|
|||||||
When {lnum} is invalid -1 is returned.
|
When {lnum} is invalid -1 is returned.
|
||||||
|
|
||||||
|
|
||||||
index({list}, {expr} [, {ic}]) *index()*
|
index({list}, {expr} [, {start} [, {ic}]]) *index()*
|
||||||
Return the lowest index in List {list} where the item has a
|
Return the lowest index in List {list} where the item has a
|
||||||
value equal to {expr}.
|
value equal to {expr}.
|
||||||
|
If {start} is given then skip items with a lower index.
|
||||||
When {ic} is given and it is non-zero, ignore case. Otherwise
|
When {ic} is given and it is non-zero, ignore case. Otherwise
|
||||||
case must match.
|
case must match.
|
||||||
-1 is returned when {expr} is not found in {list}.
|
-1 is returned when {expr} is not found in {list}.
|
||||||
@ -2461,6 +2512,18 @@ isdirectory({directory}) *isdirectory()*
|
|||||||
exist, or isn't a directory, the result is FALSE. {directory}
|
exist, or isn't a directory, the result is FALSE. {directory}
|
||||||
is any expression, which is used as a String.
|
is any expression, which is used as a String.
|
||||||
|
|
||||||
|
|
||||||
|
join({list} [, {sep}]) *join()*
|
||||||
|
Join the items in {list} together into one String.
|
||||||
|
When {sep} is specified it is put in between the items. If
|
||||||
|
{sep} is omitted a single space is used.
|
||||||
|
Note that {sep} is not added at the end. You might want to
|
||||||
|
add it there too: >
|
||||||
|
let lines = join(mylist, "\n") . "\n"
|
||||||
|
< String items are used as-is. Lists and Dictionaries are
|
||||||
|
converted into a string like with |string()|.
|
||||||
|
The opposite function is |split()|.
|
||||||
|
|
||||||
*len()* *E701*
|
*len()* *E701*
|
||||||
len({expr}) The result is a Number, which is the length of the argument.
|
len({expr}) The result is a Number, which is the length of the argument.
|
||||||
When {expr} is a String or a Number the length in bytes is
|
When {expr} is a String or a Number the length in bytes is
|
||||||
@ -2568,6 +2631,23 @@ localtime() *localtime()*
|
|||||||
Return the current time, measured as seconds since 1st Jan
|
Return the current time, measured as seconds since 1st Jan
|
||||||
1970. See also |strftime()| and |getftime()|.
|
1970. See also |strftime()| and |getftime()|.
|
||||||
|
|
||||||
|
|
||||||
|
map({list}, {expr}) *map()*
|
||||||
|
Replace each item in {list} with the result of evaluating
|
||||||
|
{expr}.
|
||||||
|
Inside {expr} the symbol "&" stands for the existing
|
||||||
|
item. Example: >
|
||||||
|
:call map(mylist, #"> " . & . " <"#)
|
||||||
|
< This puts "> " before and " <" after each item in "mylist".
|
||||||
|
Note that {expr} is an expression that evaluates to an
|
||||||
|
expression. Often it is good to use a |sharp-string| to avoid
|
||||||
|
having to double backslashes.
|
||||||
|
The operation is done in-place. If you want a list to remain
|
||||||
|
unmodified make a copy first: >
|
||||||
|
:let tlist = map(copy(mylist), # & . "\t"#)
|
||||||
|
< Returns {list}.
|
||||||
|
|
||||||
|
|
||||||
maparg({name}[, {mode}]) *maparg()*
|
maparg({name}[, {mode}]) *maparg()*
|
||||||
Return the rhs of mapping {name} in mode {mode}. When there
|
Return the rhs of mapping {name} in mode {mode}. When there
|
||||||
is no mapping for {name}, an empty String is returned.
|
is no mapping for {name}, an empty String is returned.
|
||||||
@ -2617,29 +2697,40 @@ mapcheck({name}[, {mode}]) *mapcheck()*
|
|||||||
mapping for "_v" or for "_vvv".
|
mapping for "_v" or for "_vvv".
|
||||||
|
|
||||||
match({expr}, {pat}[, {start}[, {count}]]) *match()*
|
match({expr}, {pat}[, {start}[, {count}]]) *match()*
|
||||||
The result is a Number, which gives the index (byte offset) in
|
When {expr} is a List then this returns the index of the first
|
||||||
{expr} where {pat} matches.
|
item where {pat} matches. Each item is used as a String,
|
||||||
A match at the first character returns zero.
|
Lists and Dictionaries are used as echoed.
|
||||||
|
Otherwise, {expr} is used as a String. The result is a
|
||||||
|
Number, which gives the index (byte offset) in {expr} where
|
||||||
|
{pat} matches.
|
||||||
|
A match at the first character or List item returns zero.
|
||||||
If there is no match -1 is returned.
|
If there is no match -1 is returned.
|
||||||
Example: >
|
Example: >
|
||||||
:echo match("testing", "ing")
|
:echo match("testing", "ing") " results in 4
|
||||||
< results in "4".
|
:echo match([1, 'x'], '\a') " results in 2
|
||||||
See |string-match| for how {pat} is used.
|
< See |string-match| for how {pat} is used.
|
||||||
|
|
||||||
When {count} is given use the {count}'th match. When a match
|
When {count} is given use the {count}'th match. When a match
|
||||||
is found the search for the next one starts on character
|
is found in a String the search for the next one starts on
|
||||||
further. Thus this example results in 1: >
|
character further. Thus this example results in 1: >
|
||||||
echo match("testing", "..", 0, 2)
|
echo match("testing", "..", 0, 2)
|
||||||
< If {start} is given, the search starts from index {start}.
|
< In a List the search continues in the next item.
|
||||||
|
|
||||||
|
If {start} is given, the search starts from byte index
|
||||||
|
{start} in a String or item {start} in a List.
|
||||||
The result, however, is still the index counted from the
|
The result, however, is still the index counted from the
|
||||||
first character. Example: >
|
first character/item. Example: >
|
||||||
:echo match("testing", "ing", 2)
|
:echo match("testing", "ing", 2)
|
||||||
< result is again "4". >
|
< result is again "4". >
|
||||||
:echo match("testing", "ing", 4)
|
:echo match("testing", "ing", 4)
|
||||||
< result is again "4". >
|
< result is again "4". >
|
||||||
:echo match("testing", "t", 2)
|
:echo match("testing", "t", 2)
|
||||||
< result is "3".
|
< result is "3".
|
||||||
If {start} < 0, it will be set to 0.
|
For a String, if {start} < 0, it will be set to 0. For a list
|
||||||
If {start} > strlen({expr}) -1 is returned.
|
the index is counted from the end.
|
||||||
|
If {start} is out of range (> strlen({expr} for a String or
|
||||||
|
> len({expr} for a List) -1 is returned.
|
||||||
|
|
||||||
See |pattern| for the patterns that are accepted.
|
See |pattern| for the patterns that are accepted.
|
||||||
The 'ignorecase' option is used to set the ignore-caseness of
|
The 'ignorecase' option is used to set the ignore-caseness of
|
||||||
the pattern. 'smartcase' is NOT used. The matching is always
|
the pattern. 'smartcase' is NOT used. The matching is always
|
||||||
@ -2655,6 +2746,7 @@ matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()*
|
|||||||
< results in "7". >
|
< results in "7". >
|
||||||
:echo matchend("testing", "ing", 5)
|
:echo matchend("testing", "ing", 5)
|
||||||
< result is "-1".
|
< result is "-1".
|
||||||
|
When {expr} is a List the result is equal to match().
|
||||||
|
|
||||||
matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()*
|
matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()*
|
||||||
Same as match(), but return the matched string. Example: >
|
Same as match(), but return the matched string. Example: >
|
||||||
@ -2666,6 +2758,8 @@ matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()*
|
|||||||
< results in "ing". >
|
< results in "ing". >
|
||||||
:echo matchstr("testing", "ing", 5)
|
:echo matchstr("testing", "ing", 5)
|
||||||
< result is "".
|
< result is "".
|
||||||
|
When {expr} is a List then the matching item is returned.
|
||||||
|
The type isn't changed, it's not necessarily a String.
|
||||||
|
|
||||||
*max()*
|
*max()*
|
||||||
max({list}) Return the maximum value of all items in {list}.
|
max({list}) Return the maximum value of all items in {list}.
|
||||||
@ -3076,6 +3170,7 @@ sort({list} [, {func}]) *sort()* *E702*
|
|||||||
want a list to remain unmodified make a copy first: >
|
want a list to remain unmodified make a copy first: >
|
||||||
:let sortedlist = sort(copy(mylist))
|
:let sortedlist = sort(copy(mylist))
|
||||||
< Uses the string representation of each item to sort on.
|
< Uses the string representation of each item to sort on.
|
||||||
|
Numbers sort after Strings, Lists after Numbers.
|
||||||
When {func} is given and it is one then case is ignored.
|
When {func} is given and it is one then case is ignored.
|
||||||
When {func} is a Funcref or a function name, this function is
|
When {func} is a Funcref or a function name, this function is
|
||||||
called to compare items. The function is invoked with two
|
called to compare items. The function is invoked with two
|
||||||
@ -3087,15 +3182,16 @@ sort({list} [, {func}]) *sort()* *E702*
|
|||||||
endfunc
|
endfunc
|
||||||
let sortedlist = sort(mylist, "MyCompare")
|
let sortedlist = sort(mylist, "MyCompare")
|
||||||
|
|
||||||
str2list({expr} [, {pattern}]) *str2list()*
|
split({expr} [, {pattern}]) *split()*
|
||||||
Make a List out of {expr}. When {pattern} is omitted each
|
Make a List out of {expr}. When {pattern} is omitted each
|
||||||
white-separated sequence of characters becomes an item.
|
white-separated sequence of characters becomes an item.
|
||||||
Otherwise the string is split where {pattern} matches,
|
Otherwise the string is split where {pattern} matches,
|
||||||
removing the matched characters. Empty strings are omitted.
|
removing the matched characters. Empty strings are omitted.
|
||||||
Example: >
|
Example: >
|
||||||
:let words = str2list(getline('.'), '\W\+')
|
:let words = split(getline('.'), '\W\+')
|
||||||
< Since empty strings are not added the "\+" isn't required but
|
< Since empty strings are not added the "\+" isn't required but
|
||||||
it makes the function work a bit faster.
|
it makes the function work a bit faster.
|
||||||
|
The opposite function is |join()|.
|
||||||
|
|
||||||
|
|
||||||
strftime({format} [, {time}]) *strftime()*
|
strftime({format} [, {time}]) *strftime()*
|
||||||
@ -3129,14 +3225,15 @@ stridx({haystack}, {needle}) *stridx()*
|
|||||||
:echo stridx("Starting point", "start") -1
|
:echo stridx("Starting point", "start") -1
|
||||||
<
|
<
|
||||||
*string()*
|
*string()*
|
||||||
string({expr}) Return {expr} converted to a String.
|
string({expr}) Return {expr} converted to a String. If {expr} is a Number,
|
||||||
|
String or a composition of them, then the result can be parsed
|
||||||
|
back with |eval()|.
|
||||||
{expr} type result ~
|
{expr} type result ~
|
||||||
String identical
|
String #string#
|
||||||
Number decimal representation
|
Number 123
|
||||||
Funcref name of the function
|
Funcref function(#name#)
|
||||||
List "[item, item]" form
|
List [item, item]
|
||||||
Note that string values are not in quotes, thus the result
|
Note that in String values the # character is doubled.
|
||||||
can't be parsed back to a List.
|
|
||||||
|
|
||||||
*strlen()*
|
*strlen()*
|
||||||
strlen({expr}) The result is a Number, which is the length of the String
|
strlen({expr}) The result is a Number, which is the length of the String
|
||||||
|
@ -3600,7 +3600,12 @@ E704 eval.txt /*E704*
|
|||||||
E705 eval.txt /*E705*
|
E705 eval.txt /*E705*
|
||||||
E706 eval.txt /*E706*
|
E706 eval.txt /*E706*
|
||||||
E707 eval.txt /*E707*
|
E707 eval.txt /*E707*
|
||||||
|
E708 eval.txt /*E708*
|
||||||
|
E709 eval.txt /*E709*
|
||||||
E71 pattern.txt /*E71*
|
E71 pattern.txt /*E71*
|
||||||
|
E710 eval.txt /*E710*
|
||||||
|
E711 eval.txt /*E711*
|
||||||
|
E712 eval.txt /*E712*
|
||||||
E72 message.txt /*E72*
|
E72 message.txt /*E72*
|
||||||
E73 tagsrch.txt /*E73*
|
E73 tagsrch.txt /*E73*
|
||||||
E74 message.txt /*E74*
|
E74 message.txt /*E74*
|
||||||
@ -4576,6 +4581,7 @@ escape intro.txt /*escape*
|
|||||||
escape() eval.txt /*escape()*
|
escape() eval.txt /*escape()*
|
||||||
escape-bar version4.txt /*escape-bar*
|
escape-bar version4.txt /*escape-bar*
|
||||||
eval eval.txt /*eval*
|
eval eval.txt /*eval*
|
||||||
|
eval() eval.txt /*eval()*
|
||||||
eval-examples eval.txt /*eval-examples*
|
eval-examples eval.txt /*eval-examples*
|
||||||
eval-sandbox eval.txt /*eval-sandbox*
|
eval-sandbox eval.txt /*eval-sandbox*
|
||||||
eval.txt eval.txt /*eval.txt*
|
eval.txt eval.txt /*eval.txt*
|
||||||
@ -4623,6 +4629,7 @@ expr-!=? eval.txt /*expr-!=?*
|
|||||||
expr-!~ eval.txt /*expr-!~*
|
expr-!~ eval.txt /*expr-!~*
|
||||||
expr-!~# eval.txt /*expr-!~#*
|
expr-!~# eval.txt /*expr-!~#*
|
||||||
expr-!~? eval.txt /*expr-!~?*
|
expr-!~? eval.txt /*expr-!~?*
|
||||||
|
expr-# eval.txt /*expr-#*
|
||||||
expr-% eval.txt /*expr-%*
|
expr-% eval.txt /*expr-%*
|
||||||
expr-&& eval.txt /*expr-&&*
|
expr-&& eval.txt /*expr-&&*
|
||||||
expr-' eval.txt /*expr-'*
|
expr-' eval.txt /*expr-'*
|
||||||
@ -4713,6 +4720,7 @@ filetypedetect-changed version6.txt /*filetypedetect-changed*
|
|||||||
filetypes filetype.txt /*filetypes*
|
filetypes filetype.txt /*filetypes*
|
||||||
filewritable() eval.txt /*filewritable()*
|
filewritable() eval.txt /*filewritable()*
|
||||||
filter change.txt /*filter*
|
filter change.txt /*filter*
|
||||||
|
filter() eval.txt /*filter()*
|
||||||
find-manpage usr_12.txt /*find-manpage*
|
find-manpage usr_12.txt /*find-manpage*
|
||||||
find-replace usr_10.txt /*find-replace*
|
find-replace usr_10.txt /*find-replace*
|
||||||
finddir() eval.txt /*finddir()*
|
finddir() eval.txt /*finddir()*
|
||||||
@ -5276,6 +5284,7 @@ java-cinoptions indent.txt /*java-cinoptions*
|
|||||||
java-indenting indent.txt /*java-indenting*
|
java-indenting indent.txt /*java-indenting*
|
||||||
java-syntax syntax.txt /*java-syntax*
|
java-syntax syntax.txt /*java-syntax*
|
||||||
java.vim syntax.txt /*java.vim*
|
java.vim syntax.txt /*java.vim*
|
||||||
|
join() eval.txt /*join()*
|
||||||
jsbterm-mouse options.txt /*jsbterm-mouse*
|
jsbterm-mouse options.txt /*jsbterm-mouse*
|
||||||
jtags tagsrch.txt /*jtags*
|
jtags tagsrch.txt /*jtags*
|
||||||
jump-motions motion.txt /*jump-motions*
|
jump-motions motion.txt /*jump-motions*
|
||||||
@ -5381,6 +5390,7 @@ make-syntax syntax.txt /*make-syntax*
|
|||||||
make.vim syntax.txt /*make.vim*
|
make.vim syntax.txt /*make.vim*
|
||||||
man-plugin filetype.txt /*man-plugin*
|
man-plugin filetype.txt /*man-plugin*
|
||||||
manual-copyright usr_01.txt /*manual-copyright*
|
manual-copyright usr_01.txt /*manual-copyright*
|
||||||
|
map() eval.txt /*map()*
|
||||||
map-<SID> map.txt /*map-<SID>*
|
map-<SID> map.txt /*map-<SID>*
|
||||||
map-ambiguous map.txt /*map-ambiguous*
|
map-ambiguous map.txt /*map-ambiguous*
|
||||||
map-backtick tips.txt /*map-backtick*
|
map-backtick tips.txt /*map-backtick*
|
||||||
@ -5418,6 +5428,7 @@ match-highlight pattern.txt /*match-highlight*
|
|||||||
matchend() eval.txt /*matchend()*
|
matchend() eval.txt /*matchend()*
|
||||||
matchit-install usr_05.txt /*matchit-install*
|
matchit-install usr_05.txt /*matchit-install*
|
||||||
matchstr() eval.txt /*matchstr()*
|
matchstr() eval.txt /*matchstr()*
|
||||||
|
max() eval.txt /*max()*
|
||||||
mbyte-IME mbyte.txt /*mbyte-IME*
|
mbyte-IME mbyte.txt /*mbyte-IME*
|
||||||
mbyte-XIM mbyte.txt /*mbyte-XIM*
|
mbyte-XIM mbyte.txt /*mbyte-XIM*
|
||||||
mbyte-conversion mbyte.txt /*mbyte-conversion*
|
mbyte-conversion mbyte.txt /*mbyte-conversion*
|
||||||
@ -5441,6 +5452,7 @@ message-history message.txt /*message-history*
|
|||||||
message.txt message.txt /*message.txt*
|
message.txt message.txt /*message.txt*
|
||||||
messages message.txt /*messages*
|
messages message.txt /*messages*
|
||||||
meta intro.txt /*meta*
|
meta intro.txt /*meta*
|
||||||
|
min() eval.txt /*min()*
|
||||||
minimal-features os_msdos.txt /*minimal-features*
|
minimal-features os_msdos.txt /*minimal-features*
|
||||||
missing-commands vi_diff.txt /*missing-commands*
|
missing-commands vi_diff.txt /*missing-commands*
|
||||||
missing-options vi_diff.txt /*missing-options*
|
missing-options vi_diff.txt /*missing-options*
|
||||||
@ -6048,6 +6060,7 @@ sgml-syntax syntax.txt /*sgml-syntax*
|
|||||||
sgml.vim syntax.txt /*sgml.vim*
|
sgml.vim syntax.txt /*sgml.vim*
|
||||||
sh-syntax syntax.txt /*sh-syntax*
|
sh-syntax syntax.txt /*sh-syntax*
|
||||||
sh.vim syntax.txt /*sh.vim*
|
sh.vim syntax.txt /*sh.vim*
|
||||||
|
sharp-string eval.txt /*sharp-string*
|
||||||
shell-window tips.txt /*shell-window*
|
shell-window tips.txt /*shell-window*
|
||||||
shell_error-variable eval.txt /*shell_error-variable*
|
shell_error-variable eval.txt /*shell_error-variable*
|
||||||
shift intro.txt /*shift*
|
shift intro.txt /*shift*
|
||||||
@ -6081,6 +6094,7 @@ spec_chglog_prepend pi_spec.txt /*spec_chglog_prepend*
|
|||||||
spec_chglog_release_info pi_spec.txt /*spec_chglog_release_info*
|
spec_chglog_release_info pi_spec.txt /*spec_chglog_release_info*
|
||||||
special-buffers windows.txt /*special-buffers*
|
special-buffers windows.txt /*special-buffers*
|
||||||
speed-up tips.txt /*speed-up*
|
speed-up tips.txt /*speed-up*
|
||||||
|
split() eval.txt /*split()*
|
||||||
splitfind windows.txt /*splitfind*
|
splitfind windows.txt /*splitfind*
|
||||||
splitview windows.txt /*splitview*
|
splitview windows.txt /*splitview*
|
||||||
sponsor sponsor.txt /*sponsor*
|
sponsor sponsor.txt /*sponsor*
|
||||||
@ -6107,7 +6121,6 @@ startup-terminal term.txt /*startup-terminal*
|
|||||||
static-tag tagsrch.txt /*static-tag*
|
static-tag tagsrch.txt /*static-tag*
|
||||||
status-line windows.txt /*status-line*
|
status-line windows.txt /*status-line*
|
||||||
statusmsg-variable eval.txt /*statusmsg-variable*
|
statusmsg-variable eval.txt /*statusmsg-variable*
|
||||||
str2list() eval.txt /*str2list()*
|
|
||||||
strftime() eval.txt /*strftime()*
|
strftime() eval.txt /*strftime()*
|
||||||
stridx() eval.txt /*stridx()*
|
stridx() eval.txt /*stridx()*
|
||||||
string() eval.txt /*string()*
|
string() eval.txt /*string()*
|
||||||
|
38
runtime/keymap/polish-slash_iso-8859-2.vim
Normal file
38
runtime/keymap/polish-slash_iso-8859-2.vim
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
" Polish letters keymap for iso-8859-2
|
||||||
|
" Maintainer: HS6_06 <hs6_06@o2.pl>
|
||||||
|
" Last Changed: 2005 Jan 9
|
||||||
|
|
||||||
|
" This keymap adds the special Polish letters
|
||||||
|
" to an existing Latin keyboard.
|
||||||
|
" All chars as usual except:
|
||||||
|
" Polish:
|
||||||
|
" instead of AltGr+{acelnosxz} you ve to use "/" followed by {acelnosxz}
|
||||||
|
|
||||||
|
" short keymap name for statusline
|
||||||
|
let b:keymap_name = "polish-slash-iso-8859-2"
|
||||||
|
|
||||||
|
scriptencoding latin1
|
||||||
|
|
||||||
|
loadkeymap
|
||||||
|
|
||||||
|
" Polish letters
|
||||||
|
/a <Char-177> " LATIN SMALL LETTER A WITH OGONEK
|
||||||
|
/c <Char-230> " LATIN SMALL LETTER C WITH ACUTE
|
||||||
|
/e <Char-234> " LATIN SMALL LETTER E WITH OGONEK
|
||||||
|
/l <Char-179> " LATIN SMALL LETTER L WITH STROKE
|
||||||
|
/n <Char-241> " LATIN SMALL LETTER N WITH ACUTE
|
||||||
|
/o <Char-243> " LATIN SMALL LETTER O WITH ACUTE
|
||||||
|
/s <Char-182> " LATIN SMALL LETTER S WITH ACUTE
|
||||||
|
/x <Char-188> " LATIN SMALL LETTER Z WITH ACUTE
|
||||||
|
/z <Char-191> " LATIN SMALL LETTER Z WITH DOT ABOVE
|
||||||
|
|
||||||
|
/A <Char-161> " LATIN CAPITAL LETTER A WITH OGONEK
|
||||||
|
/C <Char-198> " LATIN CAPITAL LETTER C WITH ACUTE
|
||||||
|
/E <Char-202> " LATIN CAPITAL LETTER E WITH OGONEK
|
||||||
|
/L <Char-163> " LATIN CAPITAL LETTER L WITH STROKE
|
||||||
|
/N <Char-209> " LATIN CAPITAL LETTER N WITH ACUTE
|
||||||
|
/O <Char-211> " LATIN CAPITAL LETTER O WITH ACUTE
|
||||||
|
/S <Char-166> " LATIN CAPITAL LETTER S WITH ACUTE
|
||||||
|
/X <Char-172> " LATIN CAPITAL LETTER Z WITH ACUTE
|
||||||
|
/Z <Char-175> " LATIN CAPITAL LETTER Z WITH DOT ABOVE
|
||||||
|
|
113
src/ex_getln.c
113
src/ex_getln.c
@ -80,6 +80,8 @@ static void correct_cmdspos __ARGS((int idx, int cells));
|
|||||||
static void alloc_cmdbuff __ARGS((int len));
|
static void alloc_cmdbuff __ARGS((int len));
|
||||||
static int realloc_cmdbuff __ARGS((int len));
|
static int realloc_cmdbuff __ARGS((int len));
|
||||||
static void draw_cmdline __ARGS((int start, int len));
|
static void draw_cmdline __ARGS((int start, int len));
|
||||||
|
static void save_cmdline __ARGS((struct cmdline_info *ccp));
|
||||||
|
static void restore_cmdline __ARGS((struct cmdline_info *ccp));
|
||||||
static int cmdline_paste __ARGS((int regname, int literally));
|
static int cmdline_paste __ARGS((int regname, int literally));
|
||||||
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
||||||
static void redrawcmd_preedit __ARGS((void));
|
static void redrawcmd_preedit __ARGS((void));
|
||||||
@ -594,7 +596,7 @@ getcmdline(firstc, count, indent)
|
|||||||
else if (c == 'e')
|
else if (c == 'e')
|
||||||
{
|
{
|
||||||
struct cmdline_info save_ccline;
|
struct cmdline_info save_ccline;
|
||||||
char_u *p;
|
char_u *p = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace the command line with the result of an expression.
|
* Replace the command line with the result of an expression.
|
||||||
@ -605,16 +607,17 @@ getcmdline(firstc, count, indent)
|
|||||||
new_cmdpos = 99999; /* keep it at the end */
|
new_cmdpos = 99999; /* keep it at the end */
|
||||||
else
|
else
|
||||||
new_cmdpos = ccline.cmdpos;
|
new_cmdpos = ccline.cmdpos;
|
||||||
save_ccline = ccline;
|
|
||||||
ccline.cmdbuff = NULL;
|
save_cmdline(&save_ccline);
|
||||||
ccline.cmdprompt = NULL;
|
|
||||||
c = get_expr_register();
|
c = get_expr_register();
|
||||||
ccline = save_ccline;
|
restore_cmdline(&save_ccline);
|
||||||
if (c == '=')
|
if (c == '=')
|
||||||
{
|
{
|
||||||
|
save_cmdline(&save_ccline);
|
||||||
p = get_expr_line();
|
p = get_expr_line();
|
||||||
if (p != NULL
|
restore_cmdline(&save_ccline);
|
||||||
&& realloc_cmdbuff((int)STRLEN(p) + 1) == OK)
|
|
||||||
|
if (p != NULL && realloc_cmdbuff((int)STRLEN(p) + 1) == OK)
|
||||||
{
|
{
|
||||||
ccline.cmdlen = STRLEN(p);
|
ccline.cmdlen = STRLEN(p);
|
||||||
STRCPY(ccline.cmdbuff, p);
|
STRCPY(ccline.cmdbuff, p);
|
||||||
@ -1031,11 +1034,9 @@ getcmdline(firstc, count, indent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
save_ccline = ccline;
|
save_cmdline(&save_ccline);
|
||||||
ccline.cmdbuff = NULL;
|
|
||||||
ccline.cmdprompt = NULL;
|
|
||||||
c = get_expr_register();
|
c = get_expr_register();
|
||||||
ccline = save_ccline;
|
restore_cmdline(&save_ccline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1727,7 +1728,13 @@ returncmd:
|
|||||||
ui_cursor_shape(); /* may show different cursor shape */
|
ui_cursor_shape(); /* may show different cursor shape */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ccline.cmdbuff;
|
{
|
||||||
|
char_u *p = ccline.cmdbuff;
|
||||||
|
|
||||||
|
/* Make ccline empty, getcmdline() may try to use it. */
|
||||||
|
ccline.cmdbuff = NULL;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(FEAT_CRYPT) || defined(FEAT_EVAL)) || defined(PROTO)
|
#if (defined(FEAT_CRYPT) || defined(FEAT_EVAL)) || defined(PROTO)
|
||||||
@ -1747,12 +1754,11 @@ getcmdline_prompt(firstc, prompt, attr)
|
|||||||
struct cmdline_info save_ccline;
|
struct cmdline_info save_ccline;
|
||||||
int msg_col_save = msg_col;
|
int msg_col_save = msg_col;
|
||||||
|
|
||||||
save_ccline = ccline;
|
save_cmdline(&save_ccline);
|
||||||
ccline.cmdbuff = NULL;
|
|
||||||
ccline.cmdprompt = prompt;
|
ccline.cmdprompt = prompt;
|
||||||
ccline.cmdattr = attr;
|
ccline.cmdattr = attr;
|
||||||
s = getcmdline(firstc, 1L, 0);
|
s = getcmdline(firstc, 1L, 0);
|
||||||
ccline = save_ccline;
|
restore_cmdline(&save_ccline);
|
||||||
/* Restore msg_col, the prompt from input() may have changed it. */
|
/* Restore msg_col, the prompt from input() may have changed it. */
|
||||||
msg_col = msg_col_save;
|
msg_col = msg_col_save;
|
||||||
|
|
||||||
@ -2538,6 +2544,40 @@ put_on_cmdline(str, len, redraw)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct cmdline_info prev_ccline;
|
||||||
|
static int prev_ccline_used = FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save ccline, because obtaining the "=" register may execute "normal :cmd"
|
||||||
|
* and overwrite it. But get_cmdline_str() may need it, thus make it
|
||||||
|
* available globally in prev_ccline.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
save_cmdline(ccp)
|
||||||
|
struct cmdline_info *ccp;
|
||||||
|
{
|
||||||
|
if (!prev_ccline_used)
|
||||||
|
{
|
||||||
|
vim_memset(&prev_ccline, 0, sizeof(struct cmdline_info));
|
||||||
|
prev_ccline_used = TRUE;
|
||||||
|
}
|
||||||
|
*ccp = prev_ccline;
|
||||||
|
prev_ccline = ccline;
|
||||||
|
ccline.cmdbuff = NULL;
|
||||||
|
ccline.cmdprompt = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Resture ccline after it has been saved with save_cmdline().
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
restore_cmdline(ccp)
|
||||||
|
struct cmdline_info *ccp;
|
||||||
|
{
|
||||||
|
ccline = prev_ccline;
|
||||||
|
prev_ccline = *ccp;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* paste a yank register into the command line.
|
* paste a yank register into the command line.
|
||||||
* used by CTRL-R command in command-line mode
|
* used by CTRL-R command in command-line mode
|
||||||
@ -2572,13 +2612,10 @@ cmdline_paste(regname, literally)
|
|||||||
regname = may_get_selection(regname);
|
regname = may_get_selection(regname);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Need to save and restore ccline, because obtaining the "=" register may
|
/* Need to save and restore ccline. */
|
||||||
* execute "normal :cmd" and overwrite it. */
|
save_cmdline(&save_ccline);
|
||||||
save_ccline = ccline;
|
|
||||||
ccline.cmdbuff = NULL;
|
|
||||||
ccline.cmdprompt = NULL;
|
|
||||||
i = get_spec_reg(regname, &arg, &allocated, TRUE);
|
i = get_spec_reg(regname, &arg, &allocated, TRUE);
|
||||||
ccline = save_ccline;
|
restore_cmdline(&save_ccline);
|
||||||
|
|
||||||
if (i)
|
if (i)
|
||||||
{
|
{
|
||||||
@ -4534,6 +4571,24 @@ get_history_idx(histype)
|
|||||||
return history[histype][hisidx[histype]].hisnum;
|
return history[histype][hisidx[histype]].hisnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct cmdline_info *get_ccline_ptr __ARGS((void));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get pointer to the command line info to use. cmdline_paste() may clear
|
||||||
|
* ccline and put the previous value in prev_ccline.
|
||||||
|
*/
|
||||||
|
static struct cmdline_info *
|
||||||
|
get_ccline_ptr()
|
||||||
|
{
|
||||||
|
if ((State & CMDLINE) == 0)
|
||||||
|
return NULL;
|
||||||
|
if (ccline.cmdbuff != NULL)
|
||||||
|
return &ccline;
|
||||||
|
if (prev_ccline_used && prev_ccline.cmdbuff != NULL)
|
||||||
|
return &prev_ccline;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the current command line in allocated memory.
|
* Get the current command line in allocated memory.
|
||||||
* Only works when the command line is being edited.
|
* Only works when the command line is being edited.
|
||||||
@ -4542,9 +4597,11 @@ get_history_idx(histype)
|
|||||||
char_u *
|
char_u *
|
||||||
get_cmdline_str()
|
get_cmdline_str()
|
||||||
{
|
{
|
||||||
if (ccline.cmdbuff == NULL || (State & CMDLINE) == 0)
|
struct cmdline_info *p = get_ccline_ptr();
|
||||||
|
|
||||||
|
if (p == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return vim_strnsave(ccline.cmdbuff, ccline.cmdlen);
|
return vim_strnsave(p->cmdbuff, p->cmdlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4556,9 +4613,11 @@ get_cmdline_str()
|
|||||||
int
|
int
|
||||||
get_cmdline_pos()
|
get_cmdline_pos()
|
||||||
{
|
{
|
||||||
if (ccline.cmdbuff == NULL || (State & CMDLINE) == 0)
|
struct cmdline_info *p = get_ccline_ptr();
|
||||||
|
|
||||||
|
if (p == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
return ccline.cmdpos;
|
return p->cmdpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4570,7 +4629,9 @@ get_cmdline_pos()
|
|||||||
set_cmdline_pos(pos)
|
set_cmdline_pos(pos)
|
||||||
int pos;
|
int pos;
|
||||||
{
|
{
|
||||||
if (ccline.cmdbuff == NULL || (State & CMDLINE) == 0)
|
struct cmdline_info *p = get_ccline_ptr();
|
||||||
|
|
||||||
|
if (p == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* The position is not set directly but after CTRL-\ e or CTRL-R = has
|
/* The position is not set directly but after CTRL-\ e or CTRL-R = has
|
||||||
|
@ -1422,7 +1422,7 @@ gui_mch_browsedir(
|
|||||||
|
|
||||||
#endif /* FEAT_BROWSE */
|
#endif /* FEAT_BROWSE */
|
||||||
|
|
||||||
#if (defined(FEAT_GUI_DIALOG) && !defined(HAVE_GTK2)) || defined(PROTO)
|
#if defined(FEAT_GUI_DIALOG) && !defined(HAVE_GTK2)
|
||||||
|
|
||||||
static char_u *dialog_textfield = NULL;
|
static char_u *dialog_textfield = NULL;
|
||||||
static GtkWidget *dialog_textentry;
|
static GtkWidget *dialog_textentry;
|
||||||
@ -1956,7 +1956,7 @@ gui_mch_dialog( int type, /* type of dialog */
|
|||||||
#endif /* FEAT_GUI_DIALOG && !HAVE_GTK2 */
|
#endif /* FEAT_GUI_DIALOG && !HAVE_GTK2 */
|
||||||
|
|
||||||
|
|
||||||
#if defined(FEAT_GUI_DIALOG) && defined(HAVE_GTK2)
|
#if (defined(FEAT_GUI_DIALOG) && defined(HAVE_GTK2)) || defined(PROTO)
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
create_message_dialog(int type, char_u *title, char_u *message)
|
create_message_dialog(int type, char_u *title, char_u *message)
|
||||||
|
@ -5674,7 +5674,8 @@ display_errors()
|
|||||||
/*
|
/*
|
||||||
* Get current mouse coordinates in text window.
|
* Get current mouse coordinates in text window.
|
||||||
*/
|
*/
|
||||||
void gui_mch_getmouse(int *x, int *y)
|
void
|
||||||
|
gui_mch_getmouse(int *x, int *y)
|
||||||
{
|
{
|
||||||
Point where;
|
Point where;
|
||||||
|
|
||||||
|
@ -1895,7 +1895,7 @@ gui_mch_mousehide(int hide)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
gui_mch_getmouse(int *x, int *y)
|
gui_mch_getmouse(int *x, int *y)
|
||||||
{
|
{
|
||||||
PhCursorInfo_t info;
|
PhCursorInfo_t info;
|
||||||
|
@ -4,6 +4,7 @@ int do_cmdline_cmd __ARGS((char_u *cmd));
|
|||||||
int do_cmdline __ARGS((char_u *cmdline, char_u *(*getline)(int, void *, int), void *cookie, int flags));
|
int do_cmdline __ARGS((char_u *cmdline, char_u *(*getline)(int, void *, int), void *cookie, int flags));
|
||||||
int getline_equal __ARGS((char_u *(*getline)(int, void *, int), void *cookie, char_u *(*func)(int, void *, int)));
|
int getline_equal __ARGS((char_u *(*getline)(int, void *, int), void *cookie, char_u *(*func)(int, void *, int)));
|
||||||
void *getline_cookie __ARGS((char_u *(*getline)(int, void *, int), void *cookie));
|
void *getline_cookie __ARGS((char_u *(*getline)(int, void *, int), void *cookie));
|
||||||
|
int checkforcmd __ARGS((char_u **pp, char *cmd, int len));
|
||||||
int cmd_exists __ARGS((char_u *name));
|
int cmd_exists __ARGS((char_u *name));
|
||||||
char_u *set_one_cmd_context __ARGS((expand_T *xp, char_u *buff));
|
char_u *set_one_cmd_context __ARGS((expand_T *xp, char_u *buff));
|
||||||
char_u *skip_range __ARGS((char_u *cmd, int *ctx));
|
char_u *skip_range __ARGS((char_u *cmd, int *ctx));
|
||||||
|
@ -2295,7 +2295,7 @@ ex_vimgrep(eap)
|
|||||||
regmatch.regprog = vim_regcomp(s, RE_MAGIC);
|
regmatch.regprog = vim_regcomp(s, RE_MAGIC);
|
||||||
if (regmatch.regprog == NULL)
|
if (regmatch.regprog == NULL)
|
||||||
goto theend;
|
goto theend;
|
||||||
regmatch.rmm_ic = FALSE;
|
regmatch.rmm_ic = p_ic;
|
||||||
|
|
||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
if (*p == NUL)
|
if (*p == NUL)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
" Vim script language tests
|
" Vim script language tests
|
||||||
" Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
|
" Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
|
||||||
" Last Change: 2004 Apr 03
|
" Last Change: 2005 Jan 11
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
" Test environment {{{1
|
" Test environment {{{1
|
||||||
@ -8433,7 +8433,7 @@ if ExtraVim()
|
|||||||
call T(23, '(1 ? 2) + CONT(23)', 'E109', "Missing ':' after '?'")
|
call T(23, '(1 ? 2) + CONT(23)', 'E109', "Missing ':' after '?'")
|
||||||
call T(24, '("abc) + CONT(24)', 'E114', "Missing quote")
|
call T(24, '("abc) + CONT(24)', 'E114', "Missing quote")
|
||||||
call T(25, "('abc) + CONT(25)", 'E115', "Missing quote")
|
call T(25, "('abc) + CONT(25)", 'E115', "Missing quote")
|
||||||
call T(26, '& + CONT(26)', 'E112', "Option name missing")
|
call T(26, '& + CONT(26)', 'E712', "Using & outside of map()")
|
||||||
call T(27, '&asdf + CONT(27)', 'E113', "Unknown option")
|
call T(27, '&asdf + CONT(27)', 'E113', "Unknown option")
|
||||||
|
|
||||||
Xpath 134217728 " X: 134217728
|
Xpath 134217728 " X: 134217728
|
||||||
|
@ -36,5 +36,5 @@
|
|||||||
#define VIM_VERSION_NODOT "vim70aa"
|
#define VIM_VERSION_NODOT "vim70aa"
|
||||||
#define VIM_VERSION_SHORT "7.0aa"
|
#define VIM_VERSION_SHORT "7.0aa"
|
||||||
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
|
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
|
||||||
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 9)"
|
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 11)"
|
||||||
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 9, compiled "
|
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 11, compiled "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user