views:

94

answers:

3

According to http://www.lagmonster.org/docs/vi2.html the command :p would make vi go to the previous file. Unfortunately, this isn't working for me. However :n works and goes to the next page. What should I use to go to the previous file? For :p I get the message,

Hit Return to continue

and it stays in the same page. Thanks.

Edit: I am sshing to an AIX box and using the vi in Ksh if that helps. Edit 2: Looks like rewinding to first is possible with :rew but listing all the files with :ar results in the same message,

Hit Return to continue

May be this isn't possible at all from all the vi tutorials I've read so far including, http://www.bo.infn.it/alice/alice-doc/mll-doc/linux/vi-ex/node27.html

A: 

According to Vim's help, :N (uppercase!) should be legal vi to go back a file:

:[count]n[ext] [++opt] [+cmd]           *:n* *:ne* *:next* *E165* *E163*
            Edit [count] next file.  This fails when changes have
            been made and Vim does not want to |abandon| the
            current buffer.  Also see |++opt| and |+cmd|.  {Vi: no
            count or ++opt}.


:[count]N[ext] [count] [++opt] [+cmd]           *:Next* *:N* *E164*
            Edit [count] previous file in argument list.  This
            fails when changes have been made and Vim does not
            want to |abandon| the current buffer.
            Also see |++opt| and |+cmd|.  {Vi: no count or ++opt}.
Mark Rushakoff
That doesn't work too. Maybe because I am using vi and not vim.
learner135
@learner: What version of vi are you using? Is it possibly a non-compliant or otherwise non-standard version?
Mark Rushakoff
@Mark Rushakoff: I don't know. Is there a command to find that? I am using the default vi present in AIX 5.3 which is not very old I guess. Edit: (AIX 5.3 was released 2004, acc to wikipedia: http://en.wikipedia.org/wiki/IBM_AIX)
learner135
A: 

Tried :bn, :bp ?

Flavius Stef
Yep I did!No gain. It was suggested by another user who later decided to delete it for some reason. I get "Not an editor command" message for that.
learner135
A: 

According to the vi manual page from AIX 5.2, this isn't possible:

Editing a List of Files: Enter the following subcommands in command mode. If you
need information about the format of vi subcommands, see ″vi General Subcommand
Syntax.″
:n             Edits the next file in the list entered on the command line. If
               you are using this subcommand from the ex editor, a : (colon) is
               not needed.
:n Files       Specifies a new list of files to edit. If you are using this
               subcommand from the ex editor, a : (colon) is not needed.

Check the vi manual (man vi) on your system, maybe it's been updated in AIX 5.3.

pra