zoukankan      html  css  js  c++  java
  • linux命令---vim常用命令

    1、vim中的排序

    |2 | 22 | 111| 2222|
    |1 | 11 | 222| 1111|
    
    :sort /|[^|]+|[^|]+/    #sort grep
    
    |1 | 11 | 222| 1111|
    |2 | 22 | 111| 2222|

    2、vim中统计字节字符数

    g+[ctrl+g]

    3、vim中的计算

    在vim的插入模式下输入:CTRL+R =

    4、vim中拷贝鼠标下单词到命令行中

    ctrl-r-w

    5、vim中拷贝指定寄存器中的值到命令行

    ctrl-r+reg_name

     6、vim添加头文件

    function InsertHeadDef(firstLine, lastLine)
        if a:firstLine <1 || a:lastLine> line('$')
            echoerr 'InsertHeadDef : Range overflow !(FirstLine:'.a:firstLine.';LastLine:'.a:lastLine.';ValidRange:1~'.line('$').')'
            return ''
        endif
        let sourcefilename=expand("%:t")
        let definename=substitute(sourcefilename,' ','','g')
        let definename=substitute(definename,'.','_','g')
        let definename = toupper(definename)
        exe 'normal '.a:firstLine.'GO'
        call setline('.', '#ifndef _'.definename."_")
        normal ==o
        call setline('.', '#define _'.definename."_")
        exe 'normal =='.(a:lastLine-a:firstLine+1).'jo'
        call setline('.', '#endif')
        let goLn = a:firstLine+2
        exe 'normal =='.goLn.'G'
    endfunction
    function InsertHeadDefN()
        let firstLine = 1
        let lastLine = line('$')
        let n=1
        while n < 20
            let line = getline(n)
            if n==1 
                if line =~ '^/*.*$'
                    let n = n + 1
                    continue
                else
                    break
                endif
            endif
            if line =~ '^.**/$'
                let firstLine = n+1
                break
            endif
            let n = n + 1
        endwhile
        call InsertHeadDef(firstLine, lastLine)
    endfunction
    nmap ,ha :call InsertHeadDefN()<CR>
  • 相关阅读:
    使用bash编写Linux shell脚本参数和子壳
    开发项目的简单流程(需求、数据库、编码)
    hadoop和Hive的数据处理流程
    数据分析
    模糊聚类分析的实现
    贝叶斯1
    代理猎手
    贝叶斯2
    模糊聚类算法(FCM)和硬聚类算法(HCM)的VB6.0实现及
    C++模板
  • 原文地址:https://www.cnblogs.com/tianzhiyi/p/5358346.html
Copyright © 2011-2022 走看看