Questions tagged [file-operations]

Questions about moving, deleting, or opening files; or about the difference between a buffer and its file. For topics such as saving files, use the buffers tag instead.

Filter by
Sorted by
Tagged with
134
votes
5answers
68k views

How do I reload the current file?

Quite often I am working with files that are version controlled, so it is possible for changes to be made to them outside of Vim. What is a quick way to reload the file without having to close and ...
40
votes
2answers
11k views

Open filename under cursor like gf, but in a new tab (or split)?

The normal mode command gf go to a file with the path the cursor currently is at. But it does so in the current window, replacing the current text. That means you need to navigate back explicitly ...
36
votes
4answers
31k views

How can I rename the file I'm editing?

Is it possible to rename the file I'm editing from within Vim? Currently what I do is exit Vim, rename the file and open from Vim again.
7
votes
1answer
649 views

Browse oldfiles list length

I use :browse oldfiles command to open recent files quickly. The list becomes very long with time -- I have 100 items in the list and need to tap space to complete this action. I want to reduce this ...
6
votes
3answers
5k views

How do I break a file into two?

I am writing some documentation (a user guide), in markdown in Vim. I now realise what I though should be one page, really should be 2. But I've already written alot of of both halves How can I ...
6
votes
2answers
1k views

Vim is displaying some info and “Press ENTER …” when I open a file

From time to time I see something like in the status bar when I open a file: "Gemfile" 112L, 2941C "Gemfile" 112 lines --62%-- Press ENTER or type command to continue Where is it coming from? How to ...
5
votes
2answers
374 views

How can I copy the current file and start editing the copy instead of the current file?

Say I'm editing file foo. I want to copy/write what I have in the buffer to bar and change the buffer to be editing bar instead of foo. I can achieve this with: :w bar :e bar But that has a few ...
2
votes
1answer
95 views

How to copy the current line(s) out to a new file?

I'm reading through a very large web service log, and I want to pull a single line out from the file, and write it to a new file. The log lines consist of web service request XML, so they are long ...
2
votes
1answer
819 views

Save current file and open another for editing

Is there a way to effectively combine :w and :e commands so that the current file is saved and a new one is opened for editing in one go? And to do so in a way that allows tab completion of path and ...
2
votes
0answers
37 views

Why does renaming with :saveas not open the new named file in the current buffer? [closed]

When editing a file named oldFile, with the command :saveas newFileName I expected vim to save the current buffer under the new named file (i.e. newFileName) and set the filename of the current buffer ...
1
vote
0answers
293 views

Opening recent files issue

TLDR: How can I open a file from the list of recent files without going to the end of the list to get to the prompt for file number? In order to open recent files, I do :bro ol and then when I see ...
0
votes
2answers
96 views

When editing a ruby file with includes/requires how can I open the file containing the method I am on?

I have a bunch of includes at the top of my file. Then I use methods from the helpers throughout my file. How can I have it so that when my cursor is on a method name my editor can (by some ...