vim 编辑python文件 禁止tab转换为空格的设置

1. 修改各种路径下的.vimrc都没用

2. 一个解决方法:
  每次用vim打开python文件后,分别运行
  :set ts=4(8)
  :set noexpandtab
  :%retab!

3. 其他:
  安装python编辑的dictionary补全提示插件:

filetype plugin on
let g:pydiction_location = '~/.vim/tools/pydiction/complete-dict'
let g:pydiction_menu_height = 3

  增加行号:

set nu

  自动缩进:

set filetype=python
au BufNewFile,BufRead *.py,*.pyw setf python
set autoindent " same level indent
set smartindent " next level indent

 4. 参考

Vim中空格和TAB的替换 - zakun - 博客园 (cnblogs.com)
如何使用vim编辑器打造pythonIDE,实现代码自动补全,自动缩进等_vim界面编辑 收缩的代码-CSDN博客

posted on   Mju_halcyon  阅读(65)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示