Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3920780
  • 博文数量: 534
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4800
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(534)

文章存档

2024年(1)

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(252)

2006年(73)

分类: LINUX

2007-03-08 13:52:28

Replace characters:
:s/pattern/to_pattern/options
    Substitute. This substitutes the specified pattern with the string in the to_pattern. Without options, it only substitutes the first occurence of the pattern. If a 'g' is specified, then all occurences are substituted. For example, the command ":1,$s/Dwayne/Dwight/g" substitutes all occurences of "Dwayne" to "Dwight".

More information see
Base vi commands:
Master vi commands:

添加几个刚学会的:
:1,$s/Dwayne/Dwight/g    将字符Dwayne替换成Dwight
D                        删除到行尾
:set ic                   查找过程中忽略大小写

:n1,n2s/^/\/\//g        
在n1行到n2行的行首插入//符号
:n1,n2s/$/\/\//g         在n1行到n2行的行尾插入//符号

DOS文本文件转换为UNIX文件:
:1,$s/^M//g
^M输入方法为: Ctrl+V+M

tab跳动长度设置:
set tabstop=4            设置tab跳动长度为4
set expandtab            将tab替换成空格
要想长期有效, 将该设置添加到$HOME/.exrc中. 没有该文件, 自己新建就可以了. 我测试通过的环境为RH9.0

set ai 或 :set noai,ai 是 autoindent 的缩写,这样就可以马上改变退格的设定。

indent n. 缩进, 契约, 订货单, 凹痕

-----------------
set enc=big5         "设置字符编码为big5,可以使用gb2312, utf-8, gbk
:set encoding=gb2312 "vim设置encoding .正确显示中文字符
-----------------
:read !date        "插入日期

-----------------
syntax off         "使用语法分颜色显示
syntax enable      "也可以是syntax on

-----------------
:h shellCMD        例如":h cindent"显示cindent相关的帮助信息

-------------------
gg=G               把C代码自动缩进



部分内容来源于:

Gvim的部分使用: http://blog.chinaunix.net/u/553/showart.php?id=400232
阅读(2494) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~