VIM编辑器

一:语法高亮

syntax    on(设置语法高亮)

syntax    off(关闭语法高亮)

二:显示行号

set      number(设置行号)

set      nonumber(关闭行号)

三:自动缩进

set      autoindent

set      cindent

四:自动加入文件头:(将如下的代码添加进/etc/vimrc配置文件中即可实现自动加入文件头的操作)

autocmd BufNewFile *.py,*.sh, exec ":call SetTitle()"

let $author_name = "xxxx"

let $author_email = "xxxx@xxx.xx"

func SetTitle()

if &filetype == 'sh'

call setline(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, "\#!/bin/bash")

call append(line(".")+6, "")

else

call setline(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, "")

endif

endfunc


Shell高亮显示

基本格式:

echo   -e    终端颜色   +   显示内容   +    结束后颜色

echo -e "\e[1;30m jeson say Hi~ \e[1;0m"

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 编辑器设置: syntax on ...
    easy_book阅读 2,481评论 0 0
  • 命令历史 以:和/开头的命令都有历史纪录,可以首先键入:或/然后按上下箭头来选择某个历史命令。 启动vim 在命令...
    西多的大叔阅读 2,523评论 0 0
  • vim是由vi发展来的一个强大的文本编辑器,代码补完、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用...
    dxldeng阅读 4,292评论 0 1
  •  vi: Visual Interface,文本编辑器 文本:ASCII, Unicode 文本编辑种类:行...
    尛尛大尹阅读 2,166评论 0 0
  • 很多时候,我常常问自己,你自己到底相信什么? 相信自己还是他人? 比如说在应付考试的时候,我常常会翻来覆去的去记忆...
    中尉与上尉阅读 1,585评论 0 2

友情链接更多精彩内容