自动在Vim的不同文件扩展名上启用和禁用自动换行 [英] Enabling and disabling word wrap automatically on different file extensions on Vim

查看:81
本文介绍了自动在Vim的不同文件扩展名上启用和禁用自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常必须阅读长行的.txt文件,同时编辑一些源文件,而且我希望在.txt文件上看到自动换行,而在不是这样的文件中更喜欢.

I usually have to read .txt files with long lines, and at the same time edit some source file, and I like to see word wrap on the .txt files, and not in the ones that aren't.

我当然可以:set wrap和:set换行符,但是有什么方法可以使它自动进行,并且取决于文件扩展名吗?

Of course I can :set wrap and :set linebreak, but is there any way to make it automatucally, and dependent of the file extension?

推荐答案

我想:autocmd BufNewFile,BufRead *.txt set wrap应该可以解决问题

这篇关于自动在Vim的不同文件扩展名上启用和禁用自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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