comparison runtime/doc/eval.txt @ 17829:1090d6637cfd v8.1.1911

patch 8.1.1911: more functions can be used as methods Commit: https://github.com/vim/vim/commit/64b4d73524b9a2304d89b87529cd8d3cef14b856 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 22 22:18:17 2019 +0200 patch 8.1.1911: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make a few more functions usable as a method.
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Aug 2019 22:30:04 +0200
parents ce993ba17adb
children 8377ec7c5824
comparison
equal deleted inserted replaced
17828:35e158a08c97 17829:1090d6637cfd
3297 count {byte} in the current buffer. This includes the 3297 count {byte} in the current buffer. This includes the
3298 end-of-line character, depending on the 'fileformat' option 3298 end-of-line character, depending on the 'fileformat' option
3299 for the current buffer. The first character has byte count 3299 for the current buffer. The first character has byte count
3300 one. 3300 one.
3301 Also see |line2byte()|, |go| and |:goto|. 3301 Also see |line2byte()|, |go| and |:goto|.
3302 {not available when compiled without the |+byte_offset| 3302
3303 Can also be used as a |method|: >
3304 GetOffset()->byte2line()
3305
3306 < {not available when compiled without the |+byte_offset|
3303 feature} 3307 feature}
3304 3308
3305 byteidx({expr}, {nr}) *byteidx()* 3309 byteidx({expr}, {nr}) *byteidx()*
3306 Return byte index of the {nr}'th character in the string 3310 Return byte index of the {nr}'th character in the string
3307 {expr}. Use zero for the first character, it returns zero. 3311 {expr}. Use zero for the first character, it returns zero.
3321 3325
3322 If there are less than {nr} characters -1 is returned. 3326 If there are less than {nr} characters -1 is returned.
3323 If there are exactly {nr} characters the length of the string 3327 If there are exactly {nr} characters the length of the string
3324 in bytes is returned. 3328 in bytes is returned.
3325 3329
3330 Can also be used as a |method|: >
3331 GetName()->byteidx(idx)
3332
3326 byteidxcomp({expr}, {nr}) *byteidxcomp()* 3333 byteidxcomp({expr}, {nr}) *byteidxcomp()*
3327 Like byteidx(), except that a composing character is counted 3334 Like byteidx(), except that a composing character is counted
3328 as a separate character. Example: > 3335 as a separate character. Example: >
3329 let s = 'e' . nr2char(0x301) 3336 let s = 'e' . nr2char(0x301)
3330 echo byteidx(s, 1) 3337 echo byteidx(s, 1)
3334 character is 3 bytes), the second echo results in 1 ('e' is 3341 character is 3 bytes), the second echo results in 1 ('e' is
3335 one byte). 3342 one byte).
3336 Only works different from byteidx() when 'encoding' is set to 3343 Only works different from byteidx() when 'encoding' is set to
3337 a Unicode encoding. 3344 a Unicode encoding.
3338 3345
3346 Can also be used as a |method|: >
3347 GetName()->byteidxcomp(idx)
3348
3339 call({func}, {arglist} [, {dict}]) *call()* *E699* 3349 call({func}, {arglist} [, {dict}]) *call()* *E699*
3340 Call function {func} with the items in |List| {arglist} as 3350 Call function {func} with the items in |List| {arglist} as
3341 arguments. 3351 arguments.
3342 {func} can either be a |Funcref| or the name of a function. 3352 {func} can either be a |Funcref| or the name of a function.
3343 a:firstline and a:lastline are set to the cursor line. 3353 a:firstline and a:lastline are set to the cursor line.
3344 Returns the return value of the called function. 3354 Returns the return value of the called function.
3345 {dict} is for functions with the "dict" attribute. It will be 3355 {dict} is for functions with the "dict" attribute. It will be
3346 used to set the local variable "self". |Dictionary-function| 3356 used to set the local variable "self". |Dictionary-function|
3357
3358 Can also be used as a |method|: >
3359 GetFunc()->call([arg, arg], dict)
3347 3360
3348 ceil({expr}) *ceil()* 3361 ceil({expr}) *ceil()*
3349 Return the smallest integral value greater than or equal to 3362 Return the smallest integral value greater than or equal to
3350 {expr} as a |Float| (round up). 3363 {expr} as a |Float| (round up).
3351 {expr} must evaluate to a |Float| or a |Number|. 3364 {expr} must evaluate to a |Float| or a |Number|.