设置方式的分类
方式一:临时性质的设置
:syntax off—关闭高亮显示
方式二:永久性质的设置(修改vimrc文件)
vim /etc/vimrc
加入syntax on
vim /home/users/.vimrc
语法高亮
syntax on
显示行号
set number
自动缩进
set autoindent
set cindent
自动加入文件头
vim /etc/vimrc
autocmd BufNewFile .py,.sh, exec “:call SetTitle()”
let $author_name=“zchj”
let $author_email=“abc@qq.com”
func SetTitle()
If &filetype==‘sh’
call settline(1,"############################################################")
call append(line("."),"# File Name: “.expand(”%"))
call append(line(".")+1,"# Author: ".$author_name)
call append(line(".")+2,"# mail: ".$author_email)
call append(line(".")+3,"# Create Time: “.strftime(”%c"))
call append(line(".")+4,"#====================================================")
call append(line(".")+5,"#! /bin/bash")
call append(line(".")+6,"")
else
call settling(1,"######################################################################")
call append(line("."),"# File Name: “.expand(”%"))
call append(line(".")+1,"# Author: ".$author_name)
call append(line(".")+2,"# mail: ".$author_email)
call append(line(".")+3,"# Created Time: “.strftime(”%c"))
call append(line(".")+4,"#============================================================")
call append(line(".")+5,"#!/usr/bin/python")
call append(line(".")+6,"")
Shell高亮显示
基本格式
echo -e 终端颜色+显示内容+结束后的颜色
例如:echo -e “\e[1;30m zchj say hi \e[1;0m”
echo -e "\e[1;30m zchj say hi " $(tput sgr0)