Vi 1 more file to edit


















Of course, you cannot use :n and :prev then. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Learn more. How to avoid "Avoid E n more file s to edit? Asked 1 year, 8 months ago. Active 1 year, 8 months ago. Viewed 4k times. Any ideas for how to overcome both of these issues? One file: Two files: Side note: I alias vi to nvim. Improve this question.

Costa Michailidis. Costa Michailidis Costa Michailidis 3 3 silver badges 12 12 bronze badges. Well, if you remove that block, does it start working again? Also check output of :set ft? You could try to move that block above filetype plugin indent on in your vimrc to see if that helps.

But overall, switching buffers in your vimrc tends to create undesirable side effects such as the one you reported. It might also break vim -o or vim -p , etc. It's not like I have unsaved changes. I just didn't visit one of the buffers. How do I solve that? Editing Question. Add a comment. Most commands in vi can be prefaced by the number of times you want the action to occur. For example, 2j moves the cursor two lines down the cursor location. There are many other ways to move within a file in vi.

Remember that you must be in the command mode press Esc twice. To edit the file, you need to be in the insert mode. As mentioned above, most commands in vi can be prefaced by the number of times you want the action to occur. For example, 2x deletes two characters under the cursor location and 2dd deletes two lines the cursor is on.

You also have the capability to change characters, words, or lines in vi without deleting them. Replaces the character under the cursor. Overwrites multiple characters beginning with the character currently under the cursor.

You must use Esc to stop the overwriting. Replaces the current character with the character you type. Afterward, you are left in the insert mode. Deletes the line the cursor is on and replaces it with the new text. After the new text is entered, vi remains in the insert mode. Copies the current word from the character the lowercase w cursor is on, until the end of the word. This helps undo the last change that was done in the file.

Typing 'u' again will re-do the change. In case you open multiple files using vi, use :p to go to the previous file in the series. In case you open multiple files using vi, use :N to go to the previous file in the series.

The vi editor has two kinds of searches: string and character. When you start these commands, the command just typed will be shown on the last line of the screen, where you type the particular string to look for.

The n and N commands repeat the previous search command in the same or the opposite direction, respectively. Some characters have special meanings. This is put in an expression escaped with the backslash to find the ending or the beginning of a word. The character search searches within one line to find a character entered after the command.

The f and F commands search for a character on the current line only. The t and T commands search for a character on the current line only, but for t , the cursor moves to the position before the character, and T searches the line backwards to the position after the character.

You can change the look and feel of your vi screen using the following :set commands. When I hit enter, it returns me to edit mode in the file I was just in. The behavior I'd expect here would be that vi would move on to the next file to edit.

And yes, I know about tab completion, this question is based on curiosity and wanting to understand the shell better. Use :h arglist for more information. Then, you can edit all files one by one. Navigate using gt for going to the next tab and gT for going to the previous tab. For saving and quiting all the files in a single go, just write :wqa inside vim.

I was facing a similar problem. I wanted to edit a small change in all of them without getting to open them one by one. So, in the command line, I wrote this :. This way, find runs vim for each file.

As soon as I quit an instance of vim, find automatically runs another with the next file until all of them have been done.

Although, I agree that it would have been better if all the files could have been opened as tabs. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.



0コメント

  • 1000 / 1000