Quantcast

How to move forward 'x' characters, crossing newlines

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to move forward 'x' characters, crossing newlines

Roy Fulbright
I'm tracking down an error message that says the error is at character 2310 in my input JSON file, and I need to know how to move the cursor forward 2310 positions including newlines. I'm sure it's something simple, but I cannot find anything in help.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to move forward 'x' characters, crossing newlines

Tim Chase
On 07/06/12 15:51, Roy Fulbright wrote:
> I'm tracking down an error message that says the error is at
> character 2310 in my input JSON file, and I need to know how to
> move the cursor forward 2310 positions including newlines. I'm
> sure it's something simple, but I cannot find anything in help.

For this particular use-case, I think you want the "go" command:

  :help go

so you'd type

  2310go

It's a little trickier to move forward/backward by a given number of
bytes from an arbitrary starting location, but as long as you just
want to get to the Nth byte in the file, "go" should do the job.

-tim



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to move forward 'x' characters, crossing newlines

Christian Brabandt
In reply to this post by Roy Fulbright
Hi Roy!

On Fr, 06 Jul 2012, Roy Fulbright wrote:

> I'm tracking down an error message that says the error is at character 2310 in my input JSON file, and I need to know how to move the cursor forward 2310 positions including newlines. I'm sure it's something simple, but I cannot find anything in help.    

If your 'whichwrap' setting contains '<,>' it shold be possible to
simply use Right with the count, e.g. 2310<Right> (or as ex command:
exe "norm! 2310\<Right>"
)

(provided your cursor is at line 1, column 1


regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to move forward 'x' characters, crossing newlines

Christian Brabandt
In reply to this post by Tim Chase
Hi Tim!

On Fr, 06 Jul 2012, Tim Chase wrote:

> On 07/06/12 15:51, Roy Fulbright wrote:
> > I'm tracking down an error message that says the error is at
> > character 2310 in my input JSON file, and I need to know how to
> > move the cursor forward 2310 positions including newlines. I'm
> > sure it's something simple, but I cannot find anything in help.
>
> For this particular use-case, I think you want the "go" command:
>
>   :help go
>
> so you'd type
>
>   2310go

But that moves by bytes, not by characters.

regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: How to move forward 'x' characters, crossing newlines

Roy Fulbright
> On Fr, 06 Jul 2012, Tim Chase wrote:

>
> > On 07/06/12 15:51, Roy Fulbright wrote:
> > > I'm tracking down an error message that says the error is at
> > > character 2310 in my input JSON file, and I need to know how to
> > > move the cursor forward 2310 positions including newlines. I'm
> > > sure it's something simple, but I cannot find anything in help.
> >
> > For this particular use-case, I think you want the "go" command:
> >
> > :help go
> >
> > so you'd type
> >
> > 2310go

Thank you very much! That was exactly what I was looking for.
 
P.S. I also added < and > to whichwrap and was able to do: 2310<Right>

 

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to move forward 'x' characters, crossing newlines

Tim Chase
On 07/06/12 16:24, Roy Fulbright wrote:
>>>   2310go
> Thank you very much! That was exactly what I was looking for

As Christian correctly calls me on it, that does operate by bytes
and not by characters.  For all of the work I do, I limit myself to
the lower 7-bit ASCII and insert my upper characters with escape
codes (which are also 7-bit), so it's never an issue.  In case you
have multi-byte characters in your data, YMMV.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to move forward 'x' characters, crossing newlines

rockybalboa4
In reply to this post by Roy Fulbright
Dnia 6 lipca 2012 22:51 Roy Fulbright <[hidden email]> napisał(a):


> I'm tracking down an error message that says the error is at character 2310
> in my input JSON file, and I need to know how to move the cursor forward 2310
> positions including newlines. I'm sure it's something simple, but I cannot find anything
> in help.
 
2310go
gg02309<SPACE>
with default whichwrap (b,s)
 

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Loading...