PC6下载站

分类分类

关于linux vim命令 总结

关注+2011-02-17作者:不详

10 页 配置文件中的特殊用法:

配置文件中的特殊用法:

autocmd 自动执行命令

autocmd FileType text setlocal textwidth=78 设置 文本文件 文本宽度为78

手动设置文件的高亮配置文件:

在文件开头或者结尾写入  # vim: syntax=make

在VIM中执行shell的时候可以配置shell备置列表如下:

'shell' specifies the program that Vim uses to execute external programs.

'shellcmdflag' argument to pass a command to the shell

'shellquote' quote to be used around the command

'shellxquote' quote to be used around the command and redirection

'shelltype' kind of shell (only for the Amiga)

'shellslash' use forward slashes in the command (only for MS-Windows and alikes)

'shellredir' string used to write the command output into a file

4.搜索

搜索支持正则表达式

/ 向后搜索

? 向前所搜

n 下一个匹配项

N 上一个匹配项

* 从上向下搜索单词

# 从下向上搜索单词

搜索单词: /\<the\>  这样指定了单词的开始和结尾

5.常用套路技巧:

套路:

x delete character under the cursor (short for "dl")

X delete character before the cursor (short for "dh")

D delete from cursor to end of line (short for "d$")

dw delete from cursor to next start of word

db delete from cursor to previous start of word

diw delete word under the cursor (excluding white space)

daw delete word under the cursor (including white space)

dG delete until the end of the file

dgg delete until the start of the file

技巧:

'* 是选区寄存器(用鼠标中键)  '+ 是粘贴寄存器(一般是菜单里的复制粘贴选项)

Insert模式和Replace模式可以用Insert键切换

将Doe,John 替换成 John Doe 用如下方法:

:%s/\([^,]*\),\(.*\)/\2 \1/        其中\1 表示正则表达式中第一个匹配部分,整句的匹配部分用 \0表示

展开全部

相关文章

更多+相同厂商

热门推荐

  • 最新排行
  • 最热排行
  • 评分最高
排行榜

    点击查看更多

      点击查看更多

        点击查看更多

        说两句网友评论

          我要评论...
          取消