diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-08-11 14:26:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-08-11 14:26:19 +0200 |
commit | dbd24b59678dd976b2ad356451e248a6e8b8bd8b (patch) | |
tree | 0ecfb9bb16fceefa3d1d101a8bb9cfe9db2e55f2 /runtime | |
parent | fbd302ff38624abdec64980f4a19379d20a6e6c6 (diff) |
patch 7.4.813v7.4.813
Problem: It is not possible to save and restore character search state.
Solution: Add getcharsearch() and setcharsearch(). (James McCoy)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d9f49aefc5..85149b581e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -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. |