gVim 和多种编程语言 [英] gVim and multiple programming languages

查看:22
本文介绍了gVim 和多种编程语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的日常工作是使用 Perl 编码.在家里,我玩 Python 和 Erlang.对于 Perl,我想用两个空格缩进我的代码.而 Python 的标准是 4.另外,我有一些键绑定来打开我想与所有编程语言一起使用的函数声明.这如何在 gVim 中实现?

My day job involves coding with Perl. At home I play around with Python and Erlang. For Perl I want to indent my code with two spaces. Whereas for Python the standard is 4. Also I have some key bindings to open function declarations which I would like to use with all programming languages. How can this be achieved in gVim?

例如,有没有办法为每种编程语言或类似的东西维护一个配置文件?

As in, is there a way to maintain a configuration file for each programming language or something of that sort?

推荐答案

您应该能够通过利用文件类型来实现...例如,将其添加到您的 vimrc(并针对不同语言进行适当修改):

You should be able to do with by leveraging filetypes ... e.g., add this to your vimrc (and modify appropriately for different languages):

autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab

这篇关于gVim 和多种编程语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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