├── VimFlavor
├── plugin
└── textobj
│ └── datetime.vim
└── doc
└── textobj-datetime.txt
/VimFlavor:
--------------------------------------------------------------------------------
1 | flavor 'kana/vim-textobj-user', '~> 0.3'
2 |
--------------------------------------------------------------------------------
/plugin/textobj/datetime.vim:
--------------------------------------------------------------------------------
1 | " textobj-datetime - Text objects for date and time
2 | " Version: 0.3.3
3 | " Copyright (C) 2007-2013 Kana Natsuno
4 | " License: So-called MIT/X license {{{
5 | " Permission is hereby granted, free of charge, to any person obtaining
6 | " a copy of this software and associated documentation files (the
7 | " "Software"), to deal in the Software without restriction, including
8 | " without limitation the rights to use, copy, modify, merge, publish,
9 | " distribute, sublicense, and/or sell copies of the Software, and to
10 | " permit persons to whom the Software is furnished to do so, subject to
11 | " the following conditions:
12 | "
13 | " The above copyright notice and this permission notice shall be included
14 | " in all copies or substantial portions of the Software.
15 | "
16 | " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 | " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | " }}}
24 |
25 | if exists('g:loaded_textobj_datetime')
26 | finish
27 | endif
28 |
29 |
30 |
31 |
32 | let s:REGEXP__TZ = '\%(Z\|[+-]\d\d:\d\d\)'
33 | let s:REGEXP_TZ = '\%(:\d\d\%(\.\d\+\)\?\)\zs' . s:REGEXP__TZ
34 |
35 | let s:REGEXP_TIME = '\d\d:\d\d\%(:\d\d\%(\.\d\+\)\?\)\?'
36 |
37 | let s:REGEXP__DATE = '\d\d\d\d-\d\d-\d\d'
38 | let s:REGEXP_DATE = '\d\d\d\d\%(-\d\d\%(-\d\d\)\?\)\?'
39 |
40 | let s:REGEXP_FULL = s:REGEXP__DATE . 'T' . s:REGEXP_TIME
41 | \ . '\%(' . s:REGEXP__TZ . '\)\?'
42 |
43 | let s:REGEXP_AUTO = '\%('
44 | \ . '\%(' . s:REGEXP_FULL . '\)'
45 | \ . '\|' . '\%(' . s:REGEXP_DATE . '\)'
46 | \ . '\|' . '\%(' . s:REGEXP_TIME . '\)'
47 | \ . '\|' . '\%(' . s:REGEXP_TZ . '\)'
48 | \ . '\)'
49 |
50 |
51 |
52 |
53 | call textobj#user#plugin('datetime', {
54 | \ 'auto': {'select': ['ada', 'ida'], '*pattern*': s:REGEXP_AUTO},
55 | \ 'full': {'select': ['adf', 'idf'], '*pattern*': s:REGEXP_FULL},
56 | \ 'date': {'select': ['add', 'idd'], '*pattern*': s:REGEXP_DATE},
57 | \ 'time': {'select': ['adt', 'idt'], '*pattern*': s:REGEXP_TIME},
58 | \ 'tz': {'select': ['adz', 'idz'], '*pattern*': s:REGEXP_TZ},
59 | \ })
60 |
61 |
62 |
63 |
64 | let g:loaded_textobj_datetime = 1
65 |
66 | " __END__
67 | " vim: foldmethod=marker
68 |
--------------------------------------------------------------------------------
/doc/textobj-datetime.txt:
--------------------------------------------------------------------------------
1 | *textobj-datetime.txt* Text objects for date and time
2 |
3 | Version 0.3.3
4 | Script ID: 2101
5 | Copyright (C) 2007-2013 Kana Natsuno
6 | License: So-called MIT/X license {{{
7 | Permission is hereby granted, free of charge, to any person obtaining
8 | a copy of this software and associated documentation files (the
9 | "Software"), to deal in the Software without restriction, including
10 | without limitation the rights to use, copy, modify, merge, publish,
11 | distribute, sublicense, and/or sell copies of the Software, and to
12 | permit persons to whom the Software is furnished to do so, subject to
13 | the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included
16 | in all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 | }}}
26 |
27 | CONTENTS *textobj-datetime-contents*
28 |
29 | Introduction |textobj-datetime-introduction|
30 | Interface |textobj-datetime-interface|
31 | Key Mapings |textobj-datetime-key-mappings|
32 | Customizing |textobj-datetime-customizing|
33 | Bugs |textobj-datetime-bugs|
34 | ChangeLog |textobj-datetime-changelog|
35 |
36 |
37 |
38 |
39 | ==============================================================================
40 | INTRODUCTION *textobj-datetime-introduction*
41 |
42 | *textobj-datetime* is a Vim plugin to provide text objects for date and time.
43 |
44 |
45 | Requirements:
46 | - Vim 7.0 or later
47 | - |textobj-user| 0.3.3 or later (vimscript#2100)
48 |
49 | Latest version:
50 | https://github.com/kana/vim-textobj-datetime
51 |
52 | Document in HTML format:
53 | http://vim-doc.heroku.com/view?https://github.com/kana/vim-textobj-datetime/blob/master/doc/textobj-datetime.txt
54 |
55 |
56 |
57 |
58 | ==============================================================================
59 | INTERFACE *textobj-datetime-interface*
60 |
61 | ------------------------------------------------------------------------------
62 | KEY MAPPINGS *textobj-datetime-key-mappings*
63 |
64 | (textobj-datetime-auto) *(textobj-datetime-auto)*
65 | Select one of the following objects (as long as possible).
66 |
67 | (textobj-datetime-full) *(textobj-datetime-full)*
68 | Select a date and time.
69 |
70 | (textobj-datetime-date) *(textobj-datetime-date)*
71 | Select a date (YYYY or YYYY-MM or YYYY-MM-DD).
72 |
73 | (textobj-datetime-time) *(textobj-datetime-time)*
74 | Select a time (hh:mm or hh:mm:ss).
75 |
76 | (textobj-datetime-tz) *(textobj-datetime-tz)*
77 | Select a time zone designator (Z or +hh:mm or -hh:mm).
78 | It must be preceded by a time.
79 |
80 |
81 |
82 |
83 | ==============================================================================
84 | CUSTOMIZING *textobj-datetime-customizing*
85 |
86 | *g:textobj_datetime_no_default_key_mappings*
87 | *:TextobjDatetimeDefaultKeyMappings*
88 | This plugin will define the following key mappings in Visual mode and
89 | Operator-pending mode automatically. If you don't want these key mappings,
90 | define |g:textobj_datetime_no_default_key_mappings| before this plugin is
91 | loaded (e.g. in $MYVIMRC). You can also use
92 | |:TextobjDatetimeDefaultKeyMappings| to redefine these key mappings.
93 |
94 | {lhs} {rhs} ~
95 | ----- --------------------------- ~
96 | ada (textobj-datetime-auto)
97 | add (textobj-datetime-date)
98 | adf (textobj-datetime-full)
99 | adt (textobj-datetime-time)
100 | adz (textobj-datetime-tz)
101 |
102 | ida (textobj-datetime-auto)
103 | idd (textobj-datetime-date)
104 | idf (textobj-datetime-full)
105 | idt (textobj-datetime-time)
106 | idz (textobj-datetime-tz)
107 |
108 | Note that there is no difference between a{x} and i{x}.
109 |
110 |
111 |
112 |
113 | ==============================================================================
114 | BUGS *textobj-datetime-bugs*
115 |
116 | Currently, W3C-DTF is only supported.
117 |
118 | [W3C-DTF] http://www.w3.org/TR/NOTE-datetime
119 |
120 |
121 |
122 |
123 | ==============================================================================
124 | CHANGELOG *textobj-datetime-changelog*
125 |
126 | 0.3.3 2013-01-17T21:27:09+09:00 *textobj-datetime-changelog-0.3.3*
127 | - Support vim-flavor .
128 | - Update |textobj-datetime-introduction|.
129 |
130 | 0.3.2 2012-03-24T14:34:19+09:00 *textobj-datetime-changelog-0.3.2*
131 | - Refine the document a bit.
132 | - Refine the internal structure a bit.
133 |
134 | 0.3.1 2008-06-11T22:07:26+09:00 *textobj-datetime-changelog-0.3.1*
135 | - Modify to use textobj-user version 0.3.3 or later.
136 |
137 | 0.3 2008-06-08T21:41:15+09:00 *textobj-datetime-changelog-0.3*
138 | - Modify to use textobj-user version 0.3 or later.
139 | - Rename interface mappings. For example:
140 | Old name: textobj#datetime#full
141 | New name: (textobj-datetime-full)
142 |
143 | 0.2 2008-01-08T23:03:05+09:00 *textobj-datetime-changelog-0.2*
144 | - Fix the incorrect design - modify not to be autoloaded.
145 | - Modify the policy for the defauly key mappings.
146 | See |g:textobj_datetime_no_default_key_mappings|.
147 |
148 | 0.1 2007-11-17 *textobj-datetime-changelog-0.1*
149 | - Requires |textobj-user|.
150 | - Modify to be autoloaded.
151 | - Change the name of APIs.
152 |
153 | 0.0 2007-09-26 *textobj-datetime-changelog-0.0*
154 | - First release.
155 |
156 |
157 |
158 |
159 | ==============================================================================
160 | vim:tw=78:ts=8:ft=help:norl:fen:fdl=0:fdm=marker:
161 |
--------------------------------------------------------------------------------