1

I read echo help file and find a command: :echo "the value of 'shell' is" &shell

I wonder what is '&shell' here.

I check the help file for "&", "variables", "shell" and havent find any useful information. So what is the "&" meaning here. And what should I do to figure it out by myself?

1
  • Try this: :h :let-&
    – 3N4N
    Commented Oct 25, 2022 at 13:46

1 Answer 1

1

And what should I do to figure it out by myself?

Do :help &<C-d> and "figure out" which tag is more likely to help you (list is approximative, YMMV):

&            't_&8'       /\&      :&         :&&    :let-&    :set-&
:set-&vi     :set-&vim    cpo-&    expr-&&    g&     s/\&      t_&8
  • & is normal mode &, irrelevant,
  • 't_&8' has a t_ but &shell has not, irrelevant,
  • /\& looks like it is related to search, irrelevant,
  • :& and :&& look like they are Ex commands, irrelevant,
  • :let-& looks like it has something to do with variables, relevant,
  • all the :set- seem related, relevant,
  • cpo-& is related to :help 'cpoptions', irrelevant,
  • expr-&& has two &s, irrelevant,
  • g& appears to be normal-mode-something, irrelevant,
  • s/\& looks like it is related to substitutions, irrelevant,
  • t_&8 is the same as the other but without quotes, weird and irrelevant.

So that leaves you with :help :let-& and a couple of others:

:help :let-&
:let &{option-name} = {expr1}           *:let-option* *:let-&*
        Set option {option-name} to the result of the
        expression {expr1}.

Hooo…

But you are not supposed to open random help sections and "figure it out by yourself". What you are supposed to do is follow the user manual (:help user-manual), which teaches you things in the proper order. &optionname is explained in the chapter about scripting Vim: :help 41.3.

3
  • vimhelp.org you mean this is the user manual?
    – lizhe
    Commented Oct 25, 2022 at 16:11
  • 2
    Yes and no. The user manual is a part of that. I edited the answer with the command that leads you to the user manual in Vim.
    – romainl
    Commented Oct 25, 2022 at 16:22
  • 1
    Lol, i did read the user manual early on… and now I open random help when I need it :)
    – D. Ben Knoble
    Commented Oct 25, 2022 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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