Vim

1. .vimrc 备份

set encoding=cp936
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936

syntax on

"ff
set fileformat=unix

"Windows
if has("win32")
    "Same copy/cut cache as windows
    set clipboard=unnamed

    "Theme
    colorscheme desert

    set guifont=Consolas:h11:cANSI
    set guifontwide=Consolas:h11:cANSI
    set guifont=Microsoft\ Yahei\ Mono:h11
    set guifontwide=Microsoft\ Yahei\ Mono:h11

    "Courier New is better
    set guifont=Courier\ New:h11
    set guifontwide=Courier\ New:h11

"Linux X-Window
elseif has("gui_running")
    "Theme
    colorscheme desert

    "Same copy/cut cache as x-window 
    set clipboard=unnamedplus

    set guifont=Courier\ 10\ Pitch\ 11
    set guifontwide=Courier\ 10\ Pitch\ 11

    "set lines/columns size when start up
    set lines=57 columns=242
else
    "bg
    set background=light
    set background=dark
endif

"set no swap file
setlocal noswapfile

"nu
set number

"sw
set shiftwidth=4

"autoindent/noautoindent
set autoindent

"c/c++ style indent
"set cindent

"tab width
set tabstop=4


"ignore case in search
set ignorecase

"hilight background in search
set hlsearch


"replace tab with spaces
set expandtab

"backspace=4 * (blank space)
"set smarttab

"set sign of 80'th column
"set cc=80


"status line
set laststatus=2
set statusline=%<%f\ \ [%{&fileformat}]\ %h%m%r%=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"}%k\ \ [%04l,\ %04v]\ \ \ [%p%%]\ \ \ [%L]

"cursor not return to start of line when use G command
set nostartofline

"make the backspace work like in most other programs
set backspace=indent,eol,start

"keep cursor in the middle all the time :)
nnoremap k kzz
nnoremap j jzz
nnoremap p pzz
nnoremap P Pzz
nnoremap G Gzz
nnoremap x xzz
inoremap <ESC> <ESC>zz
nnoremap <ENTER> <ENTER>zz
inoremap <ENTER> <ENTER><ESC>zzi
nnoremap o o<ESC>zza
nnoremap O O<ESC>zza
nnoremap a a<ESC>zza

" a replacement method to keep cursor in the middle, but not as good as the above method.
"set scrolloff=999


"when paste something in, don't indent.
set pastetoggle=<c-h>


"menu/tool bar
"set guioptions-=m  "remove menu bar
set guioptions-=T  "remove tool bar

"menu
set langmenu=zh_CN.UTF-8
source $VIMRUNTIME/menu.vim
source $VIMRUNTIME/delmenu.vim


"maximize window when startup
if has('win32')
    au GUIEnter * simalt ~x
else
    au GUIEnter * call MaximizeWindow()
endif

function! MaximizeWindow()
    silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
endfunction


" Crypt Method (zip, blowfish, blowfish2)
set cm=blowfish2

" Do not use viminfo and backup, because it's not encrypted.
"set secure
"set viminfo=
set nobackup
set nowritebackup
set noswapfile
"set history=0
"set noshelltemp


" VOoM plugin settings
command V Voom markdown
let g:voom_tree_width=62
set fdl=3
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
149
150
151
152
153

2. 操作命令

  • 如何在 GVim 的搜索框中粘贴
:
Ctrl + r
"
1
2
3
  • 列选择 Ctrl + q

  • 临时清除搜索高亮 :noh

  • 删除所有空行 :g/^$/d

3. VOoM 插件

  • 链接

  • 安装

    • 需要安装 Python3 32-bit 版本,安装过程中选中添加到 PATH

    • 简单方式: VOoM 将解压出来的几个文件夹放到 ~/vimfiles/ 目录中即可

    • Linux 环境: $sudo apt-get install vim-voom

  • 设置折叠级别

    • Windows 版本,修改 vimfiles\autoload\voom\voom_vimplugin2657\voom_vim.py 文件,搜索设置 setl fdl=3
    • fdl=3,意味着,从 H5 (#####) 开始,才折叠。
最近更新: 7/29/2019, 5:47:31 PM