Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.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_Wildcard - Fatal编程技术网

Vim脚本:在字符串中展开通配符

Vim脚本:在字符串中展开通配符,vim,wildcard,Vim,Wildcard,有一个vim变量,其字符串值如下: foo%:p:r:sbar %:p:r:s是vim通配符 如何展开字符串变量中的所有通配符 不幸的是,expand(my_变量)没有帮助。 我是否需要指定任何附加参数或使用其他vim函数 谢谢。试试:help expand() 文档的这一部分似乎与您特别相关: Modifiers: :p expand to full path :

有一个vim变量,其字符串值如下:

foo%:p:r:sbar
%:p:r:s是vim通配符

如何展开字符串变量中的所有通配符

不幸的是,expand(my_变量)没有帮助。 我是否需要指定任何附加参数或使用其他vim函数

谢谢。

试试
:help expand()

文档的这一部分似乎与您特别相关:

            Modifiers:
                    :p              expand to full path
                    :h              head (last path component removed)
                    :t              tail (last path component only)
                    :r              root (one extension removed)
                    :e              extension only

            Example: >
                    :let &tags = expand("%:p:h") . "/tags"
            Note that when expanding a string that starts with '%', '#' or
            '<', any following text is ignored.  This does NOT work: >
                    :let doesntwork = expand("%:h.bak")
            Use this: >
                    :let doeswork = expand("%:h") . ".bak"
可能您可以重新编写脚本,以便在通配符与其他字符串组合之前进行扩展。或者,您可以尝试拆分连接的字符串,展开通配符,然后重新连接。

尝试
:help expand()

文档的这一部分似乎与您特别相关:

            Modifiers:
                    :p              expand to full path
                    :h              head (last path component removed)
                    :t              tail (last path component only)
                    :r              root (one extension removed)
                    :e              extension only

            Example: >
                    :let &tags = expand("%:p:h") . "/tags"
            Note that when expanding a string that starts with '%', '#' or
            '<', any following text is ignored.  This does NOT work: >
                    :let doesntwork = expand("%:h.bak")
            Use this: >
                    :let doeswork = expand("%:h") . ".bak"
可能您可以重新编写脚本,以便在通配符与其他字符串组合之前进行扩展。或者,您可以尝试拆分连接的字符串,展开通配符,然后重新连接。

怎么样
join(映射)split(mystring),\ze[

join(映射)(拆分(mystring),\ze[我猜是我自己。在这种情况下,我必须重构大量代码,因为字符串是由其他vim函数动态生成的。通常有什么方法可以做到这一点吗?我猜是我自己。在这种情况下,我必须重构大量代码,因为字符串是由其他vim函数动态生成的。有什么方法吗总的来说是这样吗?