根据目录设置Vim的shiftwidth和tabstop [英] Set Vim's shiftwidth and tabstop based on directory

查看:287
本文介绍了根据目录设置Vim的shiftwidth和tabstop的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我目前的编码标准是使用2空间缩进。在其他项目中,我使用4个空格缩进。

I have a project I'm working on currently where the coding standard is to use 2 space indentation. On other projects, however, I use 4 space indentation.

有一个简单的方法告诉vim某个目录中的所有文件应该有一个2个空格的制表符?

Is there an easy way to tell vim that all files within a certain directory should have a tabstop of 2 spaces?

推荐答案

尊敬的Tim Pope刚刚发布了一个插件调用 Sleuth ,它根据当前文件中使用的内容自动确定shiftwidth和tabstop(以及其他缓冲区选项)(或者,令人难以置信的是,如果它是一个新的缓冲区,基于附近的文件)。

The venerable Tim Pope just released a plugin call Sleuth, which automagically determines shiftwidth and tabstop (among other buffer options) based on what's used in the current file (or, incredibly, if it's a new buffer, based on nearby files).

这篇关于根据目录设置Vim的shiftwidth和tabstop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆