2006年11月19日VI的主题安装、判断YYYY-MM-DD正则表达式考虑闰年

来源:互联网 发布:单片机基础 编辑:程序博客网 时间:2024/06/07 00:37

        2006年11月19日 星期六 天气阴         Last Modify: Nov 19 2006

==================================================================================

 

今天下载了一个VI的颜色主题

moria : A color scheme for GUI supposed to be highly readable

特点在于关键字在Mix模式下可以为粗体,虽然没有什么意思(因为在暗色模式下关键字已经高亮了),但是还是个有用的尝试。下面是他的安装指南。感觉在VI里缩进文本真是麻烦,不支持鼠标拖放,只能说是写代码的好工具……

 

判断YYYY-MM-DD正则表达式

-----------------------

这里是判断YYYY-MM-DD这种格式的,基本上把闰年和2月等的情况都考虑进去了,不过我已经忘了在哪里找到的。

 

^((((1[6-9]|[2-9]/d)/d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]/d|3[01]))|(((1[6-9]|[2-9]/d)/d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]/d|30))|(((1[6-9]|[2-9]/d)/d{2})-0?2-(0?[1-9]|1/d|2[0-8]))|(((1[6-9]|[2-9]/d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$

 

 

 

下面的是加了时间验证的

 

^((((1[6-9]|[2-9]/d)/d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]/d|3[01]))|(((1[6-9]|[2-9]/d)/d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]/d|30))|(((1[

 

VI的主题安装

-------------------------

install details

 

Just put it in "~/.vim/colors" or in "/vimfiles/colors" on Windows. Do ":colo moria" to apply it. If you want to install it as your default color scheme, just add "colo moria" to your vimrc file.

 

The color scheme choses the color scheme 'dark' if 'background' is set to dark and 'light' if 'background' is set to light. One can override this by setting the variable 'moria_style'. Its possible values are 'black', 'dark', 'darkslategray', 'light', and 'white'. The 'dark' scheme has #202020 as its background, the 'light' scheme #f0f0f0, the 'darkslategray' scheme DarkSlateGray, the 'black' ('white') scheme has a black (white) background. If you want to use the 'white' scheme, just do

 

let moria_style = 'white'

colo moria

 

in your vimrc file. Alternatively, you can set the option 'background' instead of 'moria_style' to 'dark' or 'light' and the color scheme applies either the 'dark' scheme or the 'light' one.

 

In gVim you can do 'Colo black', 'Colo dark', 'Colo darkslategray', 'Colo light', and 'Colo white' to swith to the color scheme you want. In Vim (console version) these commands just swith between a dark and a light scheme.

 

In the dark schemes ('black', 'dark', and 'darkslategray') bold highlights are avoided. However, some people like the highlights 'Statement' and 'Type' to be bold. If you belong to these people, just add

 

let moria_fontface = 'mixed'

 

to your vimrc file (before 'colo moria', of course).

 

        Rev 1.0        Create Document Nov 19 2006

原创粉丝点击