Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix bug for TImeline() that resulted in it creating all new tab

  • Loading branch information...
commit 5fdd230b70852dd09cbd9a874e9de31d75fce13d 1 parent 146f497
@hsitz authored
View
25 ftplugin/org.vim
@@ -120,6 +120,13 @@ let b:v.suppress_list_indent=0
" everything in between is executed only the first time an
" org file is opened
if !exists('g:org_loaded')
+function! s:SID()
+ return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
+endfun
+let g:org_sid = s:SID()
+function! OrgSID(func)
+ execute 'call <SNR>'.s:SID().'_'.a:func
+endfunction
if !exists('g:org_custom_column_options')
let g:org_custom_column_options = ['%ITEM %15DEADLINE %35TAGS', '%ITEM %35TAGS']
@@ -3046,6 +3053,13 @@ function! s:ResultsToAgenda( search_type )
endfor
call append(s:agenda_insert_point,lines)
endfunction
+function! s:ToFromAgenda()
+ if bufname('%') == '__Agenda__'
+ windo if bufname('%') !~ '__Agenda__\|__Calendar' | return | endif
+ elseif bufwinnr('__Agenda__') > 0
+ exec bufwinnr('__Agenda__') . 'wincmd w'
+ endif
+endfunction
function! s:DoAgendaMaps()
execute "source " . s:sfile . '/vimorg-agenda-mappings.vim'
@@ -3311,6 +3325,7 @@ function! OrgRunAgenda(date,count,...)
else
call s:MakeAgenda(a:date,a:count)
endif
+ AAgenda
call s:SetupDateAgendaWin()
"we are no in newly created agenda buf/window
@@ -3679,10 +3694,11 @@ function! s:Timeline(...)
if exists('g:agenda_files')
let prev_files = g:agenda_files
endif
- exec "let g:agenda_files=['".substitute(expand("%"),' ','\\ ','g')."']"
+ exec "let g:agenda_files=['".substitute(expand("%:p"),' ','\\ ','g')."']"
call s:BufMinMaxDate()
let num_days = 1 + calutil#jul(b:v.MinMaxDate[1]) - calutil#jul(b:v.MinMaxDate[0])
try
+ "AAgenda
call OrgRunAgenda(b:v.MinMaxDate[0], num_days,spec)
finally
if exists('prev_spec')
@@ -5868,13 +5884,6 @@ function! <SID>CalendarInsertDate(day, month, year, week, dir)
"call confirm('got here')
endfunction
-function! s:SID()
- return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
-endfun
-let g:org_sid = s:SID()
-function! OrgSID(func)
- execute 'call <SNR>'.s:SID().'_'.a:func
-endfunction
function! OrgFunc(func,...)
"not working, itnended to be general way to
" call script-local functions
View
18 ftplugin/vimorg-agenda-mappings.vim
@@ -14,7 +14,7 @@
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
" No warranty, express or implied.
" *** *** Use At-Your-Own-Risk *** ***
-
+ let mysid='<SNR>' . g:org_sid . '_'
nnoremap <silent> <buffer> <localleader>ag :call OrgAgendaDashboard()<cr>
nnoremap <silent> <buffer> <localleader>et :call OrgTagsEdit()<cr>
nnoremap <silent> <buffer> <localleader>ci :call OrgClockIn()<cr>
@@ -22,23 +22,25 @@
nnoremap <silent> <buffer> <localleader>d :call OrgDateDashboard()<cr>
nnoremap <silent> <buffer> <localleader>t :call OrgTodoDashboard()<cr>
nnoremap <silent> <buffer> <localleader>a :call DoRefile(['_archive'],[line('.')])<cr>
+ "nnoremap <silent> <buffer> <localleader><tab> :call {mysid}ToFromAgenda()<cr>
+ nnoremap <silent> <buffer> <localleader><tab> :call {mysid}ToFromAgenda()<cr>
"nnoremap <silent> <buffer> q :sign unplace * | quit<cr>
nnoremap <silent> <buffer> q :call OrgQuitAgenda()<cr>
- nmap <buffer> <silent> <s-CR> :call <SID>AgendaReplaceTodo()<CR>
+ nmap <buffer> <silent> <s-CR> :call {mysid}AgendaReplaceTodo()<CR>
nmap <silent> <buffer> <c-CR> :MyAgendaToBuf<CR>
nmap <silent> <buffer> <CR> :AgendaMoveToBuf<CR>
nmap <silent> <buffer> ,r :call OrgRunCustom({'redo_num': line('.'), 'type':'tags-todo', 'spec': g:org_search_spec})<CR>
nmap <silent> <buffer> >> :call OrgAgendaDateInc('++1d')<CR>
nmap <silent> <buffer> << :call OrgAgendaDateInc('--1d')<CR>
nmap <silent> <buffer> <localleader>t :call OrgTodoDashboard()<CR>
- nmap <silent> <buffer> <s-right> :silent call <SID>AgendaReplaceTodo()<CR>
+ nmap <silent> <buffer> <s-right> :silent call {mysid}AgendaReplaceTodo()<CR>
- nmap <silent> <buffer> <s-left> :silent call <SID>AgendaReplaceTodo('todo-bkwd')<CR>
- nmap <silent> <buffer> <space> :call <SID>ToggleHeadingMark(line('.'))<CR>
- nmap <silent> <buffer> <c-space> :call <SID>DeleteHeadingMarks()<CR>
+ nmap <silent> <buffer> <s-left> :silent call {mysid}AgendaReplaceTodo('todo-bkwd')<CR>
+ nmap <silent> <buffer> <space> :call {mysid}ToggleHeadingMark(line('.'))<CR>
+ nmap <silent> <buffer> <c-space> :call {mysid}DeleteHeadingMarks()<CR>
nmap <silent> <buffer> ,R :call OrgRefileDashboard()<CR>
- nmap <silent> <buffer> <tab> :call <SID>OrgAgendaTab()<CR>
+ nmap <silent> <buffer> <tab> :call {mysid}OrgAgendaTab()<CR>
"if a:search_type ==? 'agenda_todo'
" nmap <buffer> r :call OrgRunSearch(g:org_search_spec,'agenda_todo')<cr>
@@ -53,7 +55,7 @@
nmap <silent> <buffer> f :<C-U>call OrgAgendaMove('forward',v:count1)<cr>
nmap <silent> <buffer> b :<C-U>call OrgAgendaMove('backward',v:count1)<cr>
- nmap <buffer> <silent> <tab> :call <SID>OrgAgendaTab()<CR>
+ nmap <buffer> <silent> <tab> :call {mysid}OrgAgendaTab()<CR>
"nmap <silent> <buffer> <s-CR> :call OrgAgendaGetText(1)<CR>
nmap <silent> <buffer> r :call OrgRefreshCalendarAgenda()<CR>
View
4 ftplugin/vimorg-main-mappings.vim
@@ -19,6 +19,7 @@
" below block of 10 or 15 maps are ones collected
" from body of doc that weren't getting assigned for docs
" oepened after initial org filetype doc
+let mysid = '<SNR>' . g:org_sid . '_'
nnoremap <silent> <buffer> <tab> :call OrgCycle()<cr>
nnoremap <silent> <buffer> <s-tab> :call OrgGlobalCycle()<cr>
nnoremap <silent> <buffer> <localleader>ci :call OrgClockIn(line("."))<cr>
@@ -163,6 +164,7 @@ nnoremap <silent> <buffer> <localleader>lx :set conceallevel=0<cr>
"nnoremap <silent> <buffer> <localleader>,C :call OrgBodyTextOperation(1,line("$"),"collapse")<CR>
"nnoremap <silent> <buffer> <localleader>,c :call OrgSingleHeadingText("collapse")<CR>
nnoremap <silent> <buffer> zc :call OrgDoSingleFold(line("."))<CR>
+nnoremap <silent> <buffer> <localleader><tab> :call {mysid}ToFromAgenda()<cr>
function! OrgIndent()
if getline(line('.')) =~ b:v.headMatch
@@ -190,7 +192,7 @@ function! OrgNaviMap(keys)
endfunction
" below are alternate mappings for terminals, which
" don't support some of the above key combinations
-nnoremap <silent> <buffer> ,<tab> :call OrgGlobalCycle()<cr>
+"nnoremap <silent> <buffer> ,<tab> :call OrgGlobalCycle()<cr>
nnoremap <silent> <buffer> gk :call OrgNaviMap("gk")<CR>
nnoremap <silent> <buffer> gj :call OrgNaviMap("gj")<CR>
nnoremap <silent> <buffer> gh :call OrgNaviMap("gh")<CR>
Please sign in to comment.
Something went wrong with that request. Please try again.