zoukankan      html  css  js  c++  java
  • vim编辑器头部自动插入注释和shell的高亮显示

    1.基本语法

    语法高亮
    :syntax on/off
    显示行号
    set number/nonumber
    
    自动缩进
    set autoindent
    set cindent

    2.自动加入文件头

    在etc/vimic

    源码:

    ## vim 头部自动生成
    function AddTitle()
    call setline(1,"#!/usr/bin/env bash")
    call append(1,"# -*- coding: utf-8 -*-")
    call append(2,"#Filename:   " . expand("%"))
    call append(3,"#Author:     Liuchao")
    call append(4,"#Email:      137642091@qq.com")
    call append(5,"#Date:       " . strftime("%Y-%m-%d"))
    call append(6,"#Desc:       ")
    call append(7,"")
    call append(8,"source /devOps/shell/common/functions")
    call append(9," ")
    endf
    
    ## 提示按'F4',会调用AddTitle函数
    map <F4> : call AddTitle() <cr>

     3.修改为不提示自动创建(也可以提示自动创建)

    源码:

    autocmd BufNewFile *.php,*.sh exec ":call AddTitle()"
    
    function AddTitle()
    call setline(1,"#!/usr/bin/env bash")
    call append(1,"# -*- coding: utf-8 -*-")
    call append(2,"#Filename:   " . expand("%"))
    call append(3,"#Author:     Liuchao")
    call append(4,"#Email:      137642091@qq.com")
    call append(5,"#Date:       " . strftime("%Y-%m-%d"))
    call append(6,"#Desc:       ")
    call append(7,"")
    call append(8,"source /devOps/shell/common/functions")
    call append(9," ")
    endf

    3.shell的高亮显示

  • 相关阅读:
    TensorRT推理加速基于Tensorflow(keras)的uff格式模型(文件准备)
    pandas_format06
    docker01
    pandas_dataformat03
    pandas_dataformat02
    pandas_series04
    pandas_format05
    pandas_format04
    pandas_dataframe01
    pandas_series03
  • 原文地址:https://www.cnblogs.com/yangzailu/p/10131143.html
Copyright © 2011-2022 走看看