forked from aniani/vim
patch 7.4.813
Problem: It is not possible to save and restore character search state. Solution: Add getcharsearch() and setcharsearch(). (James McCoy)
This commit is contained in:
@@ -1971,6 +1971,7 @@ server2client( {clientid}, {string})
|
||||
Number send reply string
|
||||
serverlist() String get a list of available servers
|
||||
setbufvar( {expr}, {varname}, {val}) set {varname} in buffer {expr} to {val}
|
||||
setcharsearch( {dict}) Dict set character search from {dict}
|
||||
setcmdpos( {pos}) Number set cursor position in command-line
|
||||
setline( {lnum}, {line}) Number set line {lnum} to {line}
|
||||
setloclist( {nr}, {list}[, {action}])
|
||||
@@ -3361,6 +3362,26 @@ getcharmod() *getcharmod()*
|
||||
character itself are obtained. Thus Shift-a results in "A"
|
||||
without a modifier.
|
||||
|
||||
getcharsearch() *getcharsearch()*
|
||||
Return the current character search information as a {dict}
|
||||
with the following entries:
|
||||
|
||||
char character previously used for a character
|
||||
search (|t|, |f|, |T|, or |F|); empty string
|
||||
if no character search has been performed
|
||||
forward direction of character search; 1 for forward,
|
||||
0 for backward
|
||||
until type of character search; 1 for a |t| or |T|
|
||||
character search, 0 for an |f| or |F|
|
||||
character search
|
||||
|
||||
This can be useful to always have |;| and |,| search
|
||||
forward/backward regardless of the direction of the previous
|
||||
character search: >
|
||||
:nnoremap <expr> ; getcharsearch().forward ? ';' : ','
|
||||
:nnoremap <expr> , getcharsearch().forward ? ',' : ';'
|
||||
< Also see |setcharsearch()|.
|
||||
|
||||
getcmdline() *getcmdline()*
|
||||
Return the current command-line. Only works when the command
|
||||
line is being edited, thus requires use of |c_CTRL-\_e| or
|
||||
@@ -5397,6 +5418,26 @@ setbufvar({expr}, {varname}, {val}) *setbufvar()*
|
||||
:call setbufvar("todo", "myvar", "foobar")
|
||||
< This function is not available in the |sandbox|.
|
||||
|
||||
setcharsearch() *setcharsearch()*
|
||||
Set the current character search information to {dict},
|
||||
which contains one or more of the following entries:
|
||||
|
||||
char character which will be used for a subsequent
|
||||
|,| or |;| command; an empty string clears the
|
||||
character search
|
||||
forward direction of character search; 1 for forward,
|
||||
0 for backward
|
||||
until type of character search; 1 for a |t| or |T|
|
||||
character search, 0 for an |f| or |F|
|
||||
character search
|
||||
|
||||
This can be useful to save/restore a user's character search
|
||||
from a script: >
|
||||
:let prevsearch = getcharsearch()
|
||||
:" Perform a command which clobbers user's search
|
||||
:call setcharsearch(prevsearch)
|
||||
< Also see |getcharsearch()|.
|
||||
|
||||
setcmdpos({pos}) *setcmdpos()*
|
||||
Set the cursor position in the command line to byte position
|
||||
{pos}. The first position is 1.
|
||||
|
||||
Reference in New Issue
Block a user