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

查看:87
本文介绍了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天全站免登陆