2

I can display variables in vim using :let g: but I cannot search in it (keybindings seem very limited). Can vim open this content as internal buffer or pass to some other command?

4

What you can do is use :redir to write them out to a file and then edit them:

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

or use variables.vim as input to some other command.

0

Vim 8.1.0495 (25 Oct 2018)

With the vim patch 8.1.0495 the :filter command supports :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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.