Giter Club home page Giter Club logo

Comments (15)

niloct avatar niloct commented on May 27, 2024 1

Glad to have been part of this brainstorming. It is working for me too, without the set hidden option!

from linediff.vim.

xaizek avatar xaizek commented on May 27, 2024

I don't have such problem, but remember someone telling me that he can't use linediff with several buffers, same issue as here (on GNU/Linux, but with Vundle probably).

It must be another plugin or setting in your vimrc that causes this. One might be able to work around this in the plugin, but finding the cause without having your configuration will be really hard, so you might want to try disabling plugins/settings until linediff starts working properly.

from linediff.vim.

niloct avatar niloct commented on May 27, 2024
set nocompatible "Required by Vundle
filetype off "Required by Vundle
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'AndrewRadev/linediff.vim'

" All of your Plugins must be added before the following line
call vundle#end()            " required

filetype plugin indent on    " required

I issued a complete reinstall of Vundle plugins leaving only linediff in the above .vimrc. It still won't work.

from linediff.vim.

niloct avatar niloct commented on May 27, 2024

Different blocks in same buffer do work without any issues or maintenance needed.

from linediff.vim.

xaizek avatar xaizek commented on May 27, 2024

Tried your configuration, everything works fine with single/multiple buffers. I ran Vim as vim -u tmp-vimrc, so if you don't have any system-wide settings, setup should be the same.

from linediff.vim.

niloct avatar niloct commented on May 27, 2024

Have you tried on a Mac ? I'm using iTerm2, installed original iTerm to test, see attached gif please.
linediff

from linediff.vim.

xaizek avatar xaizek commented on May 27, 2024

I'm on GNU/Linux, terminal shouldn't matter (OS too, if we run the same configuration). Actually, I managed to reproduce it this time, your gif helped. Before I used :tabedit or :vs and it worked, if I do :edit for the second file, it doesn't work (with this configuration, the one I usually use works fine either way). So far I have no idea, why it works this way, but it's not just your local problem.

from linediff.vim.

xaizek avatar xaizek commented on May 27, 2024

@niloct, it's not something you have in your vimrc, it's something you don't have there. Try adding:

set hidden

Looks like getbufline() function doesn't return lines from buffers which aren't hidden. And this is probably not a bug, because if buffer disappears from all windows and 'hidden' isn't set, that buffer gets unloaded.

from linediff.vim.

niloct avatar niloct commented on May 27, 2024

Thanks for the great tip. It worked. So I misunderstood the help when it says that a buffer displayed in another window (other than current) does not get hidden. It gets unloaded then, without the option set hidden.

from linediff.vim.

xaizek avatar xaizek commented on May 27, 2024

a buffer displayed in another window (other than current) does not get hidden.

That's correct statement. In the gif above you have only one window, each window displays only one buffer, so when you do :e y.txt x.txt gets unloaded and y.txt is loaded. If x.txt were still visible in another tab or split window, then it would still be considered as loaded.

from linediff.vim.

niloct avatar niloct commented on May 27, 2024

Awesome! Thanks again :)

from linediff.vim.

AndrewRadev avatar AndrewRadev commented on May 27, 2024

Thanks, @xaizek, for debugging the issue, I really appreciate your help :).

It does make sense that, if set hidden is not on, the buffer would be lost. I'll try and see if there's a way to set "bufhidden" on a buffer that has been linediffed, and then restore it to its default, but it might be a bit tricky to juggle the value. For now, I think I'll put a comment in the documentation, at least.

from linediff.vim.

AndrewRadev avatar AndrewRadev commented on May 27, 2024

I think I may have fixed it, actually. Turns out it's not so complicated to save and restore the value :). However, the first buffer remains hidden (it was closed, after all), and if that first buffer's content has been changed, you can't quit -- Vim asks you to save all of your changes. But I think that might be fine, after all, you've closed this buffer, and are now making changes to it, I guess it's to be expected that Vim prompts you to finish up.

@niloct, if you'd like to test the behaviour of the plugin without the set hidden option, I'd appreciate it, just so I know if what I did avoids this issue now.

from linediff.vim.

xaizek avatar xaizek commented on May 27, 2024

Thanks, @xaizek, for debugging the issue, I really appreciate your help :).

It was bothering me for a while that I didn't figure this one out back then.
@boo1ean look, after some 4 years I know what didn't work in your setup :-)

just so I know if what I did avoids this issue now.

Seems to work for me in test configuration.

from linediff.vim.

AndrewRadev avatar AndrewRadev commented on May 27, 2024

Cool, thanks. I'll remove the comment in the documentation then.

from linediff.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.