配置
配置.vimrc
" 显示行号set number" 启动显示状态行1,总是显示状态行2set laststatus=2" 光标let &t_SI.="\e[5 q" "SI = INSERT modelet &t_SR.="\e[4 q" "SR = REPLACE modelet &t_EI.="\e[1 q" "EI = NORMAL mode (ELSE)" 语法高亮显示syntax onset fileencodings=utf-8,gb2312,gbk,cp936,latin-1set fileencoding=utf-8set termencoding=utf-8set fileformat=unixset encoding=utf-8" 指定配色方案是256色set t_Co=256set wildmenu" 去掉有关vi一致性模式,避免以前版本的一些bug和局限,解决backspace不能使用的问题set nocompatibleset backspace=indent,eol,startset backspace=2" 启用自动对齐功能,把上一行的对齐格式应用到下一行set autoindent" 依据上面的格式,智能的选择对齐方式,对于类似C语言编写很有用处set smartindent" vim禁用自动备份set nobackupset nowritebackupset noswapfile" 用空格代替tabset expandtab" 设置显示制表符的空格字符个数,改进tab缩进值,默认为8,现改为4set tabstop=4" 统一缩进为4,方便在开启了et后使用退格(backspace)键,每次退格将删除X个空格set softtabstop=4" 设定自动缩进为4个字符,程序中自动缩进所使用的空白长度set shiftwidth=4" 设置帮助文件为中文(需要安装vimcdoc文档)set helplang=cn" 显示匹配的括号set showmatch" 文件缩进及tab个数au FileType html,python,vim,javascript setl shiftwidth=4au FileType html,python,vim,javascript setl tabstop=4au FileType java,php setl shiftwidth=4au FileType java,php setl tabstop=4" 高亮搜索的字符串set hlsearch" 检测文件的类型filetype onfiletype plugin onfiletype indent on" C风格缩进set cindentset completeopt=longest,menu" 功能设置" 去掉输入错误提示声音set noeb" 自动保存set autowrite" 突出显示当前行set cursorline cursorcolumn" 共享剪贴板set clipboard+=unnamed" 文件被改动时自动载入set autoread" 顶部底部保持3行距离set scrolloff=3" 原格式粘贴set paste" 鼠标点击set mouse=a
常用
跳转
基础跳转w 后一个单词b 前一个单词# 跳转到12行12G12gg:12 enter# 整页翻页ctrl-f ctrl-bf就是forword b就是backward
行号显示和关闭
一般情况下,我们会把行号打开,但是有些时候为了方便复制,我们要把行号关闭。
# 开启set nu# 关闭set nonu
