Skip to content

Commit 8ead033

Browse files
author
pydave
committed
Convert api functions to autoload-style
Rename the speeddating API functions to use autoload style in preparation for porting to autoload. Other functions are kept as script-level functions since they aren't accessed outside of speeddating (and don't need to be loaded on-demand -- only after the API is loaded).
1 parent e5995ff commit 8ead033

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

plugin/speeddating.vim

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ endfunction
9090
" }}}1
9191
" Normal Mode {{{1
9292

93-
function! s:increment(increment)
93+
function! speeddating#increment(increment)
9494
for handler in s:time_handlers + g:speeddating_handlers
9595
let pattern = type(handler.regexp) == type(function('tr')) ? handler.regexp() : handler.regexp
9696
let [start,end,string;caps] = s:findinline('\C'.pattern)
@@ -167,7 +167,7 @@ function! s:incrementstring(string,offset,count)
167167
return [repl,offset,start,end]
168168
endfunction
169169

170-
function! s:incrementvisual(count)
170+
function! speeddating#incrementvisual(count)
171171
let ve = &ve
172172
set virtualedit=all
173173
exe "norm! gv\<Esc>"
@@ -549,7 +549,7 @@ let s:strftime_items = {
549549
" }}}1
550550
" Time Handler {{{1
551551

552-
function! s:timestamp(utc,count)
552+
function! speeddating#timestamp(utc,count)
553553
for handler in s:time_handlers
554554
let [start,end,string;caps] = s:findinline('\C'.join(handler.groups,''))
555555
if string != ""
@@ -736,7 +736,7 @@ function! s:comparecase(i1, i2)
736736
endif
737737
endfunction
738738

739-
function! s:adddate(master,count,bang)
739+
function! speeddating#adddate(master,count,bang)
740740
if a:master == ""
741741
let time = s:initializetime({'y':1970,'s':localtime(),'z': 'UTC'})
742742
if a:bang && a:count
@@ -790,7 +790,7 @@ endfunction
790790

791791
let s:time_handlers = []
792792

793-
command! -bar -bang -count=0 -nargs=? SpeedDatingFormat :call s:adddate(<q-args>,<count>,<bang>0)
793+
command! -bar -bang -count=0 -nargs=? SpeedDatingFormat :call speeddating#adddate(<q-args>,<count>,<bang>0)
794794

795795
" }}}1
796796
" Default Formats {{{1
@@ -819,12 +819,12 @@ SpeedDatingFormat %v
819819
" }}}1
820820
" Maps {{{1
821821

822-
nnoremap <silent> <Plug>SpeedDatingUp :<C-U>call <SID>increment(v:count1)<CR>
823-
nnoremap <silent> <Plug>SpeedDatingDown :<C-U>call <SID>increment(-v:count1)<CR>
824-
vnoremap <silent> <Plug>SpeedDatingUp :<C-U>call <SID>incrementvisual(v:count1)<CR>
825-
vnoremap <silent> <Plug>SpeedDatingDown :<C-U>call <SID>incrementvisual(-v:count1)<CR>
826-
nnoremap <silent> <Plug>SpeedDatingNowLocal :<C-U>call <SID>timestamp(0,v:count)<CR>
827-
nnoremap <silent> <Plug>SpeedDatingNowUTC :<C-U>call <SID>timestamp(1,v:count)<CR>
822+
nnoremap <silent> <Plug>SpeedDatingUp :<C-U>call speeddating#increment(v:count1)<CR>
823+
nnoremap <silent> <Plug>SpeedDatingDown :<C-U>call speeddating#increment(-v:count1)<CR>
824+
vnoremap <silent> <Plug>SpeedDatingUp :<C-U>call speeddating#incrementvisual(v:count1)<CR>
825+
vnoremap <silent> <Plug>SpeedDatingDown :<C-U>call speeddating#incrementvisual(-v:count1)<CR>
826+
nnoremap <silent> <Plug>SpeedDatingNowLocal :<C-U>call speeddating#timestamp(0,v:count)<CR>
827+
nnoremap <silent> <Plug>SpeedDatingNowUTC :<C-U>call speeddating#timestamp(1,v:count)<CR>
828828
829829
if !exists("g:speeddating_no_mappings") || !g:speeddating_no_mappings
830830
nmap <C-A> <Plug>SpeedDatingUp

0 commit comments

Comments
 (0)