Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim-fugitive fails unless taskwiki_disable not empty #455

Open
jfishe opened this issue Nov 25, 2024 · 0 comments
Open

vim-fugitive fails unless taskwiki_disable not empty #455

jfishe opened this issue Nov 25, 2024 · 0 comments

Comments

@jfishe
Copy link

jfishe commented Nov 25, 2024

https://github.com/tpope/vim-fugitive/ fails and creates a fugitive:/ folder, in the project root, of a git repo, when taskwiki auto loads tasks. Gdiffsplit and G cause taskwiki to update vimwiki format and markdown format, when managed by vimwiki.

The simple manual work around is let taskwiki_disable=1, before a fugitive:* buffer is loaded. Below is an attempt to automate this.

This may help with #377.

Is this something we should include in taskwiki?

~/.vim/plugin/vimwiki.vim:

" Disable Taskwiki when Diff and Fugitive buffers exist. {{{
function! s:disable_taskwiki() abort
  let l:disable_status = [
        \ get(g:, 'taskwiki_disable', ''),
        \ get(g:, 'undo_taskwiki_disable', '')
        \ ]
  if empty(list2str(l:disable_status))
    let g:undo_taskwiki_disable = 'empty'
    let g:taskwiki_disable = 1
  elseif l:disable_status[1] == 'empty'
    let g:taskwiki_disable = 1
  elseif ! empty(l:disable_status[0])
    let g:undo_taskwiki_disable = g:taskwiki_disable
  endif
endfunction

function! s:restore_disable_taskwiki() abort
  let l:disable_status = [
        \ get(g:, 'taskwiki_disable', ''),
        \ get(g:, 'undo_taskwiki_disable', '')
        \ ]
  if empty(list2str(l:disable_status))
    return
  elseif l:disable_status[1] == 'empty'
    unlet g:taskwiki_disable
    unlet g:undo_taskwiki_disable
  elseif ! empty(l:disable_status[1])
    let g:taskwiki_disable = g:undo_taskwiki_disable
    unlet g:undo_taskwiki_disable
  endif
endfunction

augroup myTaskwiki
  autocmd!
  autocmd BufEnter,BufWinEnter,BufNew * if buffer_name() =~ 'fugitive:' | call s:disable_taskwiki() | endif
  autocmd BufUnload,BufHidden * if buffer_name() =~ 'fugitive:' | call s:restore_disable_taskwiki() | endif
augroup END " }}}
jfishe added a commit to jfishe/vimfiles that referenced this issue Nov 25, 2024
tools-life/taskwiki#455

https://github.com/tpope/vim-fugitive/ fails and creates a fugitive:/
folder, in the project root, of a git repo, when taskwiki auto loads
tasks. Gdiffsplit and G cause taskwiki to update vimwiki format and
markdown format, when managed by vimwiki.

Deleting fugitive:/ and disabling taskwiki restores vim-fugitive
functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant