lens.vim icon indicating copy to clipboard operation
lens.vim copied to clipboard

Option to keep nearby buffers big as well

Open hakunin opened this issue 4 years ago • 3 comments

Hey, thanks for this awesome plugin. I use side by side files a lot so this I thought comes in handy.

I mainly have multiple files side-by-side so I can check the other files when writing into one file.

The way lens currently works seems to minify the nearby neeighbours once I switch from them which is the exact opposite of what I need.

Here is a screen of what I was hoping lens could do for me. Screenshot from 2020-03-02 10-39-26

You're likely busy so I'm posting this hoping it would find a few more people like me who want this.

Also I'm happy to buy you a coffee as this will likely increase my productivity.

Btw I am using it without animate (not sure if that affects things).

hakunin avatar Mar 02 '20 09:03 hakunin

check if this fixes your issue https://github.com/camspiers/lens.vim/pull/25#issuecomment-609892129

habamax avatar Apr 06 '20 16:04 habamax

Not clear what should happen with edge cases, like

  1. what if there are 2 windows?
  2. what if there are 2 horizontal windows?
  3. what if there are 3 vertical windows and and vim (gvim or terminal) size is not enough to hold 3 equal big windows? and you switched to most left? or to most right?
  4. what if there are 4 vertical windows and there is not enough space etc etc etc

habamax avatar Apr 09 '20 08:04 habamax

Is there a way I can experiment with this and get back to you? Which part of the code should I look at to customize the sizing function?

I think I'd start with this logic and see how it behaves.

current_open_width = get_ideal_width(current_window)
left_open_width =  get_ideal_width(left_window)
right_open_width =  get_ideal_width(right_window)

lens_width = current_open_width + left_open_width + right_open_width
min_remaining_width = min_width * other_window_count

while ((screen_width - lens_width - min_remaining_width) < 0) { 
  left_open_width -= 1
  right_open_width -= 1
  lens_width = current_open_width + left_open_width + right_open_width
}

hakunin avatar Apr 09 '20 08:04 hakunin