Show
Ignore:
Timestamp:
01/17/08 01:19:29 (10 months ago)
Author:
kana
Message:

vim/dot.vim/plugin/textobj/datetime.vim:
* Move from vim/dot.vim/autoload/textobj/datetime.vim.
* Fix to be a usual plugin, because there is no reason to be autoloaded.
* Modify the policy for the default key mappings.
* s:select(): Remove unnecessary echomsg.
* Mark as version 0.2.

vim/dot.vim/doc/textobj-datetime.txt:
* Update some inproper sentences.
* Update for the above changes.

Location:
lang/vim/textobj-datetime/trunk
Files:
2 modified
1 moved

Legend:

Unmodified
Added
Removed
  • lang/vim/textobj-datetime/trunk/doc/textobj-datetime.txt

    r3176 r4726  
    11*textobj-datetime.txt*  Text objects for date and time. 
    22 
    3 Version 0.1 
    4 Copyright (C) 2007 kana <http://nicht.s8.xrea.com/> 
     3Version 0.2 
     4Copyright (C) 2007-2008 kana <http://nicht.s8.xrea.com/> 
    55License: MIT license (see <http://www.opensource.org/licenses/mit-license>) 
    66$Id$ 
     7 
     8 
     9CONTENTS                                        *textobj-datetime-contents* 
     10 
     11Introduction                    |textobj-datetime-introduction| 
     12Key Mapings                     |textobj-datetime-key-mappings| 
     13Customizing                     |textobj-datetime-customizing| 
     14Bugs                            |textobj-datetime-bugs| 
     15ChangeLog                       |textobj-datetime-changelog| 
    716 
    817 
     
    1524 
    1625Requirements: 
    17 * |textobj-user| 
     26* Vim 7.0 or later. 
     27* |textobj-user| <http://www.vim.org/scripts/script.php?script_id=2100> 
    1828 
    1929 
     
    2131 
    2232============================================================================== 
    23 KEY MAPPINGS                                    *textobj-datetime-keymappings* 
     33KEY MAPPINGS                                    *textobj-datetime-key-mappings* 
     34 
     35<Plug>textobj#datetime#auto                     *<Plug>textobj#datetime#auto* 
     36        Select one of the following objects (as long as possible). 
    2437 
    2538<Plug>textobj#datetime#full                     *<Plug>textobj#datetime#full* 
    26         Select date plus time. 
     39        Select a date and time. 
    2740 
    2841<Plug>textobj#datetime#date                     *<Plug>textobj#datetime#date* 
     
    3043 
    3144<Plug>textobj#datetime#time                     *<Plug>textobj#datetime#time* 
    32         Select time (hh:mm or hh:mm:ss). 
     45        Select a time (hh:mm or hh:mm:ss). 
    3346 
    3447<Plug>textobj#datetime#tz                       *<Plug>textobj#datetime#tz* 
    3548        Select a time zone designator (Z or +hh:mm or -hh:mm). 
    36         It must be preceding a time. 
     49        It must be preceded by a time. 
    3750 
    38 <Plug>textobj#datetime#auto                     *<Plug>textobj#datetime#auto* 
    39         Select one of the above (as long as possible). 
    4051 
    41                                         *textobj#datetime#default_mappings()* 
    42 textobj-datetime provides textobj#datetime#default_mappings() to define some 
    43 useful key mappings.  Call it from your |vimrc|. 
    4452 
    45         {lhs}   {rhs}                   ~ 
    46         -----   ------------------------~ 
     53 
     54============================================================================== 
     55CUSTOMIZING                                     *textobj-datetime-customizing* 
     56 
     57                                  *g:textobj_datetime_no_default_key_mappings* 
     58                                          *:TextobjDatetimeDefaultKeyMappings* 
     59This plugin will define the following key mappings in Visual mode and 
     60Operator-pending mode automatically.  If you don't want these key mappings, 
     61define |g:textobj_datetime_no_default_key_mappings| before this plugin is 
     62loaded (e.g. in $MYVIMRC).  You can also use 
     63|:TextobjDatetimeDefaultKeyMappings| to redefine these key mappings. 
     64 
     65        {lhs}   {rhs}                           ~ 
     66        -----   ---------------------------     ~ 
    4767        ada     <Plug>textobj#datetime#auto 
    4868        add     <Plug>textobj#datetime#date 
     
    5777        idz     <Plug>textobj#datetime#tz 
    5878 
     79Note that there is no difference between a{x} and i{x}. 
     80 
    5981 
    6082 
    6183 
    6284============================================================================== 
    63 BUGS                                                    *textobj-datetime-bugs* 
     85BUGS                                            *textobj-datetime-bugs* 
    6486 
    6587Currently, W3C-DTF is only supported. 
     
    7294============================================================================== 
    7395CHANGELOG                                       *textobj-datetime-changelog* 
     96 
     970.2     2008-01-08T23:03:05+09:00 
     98        - Fix the incorrect design - modify not to be autoloaded. 
     99        - Modify the policy for the defauly key mappings. 
     100          See |g:textobj_datetime_no_default_key_mappings|. 
    74101 
    751020.1     2007-11-17 
  • lang/vim/textobj-datetime/trunk/plugin/textobj/datetime.vim

    r3176 r4726  
    11" textobj-datetime - Text objects for date and time. 
    2 " Version: 0.1 
    3 " Copyright (C) 2007 kana <http://nicht.s8.xrea.com/> 
     2" Version: 0.2 
     3" Copyright (C) 2007-2008 kana <http://nicht.s8.xrea.com/> 
    44" License: MIT license (see <http://www.opensource.org/licenses/mit-license>) 
    5 " $Id$ 
    6 " Interfaces  "{{{1 
     5" $Id$  "{{{1 
     6 
     7if exists('g:loaded_textobj_datetime') 
     8  finish 
     9endif 
     10 
     11 
     12 
     13 
     14 
     15 
     16 
     17 
     18" Interface  "{{{1 
    719 
    820vnoremap <silent> <Plug>textobj#datetime#auto 
     
    3143 
    3244 
    33 function! textobj#datetime#default_mappings(...) 
    34   let forcep = (a:0 ? a:1 : 0) 
     45command! -bang -bar -nargs=0 TextobjDatetimeDefaultKeyMappings 
     46      \ call s:default_key_mappings('<bang>' == '!') 
    3547 
    36   function! s:Map(forcep, lhs, rhs) 
    37     execute 'vmap' (a:forcep ? '' : '<unique>') a:lhs a:rhs 
    38     execute 'omap' (a:forcep ? '' : '<unique>') a:lhs a:rhs 
     48function! s:default_key_mappings(bangedp) 
     49  let forcedp = (a:bangedp ? '' : '<unique>') 
     50 
     51  function! s:Map(forcedp, lhs, rhs) 
     52    execute 'vmap' (a:forcedp ? '' : '<unique>') a:lhs a:rhs 
     53    execute 'omap' (a:forcedp ? '' : '<unique>') a:lhs a:rhs 
    3954  endfunction 
    4055 
    41   call s:Map(forcep, 'ada', '<Plug>textobj#datetime#auto') 
    42   call s:Map(forcep, 'adf', '<Plug>textobj#datetime#full') 
    43   call s:Map(forcep, 'add', '<Plug>textobj#datetime#date') 
    44   call s:Map(forcep, 'adt', '<Plug>textobj#datetime#time') 
    45   call s:Map(forcep, 'adz', '<Plug>textobj#datetime#tz') 
     56  call s:Map(forcedp, 'ada', '<Plug>textobj#datetime#auto') 
     57  call s:Map(forcedp, 'adf', '<Plug>textobj#datetime#full') 
     58  call s:Map(forcedp, 'add', '<Plug>textobj#datetime#date') 
     59  call s:Map(forcedp, 'adt', '<Plug>textobj#datetime#time') 
     60  call s:Map(forcedp, 'adz', '<Plug>textobj#datetime#tz') 
    4661 
    47   call s:Map(forcep, 'ida', '<Plug>textobj#datetime#auto') 
    48   call s:Map(forcep, 'idf', '<Plug>textobj#datetime#full') 
    49   call s:Map(forcep, 'idd', '<Plug>textobj#datetime#date') 
    50   call s:Map(forcep, 'idt', '<Plug>textobj#datetime#time') 
    51   call s:Map(forcep, 'idz', '<Plug>textobj#datetime#tz') 
     62  call s:Map(forcedp, 'ida', '<Plug>textobj#datetime#auto') 
     63  call s:Map(forcedp, 'idf', '<Plug>textobj#datetime#full') 
     64  call s:Map(forcedp, 'idd', '<Plug>textobj#datetime#date') 
     65  call s:Map(forcedp, 'idt', '<Plug>textobj#datetime#time') 
     66  call s:Map(forcedp, 'idz', '<Plug>textobj#datetime#tz') 
     67  return 
    5268endfunction 
     69 
     70if !exists('g:textobj_datetime_no_default_key_mappings') 
     71  TextobjDatetimeDefaultKeyMappings 
     72endif 
    5373 
    5474 
     
    6282 
    6383function! s:select(type, previous_mode) 
    64   echomsg 's:select' string(a:type) string(a:previous_mode) 
    6584  return textobj#user#select(s:PATTERNS[a:type], '', a:previous_mode) 
    6685endfunction 
     
    96115 
    97116 
    98 " __END__  "{{{1 
     117" Fin.  "{{{1 
     118 
     119let g:loaded_textobj_datetime = 1 
     120 
     121 
     122 
     123 
     124 
     125 
     126 
     127 
     128" __END__ 
    99129" vim: foldmethod=marker