gregsexton / gitv

gitk for Vim.
936 stars 59 forks source link

Do not fold on first open #18

Closed sorin-ionescu closed 12 years ago

sorin-ionescu commented 13 years ago

Please prevent folding when first displaying gitv. After zo, on each subsequent pressing of RETURN, it no longer folds.

idbrii commented 13 years ago

Strange, gitv doesn't fold automatically for me at all.

I tried clearing my vimfiles (mv ~/.*vim* ~/bak) and then getting gitv and now it does fold and consistently: even if I expand a fold with zo. Maybe you have another plugin interfering with gitv? (Like I do.)

(I'm using gitv 1dfac94.)

gregsexton commented 13 years ago

gitv should always start with all folds open. Can you verify this isn't another plugin interfering by disabling any other plugins you use? Also this could be an autocmd you have setup that changes the 'foldlevel' option.

silouanwright commented 13 years ago

I can confirm that I also have this issue. I'm on Mac OS X Lion, using the vim plugins Janus (which incorporates Fugitive), and Vimwiki.

gregsexton commented 13 years ago

As previously mentioned, this is very likely to be another plugin interfering as my tests with vanilla Vim confirms that folding works. You could try running these commands and letting me know the output. It may help narrow things down.

:verbose set foldenable?
:verbose set foldlevel?
:verbose set foldlevelstart?
:verbose set foldmethod?
:verbose set foldnestmax?
silouanwright commented 12 years ago
1. foldenable
2. foldlevel=0
    Last set from ~/.vim/plugin/gitv.vim
3. foldlevelstart=-1
4. foldmethod=syntax
    Last set from ~/.vim/plugin/gitv.vim
5. foldnestmax=20
gregsexton commented 12 years ago

Ah! I see what's happening here. Sorry, I thought you meant the gitv window was starting completely folded. I didn't realise you meant the fugitive window.

Ok, looking at the code you have two choices for a fix.

  1. Delete line 126 of plugin/gitv.vim. The line should be silent setlocal foldlevel=0.
  2. Add an autocmd to your .vimrc.

Something like

augroup git
    au!
    autocmd FileType git :setlocal foldlevel=99
augroup END

should do it.

I'll try and add an option or something to the next version of gitv.

Let me know if you still have any problems.

Thanks,

Greg

windrg commented 8 years ago

The below works for me. :-D

augroup git
    au!
    autocmd FileType git :setlocal nofoldenable
augroup END