AutoComplPop插件
AutoComplPop可以打开自动补全的窗口,不单单可以补全变量函数等,还可以补全文件名。
下载地址:http://www.vim.org/scripts/script.php?script_id=1879
安装方法很简单,将下载的文件解压到$HOME/.vim目录中
使用效果图:

最后晒下自己的.vimrc文件:
- set backspace=indent,eol,start
- set history=50 " keep 50 lines of command line history
- set ruler " show the cursor position all the time
- set showcmd " display incomplete commands
- set incsearch " do incremental searching
- set number
- syntax on “打开语法高亮
- set autoindent “自动缩进
- set smartindent “使用c形式自动缩进
- set cindent
- set tabstop=4 “TAB键的宽度
- set shiftwidth=4 “统一缩进为4
- set showmatch “高亮显示匹配括号
- set incsearch
- set nu “显示行号
- color darkblue ”颜色方案
- set ruler
- set ignorecase “搜索忽略大小写
- set smartcase
- set hlsearch ”设置搜索字符高亮
- set report=0
- set mouse=a
- set nobackup
- set noeb
- set history=1000
- set nobackup
- set noswapfile
- set enc=utf-8 ”语言编码设置
- set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
- set langmenu=ZH_CN.UTF-8
- set helplang=cn
- set laststatus=2
- set ruler “显示光标位置状态行
- set cmdheight=1 ”设置命令行的高度
- filetype on “侦测文件类型
- filetype plugin on ”载入文件类型插件
- filetype indent on
- set viminfo+=! “保存全局变量
- set iskeyword+=_,$,@,%,#,- ”带有这些字符的单词不要被换行分割
- set linespace=0 “字符间插入像素行数目
- set wildmenu ”命令行自动完成操作
- set backspace=2 “使用回格键
- set whichwrap+=<,>,h,l ”允许backspace和光标跨越行
- set selection=exclusive
- set selectmode=mouse,key
vim常用使用方法:
:e:打开文件,例::e /opt/shell/status.sh
ZZ: 关闭文件
vim +18 /opt/status.sh :打开status.sh并跳到第18行
- vim +18 /opt/status.sh :打开status.sh并跳到第18行
- 13
- 14 ########## DEFINE FUNCTIONS ##########
- 15
- 16 function in_range_random_number()
- 17 {
- 18 #create a random number which is less than or equal to UPPER_LIMIT
- 19 RANDOM_NUMBER=$(( $RANDOM % $UPPER_LIMIT + 1 ))
- 20 echo -e "$RANDOM_NUMBER"
- 21 }
- 14 ########## DEFINE FUNCTIONS ##########
- 15
- 16 function in_range_random_number()
- 17 {
- 18 #create a random number which is less than or equal to UPPER_LIMIT
- 19 RANDOM_NUMBER=$(( $RANDOM % $UPPER_LIMIT + 1 ))
- 20 echo -e "$RANDOM_NUMBER"
- 21 }
- 22
vim +/RANDOM_NUMBER /opt/shell/random_passwd_create.sh:打开脚本并从头开始查询,到第一个匹配模式的地方

