LinuxSir.cn,穿越时空的Linuxsir!

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

关于vi的一些问题[基本解决]

[复制链接]
发表于 2004-2-8 11:44:24 | 显示全部楼层 |阅读模式
我装的是redhat 7.1
用vi编程,想设置一些东西
1,色彩显示
2,tab跳过4个字符
3,自动缩进

在网上找到一些文章说
在~/.vimrc中添加:
1,  syntax on (syn on, syntax enable都试过了,还是不行)
2,  set sts=4 (这个就可以)
3,  set cindent  (这个也不行)

请问是怎么回事啊?

还有一个就是如何在vi的窗口下面显示行号
不要在代码前面显示那种

谢谢啦
发表于 2004-2-8 11:58:38 | 显示全部楼层
1,应该可以的
3,set autoindent
显示行号:set nu
有关vi的比较详细用法见:
http://www.linuxsir.cn/bbs/showthread.php?threadid=46167

btw:兄弟,以后请不要重复发贴! 谢谢!
 楼主| 发表于 2004-2-8 13:15:39 | 显示全部楼层
hai shi bu xing a

sorry, this command is not implemented: syntax on


er qie jia shang "set autoindent" ye mei fan ying
发表于 2004-2-8 15:26:34 | 显示全部楼层
1, syntax on
这个需要终端支持
你试在终端下使用ls --color看能不能显示彩色

可以参考我的vim配置
http://forumer.com/index.php?mforum=mushuang&showtopic=61
 楼主| 发表于 2004-2-8 16:25:47 | 显示全部楼层
在终端下也没有颜色
我觉得是终端的问题,请问应该怎么解决啊?

后来我又下载了一个6.2版本的
装了但好像用不了,不过这个版本就可以显示一些颜色
发表于 2004-2-8 16:39:26 | 显示全部楼层
我的.vimrc文件,你参考参考
  1. [/home/javalee]cat .vimrc
  2. " An example for a vimrc file.
  3. "
  4. " Maintainer:   Bram Moolenaar <Bram@vim.org>
  5. " Last change:  2002 May 28
  6. "
  7. " To use it, copy it to
  8. "     for Unix and OS/2:  ~/.vimrc
  9. "             for Amiga:  s:.vimrc
  10. "  for MS-DOS and Win32:  $VIM\_vimrc
  11. "           for OpenVMS:  sys$login:.vimrc
  12. " When started as "evim", evim.vim will already have done these settings.
  13. if v:progname =~? "evim"
  14.   finish
  15. endif
  16. " Use Vim settings, rather then Vi settings (much better!).
  17. " This must be first, because it changes other options as a side effect.
  18. set nocompatible
  19. " allow backspacing over everything in insert mode
  20. set backspace=indent,eol,start
  21. set autoindent          " always set autoindenting on
  22. if has("vms")
  23.   set nobackup          " do not keep a backup file, use versions instead
  24. else
  25.   set backup            " keep a backup file
  26. endif
  27. set history=50          " keep 50 lines of command line history
  28. set ruler               " show the cursor position all the time
  29. set showcmd             " display incomplete commands
  30. set incsearch           " do incremental searching
  31. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
  32. " let &guioptions = substitute(&guioptions, "t", "", "g")
  33. " Don't use Ex mode, use Q for formatting
  34. map Q gq
  35. " This is an alternative that also works in block mode, but the deleted
  36. " text is lost and it only works for putting the current register.
  37. "vnoremap p "_dp
  38. " Switch syntax highlighting on, when the terminal has colors
  39. " Also switch on highlighting the last used search pattern.
  40. if &t_Co > 2 || has("gui_running")
  41.   syntax on
  42.   set hlsearch
  43. endif
  44. " Only do this part when compiled with support for autocommands.
  45. if has("autocmd")
  46.   " Enable file type detection.
  47.   " Use the default filetype settings, so that mail gets 'tw' set to 72,
  48.   " 'cindent' is on in C files, etc.
  49.   " Also load indent files, to automatically do language-dependent indenting.
  50.   filetype plugin indent on
  51.   " For all text files set 'textwidth' to 78 characters.
  52.   autocmd FileType text setlocal textwidth=78
  53.   " When editing a file, always jump to the last known cursor position.
  54.   " Don't do it when the position is invalid or when inside an event handler
  55.   " (happens when dropping a file on gvim).
  56.   autocmd BufReadPost *
  57.     \ if line("'"") > 0 && line("'"") <= line("$") |
  58.     \   exe "normal g`"" |
  59.     \ endif
  60. endif " has("autocmd")
  61. set fileencodings=zh_CN.GB18030
复制代码
 楼主| 发表于 2004-2-8 17:17:40 | 显示全部楼层
还是不行啊,我下载了你的代码放到自己的vimrc中
但是还是没有作用
然后自己加了一个set sts=4
只有这条设置是有效的

不知为什么。。。。。。。。。。。。
 楼主| 发表于 2004-2-8 17:24:29 | 显示全部楼层
刚才试了一下ls --color
可以显示颜色

现在麻烦死了,没有颜色又没有缩进
编起来很不方便

或者谁有vi的最新版,给我安装一下看行不行吧
谢谢啦
发表于 2004-2-8 18:12:38 | 显示全部楼层
发表于 2004-2-8 19:45:35 | 显示全部楼层
打开或创建一个.c .cpp .java 等程序文件时才能看看到
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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