Vim中let g: let b: let l: 等的区别

linux 专栏收录该内容
2 篇文章 0 订阅

vim 下 :help internal-variables

buffer-variable b: Local to the current buffer. 
window-variable w: Local to the current window. 
tabpage-variable t: Local to the current tab page. 
global-variable g: Global. 
local-variable l: Local to a function. 
script-variable s: Local to a |:source|’ed Vim script. 
function-argument a: Function argument (only inside a function). 
vim-variable v: Global, predefined by Vim.
 

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).

  • 1
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值