文件模式Vim配置文件种类,加载顺序,基本配置

在本篇文章中,我们主要介绍文件模式的内容,自我感觉有个不错的建议和大家分享下

作者:zhanhailiang 日期:2013-04-23

    

通过查看:version可知Vim置配文件分为三类:

:

    version VIM

    -

    Vi IMproved

    7.3

    (

    2010

    Aug

    15

    , compiled Oct

    29

    2011

    18

    :

    46

    :

    03

    )

  系统 vimrc 文件

    :

    "$VIM/vimrc"

    户用 vimrc 文件

    :

    "$HOME/.vimrc"

    户用

    exrc

    文件

    :

    "$HOME/.exrc"

    $

    VIM 预设值

    :

    "/usr/local/share/vim"

    

其各自的载加序顺可通过:scriptname来获知:

:

    scripname

    1

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vimrc

    2

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    syntax

    /

    syntax

    .

    vim

    3

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    syntax

    /

    synload

    .

    vim

    4

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    syntax

    /

    syncolor

    .

    vim

    5

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    filetype

    .

    vim

    6

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    ftplugin

    .

    vim

    7

    :

    /

    home

    /

    zhanhailiang

    /.

    vimrc

    8

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    syntax

    /

    nosyntax

    .

    vim

    9

    :

    /

    home

    /

    zhanhailiang

    /.

    vim

    /

    plugin

    /

    ctag

    .

    vim

    10

    :

    /

    home

    /

    zhanhailiang

    /.

    vim

    /

    plugin

    /

    jsbeautify

    .

    vim

    11

    :

    /

    home

    /

    zhanhailiang

    /.

    vim

    /

    plugin

    /

    matchit

    .

    vim

    12

    :

    /

    home

    /

    zhanhailiang

    /.

    vim

    /

    plugin

    /

    plugin

    /

    taglist

    .

    vim

    13

    :

    /

    home

    /

    zhanhailiang

    /.

    vim

    /

    plugin

    /

    reload

    .

    vim

    14

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    getscriptPlugin

    .

    vim

    15

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    gzip

    .

    vim

    16

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    matchparen

    .

    vim

    17

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    netrwPlugin

    .

    vim

    18

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    rrhelper

    .

    vim

    19

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    spellfile

    .

    vim

    20

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    tarPlugin

    .

    vim

    21

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    tohtml

    .

    vim

    22

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    vimballPlugin

    .

    vim

    23

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    plugin

    /

    zipPlugin

    .

    每日一道理
我把卷子摊在课桌上,恨不得敲一阵锣,叫大家都来看看我这光彩的分数。

    vim

    24

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    scripts

    .

    vim

    25

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    ftplugin

    /

    vim

    .

    vim

    26

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    syntax

    /

    vim

    .

    vim

    27

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    ftplugin

    /

    help

    .

    vim

    28

    :

    /

    usr

    /

    local

    /

    share

    /

    vim

    /

    vim73

    /

    syntax

    /

    help

    .

    vim

    

我的Vim置配:

" set background=dark命令必须在syntax on之前用调,否则无效

    set

    background

    =dark

    syntax

    on

    set

    nocompatible

     " let &termencoding=&encoding

    set

    encoding

    =utf

    -

    8

    set

    tabstop

    =

    4

    set

    softtabstop

    =

    4

    set

    shiftwidth

    =

    4

    set

    nu

    set

    ai

    set

    fdm

    =marker

    set

    foldclose

    =all

    set

    foldopen

    =all

    set

    incsearch

    set

    hlsearch

    set

    history

    =

    100

    set

    ruler

    set

    showcmd

    set

    showmatch

    set

    whichwrap

    =b,s,

    <

    ,

    >

     " 略忽大小写

     " 若是小写模式搜索,则略忽大小写;若模式中有大写,则就要大小写模式敏感

    set

    ignorecase

    smartcase

    set

    expandtab

     " set textwidth=78

       " dispaly tab and space

    set

    list

    set

    listchars

    =tab

    :>-

    ,trail

    :-

       " number of lines used for the command-line

    set

    cmdheight

    =

    2

       " Set to auto read when a file is changed from the outside

    set

    autoread

       " Write the contents of the file automaticly 主动保存

    set

    autowrite

       " 开打状态行

    set

    laststatus

    =

    2

       " :sh

    set

    shell

    =

    /

    bin

    /

    bash

       " ctag

    let

    g

    :

    ctags_statusline=

    1

    set

    tags

    +

    =

    ~/

    public_html

    /

    source

    /

    phpext

    /

    php

    -

    5

    .

    3

    .

    6

       " hi Comment ctermfg =blue

    filetype

    plugin

    on

    if

    !

    exists

    (

    'g:AutoComplPop_Behavior'

    )

    let

    g

    :

    AutoComplPop_Behavior =

    {

    }

    let

    g

    :

    AutoComplPop_Behavior

    [

    'php'

    ]

    =

    [

    ]

    call

    add

    (

    g

    :

    AutoComplPop_Behavior

    [

    'php'

    ]

    ,

    {

    \

    'command'

    :

    "\<C-x>\<C-o>"

    , \

    'pattern'

    :

    printf

    (

    '\(->\|::\|\$\)\k\{%d,}$'

    ,

    0

    )

    , \

    'repeat'

    :

    0

    , \

    }

    )

    endif

       " 删除全部的inoremap射映

    :

    imapclear

       " js 格式化

    :

    nnoremap

    <

    SID

    >

    <F6>

    :

    call

    g

    :

    Jsbeautify

    (

    )

    <CR>

       " 公用注释

    :

    iabbrev #b

    /*****************************************************************

    :

    iabbrev #e

    <

    Space

    >*****************************************************************/

       " 经常性错误主动正纠

     " 注:当碰到经常性犯错的单词时可以添加进来

    :

    iab teh the

       " 每次开打日志文件,主动定位到文件末尾

    autocmd

    BufReadPost

    *.

    log normal G  

    au

    BufRead

    ,

    BufNewFile

    /

    usr

    /

    local

    /

    services

    /

    nginx

    /

    conf

    /*

    set

    ft

    =nginx

    

如何置配Vim,请见【Vim户用手册中文版7.2.pdf】|usr 05.txt| 定制你的Vim

文章结束给大家分享下程序员的一些笑话语录: 程序员喝酒
  我偶尔采用“木马策略”、“交叉测试”,时间不长就开始“频繁分配释放资源”,“cache”也是免不了的了,
  不过我从不搞“轮巡”,也不会“捕获异常”,更不会“程序异常”,因为我有理性
克制的。  

原文地址:https://www.cnblogs.com/xinyuyuanm/p/3037373.html