Tairan's Story

「知之真切笃实处即是行,行之明觉精察处即是知,知行工夫不可离。」


我的 Vim 环境设置

为了保证知识的连续性,所以我选择了vim。并且慢慢的开始习惯。。。但是这样也带来一个后果,就是总是在编辑的时候想按<esc>或者<i>来切换命令和编辑模式。:)
我的配置文件还是有一些个人特色的,毕竟被Windows侵蚀多年,有些习惯还不是一时半会能改过来的,所以就把Windows上的一些编辑快捷键也加入进来了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    "
    " Simplify settings for VIM 7.x or later
    "
    " Copyright (c) 2008, 2009 Tairan Wang All Rights Reserved.
    "
    " Tairan Wang <tairan.wang(at)gmail.com>
    "
    " $Id: vimrc 38 2009-02-06 03:16:59Z Tairan.Wang $
    "
 
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " General
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " Get out of VI's compatibale mode.
    set nocompatible
 
    " Set how many lines of history VIM har to remember
    set history=400
 
    " Enable filetype plugin
    filetype plugin on
    filetype indent on
 
    " Set to auto read when a file is changed from the outside
    set autoread
 
    " Have the mouse enabled all the time:
    set mouse=a
 
    " Reset the menu languge.
    source $VIMRUNTIME/delmenu.vim
    set langmenu=none
    source $VIMRUNTIME/menu.vim
 
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " Fileformats
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    set encoding=utf-8
    set fileencoding=utf-8
    " Favorite filetype
    " set fileencodings=ucs-bom,utf-8,gbk,big5
    set fileencodings=utf-8,gbk,big5
 
    " Compatible windows notepad mode
    source $VIMRUNTIME/mswin.vim
    behave mswin
 
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " Color and Fonts
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " Enable syntax heightlight
    syntax enable
    syntax on
 
    set cursorline
 
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " Indent
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " C-style indeting
    set cindent
    " Auto indent
    set autoindent
    " Smart indent
    set smartindent
    " Wrap lines
    set wrap
 
    set showmatch
 
    " Display line number
    set number
    set ruler
 
    set listchars=tab:>>,eol:$,trail:-
    set list
 
    " Setting the smart tab
    set shiftwidth=4
    set tabstop=4
    set sts=4
    set expandtab
    set smarttab
 
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " Files and backups
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    set nobackup
    set nowritebackup
    set bsdir=buffer
    set autochdir
 
    set noar
 
    " Ignore case when searching
    set ignorecase
    set incsearch
 
    set ambiwidth=double
 
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    " Close pair automatic
    """"""""""""""""""""""""""""""""""""""""""""""""""""""
    :inoremap ( ()<ESC>i
    :inoremap ) <c-r>=ClosePair(')')<CR>
    :inoremap { {}<ESC>i
    :inoremap } <c-r>=ClosePair('}')<CR>
    :inoremap [ []<ESC>i
    :inoremap ] <c-r>=ClosePair(']')<CR>
    :inoremap " ""<ESC>i
    :inoremap ' ''<ESC>i
 
 
    function! ClosePair(char)
     if getline('.')[col('.') - 1] == a:char
         return "\<Right>"
     else
         return a:char
     endif
    endfunction
 
 
    if has("gui_running")
        map <C-Tab> :tabnext<CR>
        imap <C-Tab> <Esc>:tabnext<CR>
 
        colorscheme desert
 
        set columns=120
        set lines=50
 
        set guioptions-=T
        set guioptions+=m
    else
        map <C-K><C-T> :tabnext<CR>
        imap <C-K><C-T> <Esc>:tabnext<CR>
 
        colorscheme default
    endif
 
    if has("win32")
        au GUIEnter * simalt ~x
    endif
 
    au VimEnter * NERDTreeToggle
 
    " Open and close the NERD_tree.vim separately
    nmap <F7> <ESC>:NERDTreeToggle<RETURN>

From Tairan's Story, post 我的 Vim 环境设置

Post Footer automatically generated by wp-posturl plugin for wordpress.

No Comments » | Tags: | Categories: Technology, 我的声音

Leave a Reply



我的豆瓣

二维码快速链接
QR Code fuer diese Seite