vim:希望它只为某些文件类型打开设置 [英] vim: would like it to turn settings on only for certain file types

查看:22
本文介绍了vim:希望它只为某些文件类型打开设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过这个,但不是太多的帮助.可能是我没看懂.

I've looked at this but it wasn't too much help. Maybe I didn't read it too well.

基本上我想要的是当我打开一个 .txt 文件时的设置:

Basically what I want is when I open a .txt file the settings:

set wrap
set linebreak

已开启.我该怎么做?

提前致谢.

另外,我使用的是 XP.

Also, I'm using XP.

推荐答案

我对那个问题的回答仍然适用:

My answer to that question still applies:

将基于文件后缀的 autocmd 命令放入 ~/.vimrc

Put autocmd commands based on the file suffix in your ~/.vimrc

autocmd BufRead,BufNewFile   *.txt set wrap linebreak

正如吕克所说,你可能更喜欢

As Luc says, you might prefer to

autocmd BufRead,BufNewFile   *.txt setlocal wrap linebreak

如果您可能同时打开 txt 和非 txt 文件.

if you're likely to open txt and non-txt files at the same time.

这篇关于vim:希望它只为某些文件类型打开设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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