关于VIM

来源:互联网 发布:淘宝正品哥弟女裤 编辑:程序博客网 时间:2024/05/16 23:59

关于VIM

VIM是VI的improve版本

1/增强了多级撤销

2/减少了崩溃次数,崩溃后也能还原.

3/


VIM官网

vim官网中有很多信息

包括一些推荐的学习文档

在线VIMdoc

中文VIMDOC


-1/VI在文件系统中

linux@ubuntu:~/project/tmp/linux-0.11$ which vi               /usr/bin/vilinux@ubuntu:~/project/tmp/linux-0.11$ ll /usr/bin/vi         lrwxrwxrwx 1 root root 20  625  2015 /usr/bin/vi -> /etc/alternatives/vi*linux@ubuntu:~/project/tmp/linux-0.11$ ll /etc/alternatives/vilrwxrwxrwx 1 root root 18  625  2015 /etc/alternatives/vi -> /usr/bin/vim.basic*linux@ubuntu:~/project/tmp/linux-0.11$ file /usr/bin/vim.basic/usr/bin/vim.basic: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xee9dbd50d0201cf3bbe8fb2fde6efbacb6f2cded, stripped

0/VI帮助

vi -husage: vim [arguments] [file ..]       edit specified file(s)   or: vim [arguments] -               read text from stdin   or: vim [arguments] -t tag          edit file where tag is defined   or: vim [arguments] -q [errorfile]  edit file with first errorman viinfo vi

1/打开文件

vi filenamevi filename +12vi filename1 filename2 -Ovi filename1 filename2 -pvi -b filename //%!xxd //%!xxd -g 1vi -r filename

2/VI模式

普通模式    默认进入普通模式,由其他模式进入普通模式,按Esc插入模式    aios AIOS cc 命令行模式    :可视化模式    v替换模式  r R

常用操作

功能 实现方式1 实现方式2 实现方式3 实现方式4 查找 * ?word /word /word1|word2 替换 当前行1,s/before/after/g 全部1,$s/printf/hahah/g 局部m,ns/printf/hahah/g 定位光标 行首 0/^ 行末 $ 字符 fc/; 块(){} [[ ]] 4gg 4G :4 拉屏幕 全屏 ctrl + f ctrl + b 半屏ctrl + u ctrl + d 调整光标 zz zt zb 标记 设置标记 ma mb mc 跳转标记 ab `c 退出 ZZ x w! sudo tee % q q! wq wqa 通配符查找 /char\s+[A-Za-z_]\w*; /\d\d:\d\d:\d\d :g/^\s*$/d :s/\/4/g 统计次数 %s/str1/&/gn

参考

Vim入门基础

0 0
原创粉丝点击