LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1617|回复: 14

VI 编辑器语法着色问题请教!!!

[复制链接]
发表于 2006-3-17 12:04:16 | 显示全部楼层 |阅读模式
VI 编辑器语法着色要怎么做?

在VI中,   :syn on
                 :syntax on

不好用呀! 我就是想在编辑脚本的时候有语法着色。我用的是CENTOS4.2版本。
发表于 2006-3-17 12:29:24 | 显示全部楼层
确保你用的是VIM,而不是VI
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-17 12:34:56 | 显示全部楼层
VI没有语法着色的功能吗?
回复 支持 反对

使用道具 举报

发表于 2006-3-17 12:35:34 | 显示全部楼层
Post by houshuang
VI 编辑器语法着色要怎么做?

在VI中,   :syn on
                 :syntax on

不好用呀! 我就是想在编辑脚本的时候有语法着色。我用的是CENTOS4.2版本。

Edit your /etc/vim/vimrc file and uncomment the "syntax on line. (get rid of the ").
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-17 13:01:04 | 显示全部楼层
感谢版主的回复。

我的VIMRC文件有一段是这样的
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

但当我用syntax on 命令是,没有什么反应。
回复 支持 反对

使用道具 举报

发表于 2006-3-17 13:19:03 | 显示全部楼层
If you've edited vimrc file, you don't need to run syn on anymore... anyway, here is my set ouput.. you can see what in yours
  1. :set
  2. --- 选项 ---
  3.   autowrite           filetype=sh         ignorecase          ruler               showcmd             term=xterm          updatetime=2000
  4.   background=dark     helplang=cn         incsearch           scroll=15           showmatch           ttyfast             viminfo='20,"50
  5.   commentstring=#%s   history=500         laststatus=2        shiftwidth=4        syntax=sh           ttymouse=xterm2
  6.   expandtab           hlsearch            linebreak           shortmess=a         tabstop=4           ttytype=xterm
  7.   backspace=indent,eol,start
  8.   fileencoding=utf-8
  9.   fileencodings=ucs-bom,utf-8,default,latin1
  10.   runtimepath=~/.vim,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/addons,/usr/share/vim/vim64,/usr/share/vim/vimfiles,/usr/share/vim/addons/after,~/.vim/after
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-17 16:06:16 | 显示全部楼层
我们用的好像不是一个发行版吧,怎么配置文件的差异这么大。我用的是CentOS4.2
回复 支持 反对

使用道具 举报

发表于 2006-3-17 16:07:55 | 显示全部楼层
楼主是ssh上去的还是在本机?如果是ssh,请确保你的term支持ascii color
回复 支持 反对

使用道具 举报

发表于 2006-3-17 16:17:33 | 显示全部楼层
我的 ~/.vimrc 有:
syntax region xcode matchgroup=xcode start=/\\begin{xcode}/ end=/\\end{xcode}/
但我还是必须在每次打开编辑时手动运行:
:syntax region xcode matchgroup=xcode start=/\\begin{xcode}/ end=/\\end{xcode}/
才能生效,这是为什么?
回复 支持 反对

使用道具 举报

发表于 2006-3-17 23:33:04 | 显示全部楼层
Post by houshuang
我们用的好像不是一个发行版吧,怎么配置文件的差异这么大。我用的是CentOS4.2

oops... sorry, Im using 7.0.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表