Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何调用Vim内置函数?_Vim - Fatal编程技术网

如何调用Vim内置函数?

如何调用Vim内置函数?,vim,Vim,在Vim参考手册第4节中,列出了许多内置功能: 4. Builtin Functions *functions* See |function-list| for a list grouped by what the function is used for. (Use CTRL-] on the function name to jump to the full explanation.) USAGE

在Vim参考手册第4节中,列出了许多内置功能:

4. Builtin Functions                                    *functions*

See |function-list| for a list grouped by what the function is used for.

(Use CTRL-] on the function name to jump to the full explanation.)

USAGE                           RESULT  DESCRIPTION     ~

abs({expr})                     Float or Number  absolute value of {expr}
acos({expr})                    Float   arc cosine of {expr}
add({object}, {item})           List/Blob   append {item} to {object}
and({expr}, {expr})             Number  bitwise AND
append({lnum}, {text})          Number  append {text} below line {lnum}

如何调用这些函数?例如,如何获取数字的绝对值?

您可以使用call命令或在表达式中调用这样的内置函数:

let x = abs(-2)
" or, for functions where you're not interested in the return value:
:call clearmatches()

您可以使用call命令或在表达式中这样调用内置函数:

let x = abs(-2)
" or, for functions where you're not interested in the return value:
:call clearmatches()

首先,请注意,从使用角度来看,用户函数和内置函数之间没有明显的区别

不返回任何内容的函数将通过调用
:call
--注意,它们仍然将始终返回0

其他函数返回表达式。这些表达式可以是

  • 用于构建更复杂的表达式
    • 当它们被传递给其他函数时
    • 当他们连接,添加,乘以
    • 因为它们被用作索引
      getline('.')[col('.')-1]
  • 传递给vim ex的命令可用于
    • :echo
      表达式
    • 使用
      将表达式赋给变量:let
    • :执行另一个vim-ex命令,例如
      :exe行(“$”)/2

首先,请注意,从使用角度来看,用户功能和内置功能之间没有明显区别

不返回任何内容的函数将通过调用
:call
--注意,它们仍然将始终返回0

其他函数返回表达式。这些表达式可以是

  • 用于构建更复杂的表达式
    • 当它们被传递给其他函数时
    • 当他们连接,添加,乘以
    • 因为它们被用作索引
      getline('.')[col('.')-1]
  • 传递给vim ex的命令可用于
    • :echo
      表达式
    • 使用
      将表达式赋给变量:let
    • :执行另一个vim-ex命令,例如
      :exe行(“$”)/2

    • 如果没有用户手册提供的基础,参考手册几乎毫无用处

      用户手册第41章介绍了功能:

      :help usr_41.txt
      

      如果没有用户手册提供的基础,参考手册几乎毫无用处

      用户手册第41章介绍了功能:

      :help usr_41.txt