VIM学习笔记

来源:互联网 发布:大数据分析足球比赛 编辑:程序博客网 时间:2024/05/01 23:23
USING VIM

2003-02-15
==========================================

Tips in Programing
    Quickly Find The Object
        /
        *
        %
        [{
        gb
        m    using mark
        using tag files

    Automatic Completion
        ^N
    Automatic Indent
        :set cindent
        :set autoindent


Compiling Program
    About Compilition:
        make {arguments}
        cfile
        clist
        clist!

        cc
        cc nr
        cnext
        cprevious
        cfirst
        clast
        crewind
       
    About Indent:
        set autoindent
        Ctrl+D
        Ctrl+T
        >>
        <<
        set shiftwidth
        set tabstop
        set list
        set cindent    indent for c language

    Special Search:
        %    search the match (,[,{,<
        :set showmatch

Edit Mutipile Files
    edit    open a file.
    write [>>]    append to a exist file.
    file    rename the current file.
    saveas
   
    args    list the opened file names; change the list of opened file names.

    next
    previous
    first
    last
    wnext
    wprevious
   
EX Commands
    read    r    [eg] 180r /home/tim/data
    write    w    [eg] 1,10w newfile
                340,$w >> newfile
    copy    co
    delete    d
    move    m    [eg] 226,$m.-2
    edit    e
   
    q
    x

    g    [eg] 60,124g/pattern/p
    s    [eg] s/oldstr/newstr

    args
    set number
    set nonumber
    set autoindent

Custom VI
    Format
        :set option
        :set nooption
    About File:
        .exrc

    Usefull Options
        :set autoindent
        :set showmatch
        :set tabstop
        :set shiftwidth
        :set number
        :set list

        :set autowrite
        :set all

        :set wrapmargin = 10

        :set incsearch

Using Mutipile Window
    sp[lit]        split current window
    new        create a new window
    clo[se]        close current window
    res[ize]    resize current window

    ^w^w        shift from one window to another
    qa
    wqa
    wa
    xa

Completion Commands
    Commands in Command Line
        ^D
        Tab
        ^N
        ^P

    Commands in Insert Mode
        ^N
        ^P
       
Visual Mode
    v
    V    line selection
    ^v    region selection

Include Files Search
    [i
    [I
    [^i
    ^wi

Invoke Unix Commands
    :!{command}
    :sh
    Ctrl+d

    :r !date

    Using filer, you can use Unix commands to operate current text
content.
        :{range}![!]{filter}
        !{motion}{filter}
            [eg]    :23,34!sort
                :4!!sort
原创粉丝点击