Get current value of a setting in Vim

后端 未结 4 587
谎友^
谎友^ 2020-12-12 09:36

Is there a simple way of finding out the current value of a specified Vim setting? If I want to know the current value of, say tabstop, I can run:



        
相关标签:
4条回答
  • 2020-12-12 10:15

    If you don't remember what setting you want to check, you can view all settings:

    :set all
    

    or show each setting, one setting per line:

    :set! all
    
    0 讨论(0)
  • 2020-12-12 10:15

    There are also additional vim settings that can be displayed as well, such as:

    :highlight

    For the full list, see: http://vim.wikia.com/wiki/Displaying_the_current_Vim_environment

    Edit: There is some misunderstanding of my answer. This does not work for any command. But it does work for all the commands listed in the URL above.

    0 讨论(0)
  • 2020-12-12 10:18

    Add a ? mark after the setting name and it will show the value

    :set expandtab?
    
    0 讨论(0)
  • 2020-12-12 10:23

    Alternatively, the & symbol can be used to mean "option" - e.g.

    let x = &expandtab
    echo &expandtab
    
    0 讨论(0)
提交回复
热议问题