首页 > 其他分享 >vim中let与set的区别

vim中let与set的区别

时间:2022-12-07 17:31:16浏览次数:35  
标签:set option value vim let variable foo


vim中let与set如何区分,一直挺困惑,上网搜索了一翻,把结果记录于此。

set设置的是选项, let设置的是变量。 

:set is for setting options, :let for assigning a value to a variable.
It happens that the value for an option is linked to the name of the option prepended by a & (the &option-name construct then behaves very similar to “ordinary” variables). So, the following are equivalent:
:set tw=40
:let &tw=40
But, for example, assigning 50 to the global variable foo (:let g:foo=50) cannot be achieved with a :set command (because g:foo is a variable and not an option).
Some options are boolean like. When setting these, no value is needed (as in :set noic and the opposite :set ic).


标签:set,option,value,vim,let,variable,foo
From: https://blog.51cto.com/u_15905375/5919851

相关文章