Vim 8.1.0495(2018 年 10 月 25 日)

Vim 8.1.0495(2018 年 10 月 25 日)

我可以使用 vim 显示变量:let g:,但无法在其中搜索(键绑定似乎非常有限)。可以vim将此内容作为内部缓冲区打开或传递给其他命令吗?

答案1

您可以做的是将:redir它们写入文件,然后编辑它们:

:redir > variables.vim
:let g:
:redir END
:n variables.vim

或用作variables.vim其他命令的输入。

答案2

Vim 8.1.0495(2018 年 10 月 25 日)

使用 vim 补丁 8.1.0495 该:filter命令支持:let

:filter <pattern> let g:

:h :filter

                                                        :filt :filter
:filt[er][!] {pat} {command}
:filt[er][!] /{pat}/ {command}
                        Restrict the output of {command} to lines matching
                        with {pat}.  For example, to list only xml files: 
                                :filter /\.xml$/ oldfiles
                       If the [!] is given, restrict the output of {command}
                        to lines that do NOT match {pat}.

                        {pat} is a Vim search pattern.  Instead of enclosing
                        it in / any non-ID character (see 'isident') can be
                        used, so long as it does not appear in {pat}.  Without
                        the enclosing character the pattern cannot include the
                        bar character.

                        The pattern is matched against the relevant part of
                        the output, not necessarily the whole line. Only some
                        commands support filtering, try it out to check if it
                        works. Some of the commands that support filtering:
                           :#          - filter whole line
                           :clist      - filter by file name or module name
                           :command    - filter by command name
                           :files      - filter by file name
                           :highlight  - filter by highlight group
                           :jumps      - filter by file name
                           :let        - filter by variable name
                           :list       - filter whole line
                           :llist      - filter by file name or module name
                           :marks      - filter by text in the current file,
                                           or file name for other files
                           :oldfiles   - filter by file name
                           :set        - filter by variable name

                        Only normal messages are filtered, error messages are
                        not.

相关内容