LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   quiting the vi editor... (http://www.linuxquestions.org/questions/linux-newbie-8/quiting-the-vi-editor-630358/)

dina3e 03-24-2008 08:42 PM

quiting the vi editor...
 
hi i have suppose to open 7files in vi editor. but after editing the 3rd file i want that file is removedf from the list of 7 . so that there be only 6 file left for editing. if i will check by command in vi editor in command mode by
args
it only display the remaining..

Slokunshialgo 03-24-2008 10:05 PM

I have no idea how to edit multiple files as a time, but I usually just use :q! to quit, or ZZ to quit & save.

osor 03-24-2008 10:36 PM

What vi are you using? If you are using real vi (the one available here), the only way to do it is manually with the n command. I.e.,
Code:

:args
file1 file2 [file3] file4 file5 file6 file7
:n file1 file2 file4 file5 file6 file7
:args
[file1] file2 file4 file5 file6 file7

If you are using vim (available here), you can use the command argd or bd (depending on whether you are used to cycling with n or bn). In vim, using bn/bp with bd is more natural (since you can sometimes manipulate the argument list and be in a state editing a file not in the list).

For argd:
Code:

:args
file1 file2 [file3] file4 file5 file6 file7
:argd %
:args
file1 file2 [file4] file5 file6 file7

For bd:
Code:

:ls
  1      "file1"                        line 1
  2 #    "file2"                        line 1
  3 %a  "file3"                        line 1
  4      "file4"                        line 1
  5      "file5"                        line 1
  6      "file6"                        line 1
  7      "file7"                        line 1
:bd
:ls
  1      "file1"                        line 1
  2 %a  "file2"                        line 1
  4      "file4"                        line 1
  5      "file5"                        line 1
  6      "file6"                        line 1
  7      "file7"                        line 1


windhair 03-25-2008 02:51 PM

If you are using vi version 6+, you should try the new tabs feature, which provide the possibility to edit files in tab mode, you can move from tab to tab by the command "gt".
to open multi-file in tab mode, input
[HTML]vim(gvim) -p file1 file2 file3[/HTML]

dina3e 04-04-2008 08:31 PM

Quote:

Originally Posted by osor (Post 3099401)
What vi are you using? If you are using real vi (the one available here), the only way to do it is manually with the n command. I.e.,
Code:

:args
file1 file2 [file3] file4 file5 file6 file7
:n file1 file2 file4 file5 file6 file7
:args
[file1] file2 file4 file5 file6 file7

If you are using vim (available here), you can use the command argd or bd (depending on whether you are used to cycling with n or bn). In vim, using bn/bp with bd is more natural (since you can sometimes manipulate the argument list and be in a state editing a file not in the list).

For argd:
Code:

:args
file1 file2 [file3] file4 file5 file6 file7
:argd %
:args
file1 file2 [file4] file5 file6 file7

For bd:
Code:

:ls
  1      "file1"                        line 1
  2 #    "file2"                        line 1
  3 %a  "file3"                        line 1
  4      "file4"                        line 1
  5      "file5"                        line 1
  6      "file6"                        line 1
  7      "file7"                        line 1
:bd
:ls
  1      "file1"                        line 1
  2 %a  "file2"                        line 1
  4      "file4"                        line 1
  5      "file5"                        line 1
  6      "file6"                        line 1
  7      "file7"                        line 1


it's really great to share a knowledge in linux. i have come out the problem what i try to over come only by this..


All times are GMT -5. The time now is 01:33 AM.