Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Open a narrowed region buffer in the same window #8

Closed
gregsexton opened this Issue June 16, 2012 · 10 comments

2 participants

Greg Sexton chrisbra
Greg Sexton

Hi,

This is a feature request really.

Do you have any plans to support opening the narrowed region buffer in the same window as the original buffer? On a :wq you could update the region and restore the original buffer. Maybe this could be controlled with a global var or with a separate command?

I ask because it makes more sense to me to narrow a region so that you can no longer see the surrounding area. Opening a split window doesn't achieve this for me. It is my understanding that this is how the Emacs feature works.

Thanks,

Greg

chrisbra
Owner
Greg Sexton

I would really love this feature! It would be awesome to be able to narrow to a section and look at only this, distraction free.

Having thought about this further, rather than a global var it would be cool to add another command so that users can have both options without having to awkwardly change a variable.

On a side note, how mature do you consider the plugin? Your version numbers suggest to me that you still consider this beta. Is that the case? I'm just wondering how likely this is going to eat my data.

Thanks for the plugin. It's great.

Greg

chrisbra
Owner

I consider NrrwRgn to be very mature. I am using it for years and can't remember having lost any data.

Let me see, what I can do for you, regarding your wish.

chrisbra
Owner
Greg Sexton

Hi Christian,

Thank you so much for looking into this. I'll try it out immediately and let you know if I encounter any problems. I've quickly scanned the diff and made a comment on your last commit. I'll let you know if I find anything else.

Thanks once again!

Greg

chrisbra
Owner

I fixed the missing let, so could you please test again? Thanks!

Greg Sexton

Hi Christian,

I've not had as much time as I would have liked to try out your
changes this week but I have run into some issues unfortunately.

I haven't had a chance to dig in to the cause of these problems
but am happy to assist if you have any questions.

I don't think I've had any issues at all when I have just one
window open. I tend to use splits quite a lot and whenever I've
had multiple buffers open in splits I've run into problems. Here
are two representative error messages that I've been receiving.

Error detected while processing function <SNR>156_WriteNrrwRgn..nrrwrgn#WidenRegion:             line   51:
E716: Key not present in Dictionary: 1
E116: Invalid arguments for function has_key(s:nrrw_rgn_lines[instn], 'multi')
E15: Invalid expression: has_key(s:nrrw_rgn_lines[instn], 'multi')


Error detected while processing function <SNR>147_WriteNrrwRgn..<SNR>147_StoreLastNrrwRgn:
line    7:
E716: Key not present in Dictionary: 1
E116: Invalid arguments for function has_key(s:nrrw_rgn_lines[a:instn], 'multi')
E15: Invalid expression: has_key(s:nrrw_rgn_lines[a:instn], 'multi')
Error detected while processing function <SNR>147_WriteNrrwRgn..<SNR>147_NrrwRgnAuCmd:
line   21:
E716: Key not present in Dictionary: 1
E116: Invalid arguments for function has_key(s:nrrw_rgn_lines[a:instn], 'disable') &&^I!s:nrrw_rgn_lines[a:instn].disable ) ||   !has_key(s:nrrw_rgn_lines[a:instn], 'disable')
E15: Invalid expression: (has_key(s:nrrw_rgn_lines[a:instn], 'disable') &&^I!s:nrrw_rgn_lines[a:instn].disable ) ||   !has_key(s:nrrw_rgn_lines[a:instn], 'disable')

On a few occasions I've also had Vim crash out on me with the following error:

Vim: Caught deadly signal BUS

This has always happened when writing the narrowed buffer.
Unfortunately, I haven't spotted any pattern here.

A couple of more minor issues:

I noticed that when you have the same buffer open in two or more
splits. If you narrow a portion of one of the windows the syntax
highlighting that is applied to the original buffer isn't removed
when you close the narrowed buffer.

Lastly, :wq has caught me out a few times. intuitively I expect
it to write and close the narrowed buffer and restore the original
buffer, but if this is the last window it closes out Vim.

Sorry to come back with problems! Thanks for your efforts.

  • Greg
chrisbra chrisbra closed this in 453c880 July 26, 2012
chrisbra chrisbra reopened this July 26, 2012
chrisbra
Owner

Sorry, for not coming back earlier and I don't have much time yet, so only very shortly:

I think I fixed both issues, that caused an error for you.

I can't reproduce the persisting highlighting issue.

The BUS error looks like a bug in Vim or possibly a hardware error on your side?

The :wq issue is inherent to Vim. Use :bw or :bd to delete a buffer without quitting Vim. I don't see a way around that.

chrisbra
Owner

If you can reproduce the highlighting issue, please do so and I'll fix it as well

chrisbra
Owner

Thanks for your nice and valueable feedback

chrisbra chrisbra closed this August 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.