20120925Converting tabs to spaces

Vim中Tab与空格的设置
本文介绍如何在Vim编辑器中将Tab键输入转换为空格,包括设置expandtab选项使Tab键插入空格、使用tabstop选项控制每个Tab键插入的空格数、使用shiftwidth选项调整缩进的空格数等技巧。

http://vim.wikia.com/wiki/Converting_tabs_to_spaces

To insert space characters whenever the tab key is pressed, set the ‘expandtab’ option:

:set expandtab  

With this option set, if you want to enter a real tab character use Ctrl-V key sequence.

To control the number of space characters that will be inserted when the tab key is pressed, set the ‘tabstop’ option. For example, to insert 4 spaces for a tab, use:

:set tabstop=4  

After the ‘expandtab’ option is set, all the new tab characters entered will be changed to spaces. This will not affect the existing tab characters. To change all the existing tab characters to match the current tab settings, use:

:retab  

To change the number of space characters inserted for indentation, use the ‘shiftwidth’ option:

:set shiftwidth=4  

For example, to get the following coding style,

No tabs in the source file.

All tab characters are 4 space characters.

use the following set of options:

:set tabstop=4      
:set shiftwidth=4  
:set expandtab      

Add the above settings to your vimrc.

引用\[1\]:error: error parsing recommended.yaml: error converting YAML to JSON: yaml: line 14: could not find expected ':' 。 引用\[2\]:error: error parsing deployment-nginx.yml: error converting YAML to JSON: yaml: line 19: did not find expected key 。 引用\[3\]:\[root@k8s-master ~\]# kubectl apply -f recommended.yaml namespace/kubernetes-dashboard unchanged serviceaccount/kubernetes-dashboard unchanged error: error parsing recommended.yaml: error converting YAML to JSON: yaml: line 14: could not find expected ':' 。 问题: error converting yaml to json是什么意思? 回答: error converting yaml to json意味着在将YAML文件转换为JSON格式时出现了错误。这可能是由于YAML文件中的语法错误或格式错误导致的。在这种情况下,转换工具无法正确解析YAML文件并将其转换为JSON格式。错误消息中提到的行号和错误信息可以帮助定位问题所在,通常是缺少了一个冒号或者缺少了一个关键字。要解决这个问题,您可以检查YAML文件的语法和格式,确保它符合YAML的规范。 #### 引用[.reference_title] - *1* *3* [【排错】error: error parsing recommended.yaml: error converting YAML to JSON: yaml: line 14:的解决...](https://blog.youkuaiyun.com/weixin_54628931/article/details/128482574)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [error parsing deployment-nginx.yml: error converting YAML to JSON: yaml: line 19 问题解决](https://blog.youkuaiyun.com/weixin_64124795/article/details/129789799)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值