chrisbra / NrrwRgn

A Narrow Region Plugin for vim (like Emacs Narrow Region)
http://www.vim.org/scripts/script.php?script_id=3075
675 stars 25 forks source link

bugs in NR! and :NRV feature #16

Closed pinggit closed 11 years ago

pinggit commented 11 years ago

once I saw this plugin I realized immediately that this is going be another of my MUST have vim plugin. the :NR! and :NRV is really a great ideal! thanks for the great work.

I tested the current release of your plugin3075, it looks the NR! feature is not well implemented.

this is the help :NR!

:[range]NR[!] :[range]NarrowRegion[!] When [range] is omitted, select only the current line, else use the lines in the range given and open it in a new Scratch Window. If the current line is selected and is on a folded region, select the whole folded text. Whenever you are finished modifying that region simply write the buffer. If ! is given, open the narrowed buffer not in a split buffer but in the current window.

:NRV[!] Opened the narrowed window for the region that was last selected in visual mode If ! is given, open the narrowed buffer not in a split buffer but in the current window.

say I have following texts in a buffer:

1 I was born with a caul, which was advertised for sale, in 2 the newspapers, at the low price of fifteen guineas. Whether 3 sea-going people were short of money about that time, or 4 were short of faith and preferred cork jackets, I don't 5 know; all I know is, that there was but one solitary 6 bidding, and that was from an attorney connected with the 7 bill-broking business, who offered two pounds in cash, and 8 the balance in sherry, but declined to be guaranteed from

temp2.txt [utf-8] [text] [1/35,1] [2%] -- VISUAL --

now I visual select line 1 to 4 and :NR! , I end up with:

1 I was born with a caul, which was advertised for sale, in 2 the newspapers, at the low price of fifteen guineas. Whether 3 sea-going people were short of money about that time, or 4 were short of faith and preferred cork jackets, I don't

Narrow_Region_1 [utf-8] [text] [1/4,1] [25%] -- VISUAL --

Now the problem is ,

1) whenever I :w it , this new Narrow_Region_1 buffer will disappear and go back to the original buffer.

2) now if I gv, it only select the 6th line, instead of the previously selected line 1-4.

1 I was born with a caul, which was advertised for sale, in 2 the newspapers, at the low price of fifteen guineas. Whether 3 sea-going people were short of money about that time, or 4 5 were short of faith and preferred cork jackets, I don't 6 know; all I know is, that there was but one solitary <----gv will select this 7 bidding, and that was from an attorney connected with the 8 bill-broking business, who offered two pounds in cash, and 9 the balance in sherry, but declined to be guaranteed from

3) and this is also the same with :NRV , which give me a split window with only line 6.

4) :NRV! will report: E477: No ! allowed

and I confirmed this is the newest version v29: NrrwRgn.txt A Narrow Region Plugin (similar to Emacs)

Author: Christian Brabandt cb@256bit.org Version: 0.29 Mon, 20 Aug 2012 19:34:23 +0200

Vim is powerful especially when handling long/huge text , like log files , with folding plugins (like Voom) it becomes a good reader and text organizer, with a markup language like asciidoc, it becomes an ideal tool to write books ---- all it needs now is another tool like NrrwRgn & ZoomWin to make the writer be able to focus on the current snippet of texts , so one won't get lost in the ocean of long texts.

please advise, thanks!

regards ping

chrisbra commented 11 years ago

Try current head (c0a4bc8d6), that should fix all your issues

pinggit commented 11 years ago

On 12/17/2012 4:40 PM, chrisbra wrote:

Try current head (c0a4bc8 https://github.com/chrisbra/NrrwRgn/commit/c0a4bc8d6), that should fix all your issues

— Reply to this email directly or view it on GitHub https://github.com/chrisbra/NrrwRgn/issues/16#issuecomment-11462824.

hi Chris: thanks , that's good news. I'm eager to test it out. sorry I'm just a new user of github, can you let me know the procedure of how to download/install your new fix?

thanks.

regards ping

pinggit commented 11 years ago

On 12/17/2012 7:44 PM, ping wrote:

On 12/17/2012 4:40 PM, chrisbra wrote:

Try current head (c0a4bc8 https://github.com/chrisbra/NrrwRgn/commit/c0a4bc8d6), that should fix all your issues

— Reply to this email directly or view it on GitHub https://github.com/chrisbra/NrrwRgn/issues/16#issuecomment-11462824.

hi Chris: thanks , that's good news. I'm eager to test it out. sorry I'm just a new user of github, can you let me know the procedure of how to download/install your new fix?

thanks.

regards ping I downloaded (git clone https://github.com/chrisbra/NrrwRgn.git ) and tested, nothing changed... not sure I missed anything still?

chrisbra commented 11 years ago

On Tue, December 18, 2012 03:50, pinggit wrote:

On 12/17/2012 7:44 PM, ping wrote:

On 12/17/2012 4:40 PM, chrisbra wrote:

Try current head (c0a4bc8 https://github.com/chrisbra/NrrwRgn/commit/c0a4bc8d6), that should fix all your issues

— Reply to this email directly or view it on GitHub https://github.com/chrisbra/NrrwRgn/issues/16#issuecomment-11462824.

hi Chris: thanks , that's good news. I'm eager to test it out. sorry I'm just a new user of github, can you let me know the procedure of how to download/install your new fix?

thanks.

regards ping I downloaded (git clone https://github.com/chrisbra/NrrwRgn.git ) and tested, nothing changed... not sure I missed anything still?

You need to install it first. If you are on linux, simply typing make in the downloaded directory should do all you need.

On Windows, copy the files in the autoload, plugin, and doc directories in the appropriate places of your vimfiles directory (or wherever you have installed NarrowRegion).

regards, Christian

pinggit commented 11 years ago

On 12/18/2012 1:23 AM, chrisbra wrote:

You need to install it first. If you are on linux, simply typing make in the downloaded directory should do all you need.

it doesn't make any difference at all for me. do the NR! and NVR work for you?

chrisbra commented 11 years ago

On Tue, December 18, 2012 14:09, pinggit wrote:

On 12/18/2012 1:23 AM, chrisbra wrote:

You need to install it first. If you are on linux, simply typing make in the downloaded directory should do all you need.

it doesn't make any difference at all for me. do the NR! and NVR work for you?

Yes of course. Please tell me, what are you doing? Try to remove old installations first, and copy the files into the correct directory.

regards, Christian

pinggit commented 11 years ago

On 12/18/2012 08:23 AM, chrisbra wrote:

On Tue, December 18, 2012 14:09, pinggit wrote:

On 12/18/2012 1:23 AM, chrisbra wrote:

You need to install it first. If you are on linux, simply typing make in the downloaded directory should do all you need.

it doesn't make any difference at all for me. do the NR! and NVR work for you?

Yes of course. Please tell me, what are you doing? Try to remove old installations first, and copy the files into the correct directory.

regards, Christian

— Reply to this email directly or view it on GitHub https://github.com/chrisbra/NrrwRgn/issues/16#issuecomment-11485746.

Yes I have all 3 files in the right place:

ping@640g-laptop:~/.vim$ ls -l autoload/ | grep -i nrr -rw-rw-r-- 1 ping ping 34577 Dec 18 08:04 nrrwrgn.vim ping@640g-laptop:~/.vim$ ls -l plugin/ | grep -i nrr -rw-rw-r-- 1 ping ping 2273 Dec 18 08:04 NrrwRgn.vim ping@640g-laptop:~/.vim$ ping@640g-laptop:~/.vim$ ls -l doc/ | grep -i rr -rw-rw-r-- 1 ping ping 23608 Dec 18 08:04 NarrowRegion.txt -rw-rw-r-- 1 ping ping 10376 Mar 5 2010 surround.txt

if you look at the file size, aren't they the newest release?

pinggit commented 11 years ago

On 12/18/2012 08:23 AM, chrisbra wrote:

On Tue, December 18, 2012 14:09, pinggit wrote:

On 12/18/2012 1:23 AM, chrisbra wrote:

You need to install it first. If you are on linux, simply typing make in the downloaded directory should do all you need.

it doesn't make any difference at all for me. do the NR! and NVR work for you?

Yes of course. Please tell me, what are you doing? Try to remove old installations first, and copy the files into the correct directory.

regards, Christian

— Reply to this email directly or view it on GitHub.

attached demonstrated what happened in here: I installed it from git start vim :NR! on 4 lines change it(insert one line after 3rd line) :w (this quit the Nrrw window, which is wrong?) gv (this select the 6th line, wrong? expected to select 4 lines) :NRV (same as above)

chrisbra commented 11 years ago

Hi pinggit!

On Di, 18 Dez 2012, pinggit wrote:

On 12/18/2012 08:23 AM, chrisbra wrote:

On Tue, December 18, 2012 14:09, pinggit wrote:

On 12/18/2012 1:23 AM, chrisbra wrote:

You need to install it first. If you are on linux, simply typing make in the downloaded directory should do all you need.

it doesn't make any difference at all for me. do the NR! and NVR work for you?

Yes of course. Please tell me, what are you doing? Try to remove old installations first, and copy the files into the correct directory. attached demonstrated what happened in here: I installed it from git start vim :NR! on 4 lines change it(insert one line after 3rd line) :w (this quit the Nrrw window, which is wrong?) gv (this select the 6th line, wrong? expected to select 4 lines) :NRV (same as above)

As I said, this works as expected. Please try with a new user without any plugins. I can't say, why it shouldn't work for you.

:NRV! is valid now (does it throw an error to you?) when using :NR! :w won't quit the buffer anymore.

I still don't know, how it gets wrong for you.

regards,

Christian

Hallo Regenschirmhalter!

pinggit commented 11 years ago

On 12/18/2012 03:04 PM, chrisbra wrote:

As I said, this works as expected. Please try with a new user without any plugins. I can't say, why it shouldn't work for you.

:NRV! is valid now (does it throw an error to you?) when using :NR! :w won't quit the buffer anymore.

I still don't know, how it gets wrong for you.

I installed a fresh new OS, installed a fresh new vim, a fresh git and a fresh new NrrwRgn plugin. I still get exactly the same (wrong) behavior.

ping@ping-ubuntu-lab:~$ git clone https://github.com/chrisbra/NrrwRgn.git Cloning into 'NrrwRgn'... remote: Counting objects: 861, done. remote: Compressing objects: 100% (266/266), done. remote: Total 861 (delta 397), reused 834 (delta 370) Receiving objects: 100% (861/861), 141.84 KiB, done. Resolving deltas: 100% (397/397), done. ping@ping-ubuntu-lab:~$ ping@ping-ubuntu-lab:~$ ping@ping-ubuntu-lab:~$ cd NrrwRgn/ ping@ping-ubuntu-lab:~/NrrwRgn$ mak make makeglossaries makeindex make-ssl-cert mako-render ping@ping-ubuntu-lab:~/NrrwRgn$ mak make makeglossaries makeindex make-ssl-cert mako-render ping@ping-ubuntu-lab:~/NrrwRgn$ make vim -N -c':RmVimball' -c':q!' NrrwRgn-0.29.vmb rm -f NrrwRgn-0.29.vmb vim -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "plugin/NrrwRgn.vim", "autoload/nrrwrgn.vim", "doc/NarrowRegion.txt"])' -c '$d' -c ":%MkVimball NrrwRgn-0.29 ." -c':q!' ln -f NrrwRgn-0.29.vmb NrrwRgn.vmb vim -N -c':so %' -c':q!' NrrwRgn-0.29.vmb ping@ping-ubuntu-lab:~/NrrwRgn$ ping@ping-ubuntu-lab:~/NrrwRgn$

can you attach your plugin files (just 3 files right?) in email to me? I guess I'm not getting the correct files.

thanks!

chrisbra commented 11 years ago

Hi pinggit!

On Di, 18 Dez 2012, pinggit wrote:

On 12/18/2012 03:04 PM, chrisbra wrote:

As I said, this works as expected. Please try with a new user without any plugins. I can't say, why it shouldn't work for you.

:NRV! is valid now (does it throw an error to you?) when using :NR! :w won't quit the buffer anymore.

Please answer these questions.

I still don't know, how it gets wrong for you.

I installed a fresh new OS, installed a fresh new vim, a fresh git and a fresh new NrrwRgn plugin. I still get exactly the same (wrong) behavior.

ping@ping-ubuntu-lab:~$ git clone https://github.com/chrisbra/NrrwRgn.git Cloning into 'NrrwRgn'... remote: Counting objects: 861, done. remote: Compressing objects: 100% (266/266), done. remote: Total 861 (delta 397), reused 834 (delta 370) Receiving objects: 100% (861/861), 141.84 KiB, done. Resolving deltas: 100% (397/397), done. ping@ping-ubuntu-lab:~$ ping@ping-ubuntu-lab:~$ ping@ping-ubuntu-lab:~$ cd NrrwRgn/ ping@ping-ubuntu-lab:~/NrrwRgn$ mak make makeglossaries makeindex make-ssl-cert mako-render ping@ping-ubuntu-lab:~/NrrwRgn$ mak make makeglossaries makeindex make-ssl-cert mako-render ping@ping-ubuntu-lab:~/NrrwRgn$ make vim -N -c':RmVimball' -c':q!' NrrwRgn-0.29.vmb rm -f NrrwRgn-0.29.vmb vim -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "plugin/NrrwRgn.vim", "autoload/nrrwrgn.vim", "doc/NarrowRegion.txt"])' -c '$d' -c ":%MkVimball NrrwRgn-0.29 ." -c':q!' ln -f NrrwRgn-0.29.vmb NrrwRgn.vmb vim -N -c':so %' -c':q!' NrrwRgn-0.29.vmb ping@ping-ubuntu-lab:~/NrrwRgn$ ping@ping-ubuntu-lab:~/NrrwRgn$

can you attach your plugin files (just 3 files right?) in email to me? I guess I'm not getting the correct files.

thanks!

I'll attach a working vimball for me.

Liebe Gr??e

Christian

H?ren Sie nicht auf das, was die Kritiker sagen. F?r einen Kritiker ist noch nie ein Denkmal errichtet worden. -- Jean Sibelius " Vimball Archiver by Charles E. Campbell, Jr., Ph.D. UseVimball finish plugin/NrrwRgn.vim [[[1 68 " NrrwRgn.vim - Narrow Region plugin for Vim " ------------------------------------------------------------- " Version: 0.29 " Maintainer: Christian Brabandt cb@256bit.org " Last Change: Mon, 20 Aug 2012 19:34:23 +0200 " " Script: http://www.vim.org/scripts/script.php?script_id=3075 " Copyright: (c) 2009, 2010 by Christian Brabandt " The VIM LICENSE applies to histwin.vim " (see |copyright|) except use "NrrwRgn.vim" " instead of "Vim". " No warranty, express or implied. " * * Use At-Your-Own-Risk! * * " GetLatestVimScripts: 3075 29 :AutoInstall: NrrwRgn.vim " " Init: {{{1 let s:cpo= &cpo if exists("g:loaded_nrrw_rgn") || &cp finish endif set cpo&vim let g:loaded_nrrw_rgn = 1

" Debug Setting let s:debug=0 if s:debug exe "call nrrwrgn#Debug(1)" endif

" ---------------------------------------------------------------------------- " Public Interface: {{{1

" Define the Command aliases "{{{2 com! -range -bang NRPrepare :,NRP com! -range NarrowRegion :,NR com! -bang NRMulti :NRM com! -bang NarrowWindow :NW com! -bang NRLast :NRL

" Define the actual Commands "{{{2 com! -range -bang NR :, call nrrwrgn#NrrwRgn() com! -range NRP :exe ":" . . ',' . . 'call nrrwrgn#Prepare()' com! -bang -range NRV :call nrrwrgn#VisualNrrwRgn(visualmode(), ) com! NUD :call nrrwrgn#UnifiedDiff() com! -bang NW :exe ":" . line('w0') . ',' . line('w$') . "call nrrwrgn#NrrwRgn()" com! -bang NRM :call nrrwrgn#NrrwRgnDoPrepare() com! -bang NRL :call nrrwrgn#LastNrrwRgn()

" Define the Mapping: "{{{2 if !hasmapto('NrrwrgnDo') xmap nr NrrwrgnDo endif if !hasmapto('NrrwrgnBangDo') xmap Nr NrrwrgnBangDo endif if !hasmapto('VisualNrrwRgn') xnoremap Githubissues.

  • Githubissues is a development platform for aggregating issues.