PYENV prompt.
[profile.git] / .vim / plugin / speeddating.vim
1 " speeddating.vim - Use CTRL-A/CTRL-X to increment dates, times, and more
2 " Maintainer:   Tim Pope <http://tpo.pe/>
3 " Version:      20150124
4 " GetLatestVimScripts: 2120 1 :AutoInstall: speeddating.vim
5
6 " Initialization {{{1
7
8 if exists("g:loaded_speeddating") || &cp || v:version < 700
9   finish
10 endif
11 let g:loaded_speeddating = 1
12
13 let s:cpo_save = &cpo
14 set cpo&vim
15
16 let g:speeddating_handlers = []
17
18 " }}}1
19 " Time Handler {{{1
20
21 function! s:add_format(master,count,bang)
22   " Calls with neither argument nor count are for information,
23   " and so should be handled immediately.
24   " Call loadformats to cause autoloading to happen
25   if a:master == "" && !a:count
26     call speeddating#loadformats()
27   endif
28
29   if exists("g:speeddating_loaded_formats")
30     " Autoloading already done pass on request immediately
31     call speeddating#adddate(a:master,a:count,a:bang)
32   else
33     " Defer handling of format specifications until autoloading is done
34     let g:speeddating_formats += [[a:master,a:count,a:bang]]
35   endif
36 endfunction
37
38 command! -bar -bang -count=0 -nargs=? SpeedDatingFormat :call s:add_format(<q-args>,<count>,<bang>0)
39
40 " }}}1
41 " Maps {{{1
42
43 nnoremap <silent> <Plug>SpeedDatingUp   :<C-U>call speeddating#increment(v:count1)<CR>
44 nnoremap <silent> <Plug>SpeedDatingDown :<C-U>call speeddating#increment(-v:count1)<CR>
45 vnoremap <silent> <Plug>SpeedDatingUp   :<C-U>call speeddating#incrementvisual(v:count1)<CR>
46 vnoremap <silent> <Plug>SpeedDatingDown :<C-U>call speeddating#incrementvisual(-v:count1)<CR>
47 nnoremap <silent> <Plug>SpeedDatingNowLocal :<C-U>call speeddating#timestamp(0,v:count)<CR>
48 nnoremap <silent> <Plug>SpeedDatingNowUTC   :<C-U>call speeddating#timestamp(1,v:count)<CR>
49
50 if !exists("g:speeddating_no_mappings") || !g:speeddating_no_mappings
51   nmap  <C-A>     <Plug>SpeedDatingUp
52   nmap  <C-X>     <Plug>SpeedDatingDown
53   xmap  <C-A>     <Plug>SpeedDatingUp
54   xmap  <C-X>     <Plug>SpeedDatingDown
55   nmap d<C-A>     <Plug>SpeedDatingNowUTC
56   nmap d<C-X>     <Plug>SpeedDatingNowLocal
57 endif
58
59 " }}}1
60 " Default Formats {{{1
61
62 if exists('g:speeddating_formats')
63   finish
64 endif
65 let g:speeddating_formats = []
66 SpeedDatingFormat %i, %d %h %Y %H:%M:%S %z        " RFC822
67 SpeedDatingFormat %i, %h %d, %Y at %I:%M:%S%^P %z " mutt default date format
68 SpeedDatingFormat %a %b %_d %H:%M:%S %Z %Y        " default date(1) format
69 SpeedDatingFormat %a %h %-d %H:%M:%S %Y %z        " git
70 SpeedDatingFormat %h %_d %H:%M:%S                 " syslog
71 SpeedDatingFormat %Y-%m-%d%[ T_-]%H:%M:%S %z
72 SpeedDatingFormat %Y-%m-%d%[ T_-]%H:%M:%S%?[Z]    " SQL, etc.
73 SpeedDatingFormat %Y-%m-%d%[ T_-]%H:%M%z          " date -Im
74 SpeedDatingFormat %Y-%m-%d%[ T_-]%H:%M
75 SpeedDatingFormat %Y-%m-%d
76 SpeedDatingFormat %-I:%M:%S%?[ ]%^P
77 SpeedDatingFormat %-I:%M%?[ ]%^P
78 SpeedDatingFormat %-I%?[ ]%^P
79 SpeedDatingFormat %H:%M:%S,%k                     " SRT file
80 SpeedDatingFormat %H:%M:%S
81 SpeedDatingFormat %B %o, %Y
82 SpeedDatingFormat %d%[-/ ]%b%1%y
83 SpeedDatingFormat %d%[-/ ]%b%1%Y                " These three are common in the
84 SpeedDatingFormat %Y %b %d                      " 'Last Change:' headers of
85 SpeedDatingFormat %b %d, %Y                     " Vim runtime files
86 SpeedDatingFormat %^v
87 SpeedDatingFormat %v
88
89 " }}}1
90
91 let &cpo = s:cpo_save
92
93 " vim:set et sw=2 sts=2: