Questions tagged [multiple-files]

Questions about the use of vim for handling several files at the same time.

Filter by
Sorted by
Tagged with
3
votes
1answer
53 views

How to open multiple files with cursor for all files being at the last line?

My experiments generate several log files, which I sometimes monitor manually. Some of the log files have an error message in the last line. I want to open all log files with the cursor located at ...
1
vote
1answer
1k views

How to do :Sex but with a vertical split?

When viewing a file /tmp/vim_split_demo/test.txt, the parent directory can be opened in a horizontal split screen using the command :Sex, as shown in these screenshots: What command gives same ...
1
vote
3answers
65 views

Is it possible to edit the name of files by opening their root folder on Vim?

Let's say I have a folder located on ~/question with 4 files: $ ls _file1 _file2 _file3 _file4 I've realized that it's possible to open folders with Vim and it'll list the file names of all the ...
2
votes
1answer
48 views

Close one file during manipulate multiple files with vim

I make use of the builtins in spf13. Today when I open multiple files with vim and want to close one of them with q it closes all these files, how can I close only a few of them without closing them ...
1
vote
1answer
67 views

How to get the names of all open buffers?

I can use % to get the name of the focused window for commands. How can I get a space-separated list of all buffers for use in a command? For example, I would like to call :!cat [all] where [all] ...
17
votes
1answer
1k views

Go to last file in vim

Many text files can be opened at once using vim *txt I know I can use :<int>n to move forward <int> files, but I don't know how to get to the last opened file. So far I've tried :1000n ...
1
vote
0answers
40 views

Is there a simple way to navigate a generated file that includes # line preprocessor directives?

I'm working on a code generator tool. I'm planing to use # LINE "filename" directives like the ones generated by the C preprocessor to show the relationship between the generated code and the original ...
1
vote
1answer
38 views

Cycle between filenames

I have some files with names as below long-ordinary-filename-del-1.tex long-ordinary-filename-del-2.tex long-ordinary-filename-del-3.tex Is it possible to define a command to cycle between these ...
1
vote
0answers
32 views

How to pin a file to a window(/viewport)

When I have multiple files open in multiple splits, when I open a new file via quickfix ( or Ctrl-P ), it sometimes ends up placing the new file in a window that I don't want to be changed. Is there ...
1
vote
1answer
24 views

Possible to save session state with 3 seperate files loaded in one session?

Alot of times I will have a vim session with three split windows with three different files. But something might come up where I need to switch projects, close the vim session, and come back to it ...
0
votes
1answer
58 views

Display the first line of some file instead of an identifier

Is there some way to display an identifier as something else? Imagine the following setup: You have a readme file: * <<123456>> * <<789078>> This readme file is inside of a ...
0
votes
2answers
165 views

open multiple oldfiles

using :browse old<cr> it's possible to view a list of the 100 most recently visited files. However, when selecting a file to visit, it's only possible to provide a single number and not a ...
1
vote
3answers
142 views

edit many files in one buffer

I have enjoyed coding not too large projects in one single file. This way I can press * on an identifier and find it without having to hop across buffers. But naturally this doesn't scale and at some ...
4
votes
2answers
120 views

From one split, how can I get the filename of the file in another split?

I have two files open, each one is in a split. From file one, how can I get the filename of the file in split two ? In command mode, I can get the reference of the filename I'm currently editing by ...
2
votes
4answers
246 views

How can I overwrite a whole file with the content of another?

I have two tabs open, file1.txt and file2.txt, each with different content. How can I copy the whole content of file1.txt and overwrite file2.txt with it, resulting in both files having the same ...
3
votes
2answers
92 views

How can I easily open two similar files?

I'm trying to setup a simple environment which would allow me to work on a local file and it's remote counterpart. Both files are accessible on my filesystem. So let's say I have : File 1 : /home/...
-1
votes
1answer
498 views

How can I pass extra flags to FZF/ripgrep commands with the leader key?

Current functionality When I use <C-P> and <C-Å> I can respectively search file names and contents. Everything works great. Target functionality When prepending either with <leader&...
0
votes
1answer
138 views

Use the arglist without opening the files

When I use the args command it opens the files: :args `find . -name \*.html` I would like to do an operation on the arglist without opening the files at all in a buffer, or either opening them one ...
3
votes
1answer
56 views

Is it possible to open multiple files at the end or at the first occurrence of a string?

To open multiple files at a time I use this command (here using the vi tab feature): vim -p file1 file2 ... fileN If I want to open a file at the end or at the first occurrence of a text: vim + ...
2
votes
2answers
875 views

How to create multiple files?

While working on something like laravel, I end up creating the same view files index.blade.php, create.blade.php, show.blade.php within different folders like views/articles, views/comments, etc using ...
3
votes
3answers
4k views

Open multiple files in tabs from Explore mode

While navigating file system in :Explore mode, is it possible to select and open multiple files, each in a new tab? Edit: I ended up using a function proposed by Jair López, because it works pretty ...
1
vote
0answers
332 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
0answers
254 views

Open multiple files using ex command :edit and a wildcard [duplicate]

Is it possible to load multiple files at the same using :edit? I tried: :e ~/dev/myproject/*.c and it did not work. (Note this is different than "How to open multiple files matching a wildcard ...
1
vote
1answer
407 views

Open multiple files in split mode from within Vim (not command-line)

From within an existing Vim session, I am looking for a technique to achieve the equivalent of -o file1 file2 file3. The :sp[lit] command just seems to create a single new split--it doesn't allow for ...
1
vote
0answers
2k views

How do I use wildmenu effectively?

I'd like to learn about using vim with multiple files without using external plugins. I read another answer that recommends putting the following in our .vimrc: set wildmenu set wildmode=longest:...
6
votes
3answers
1k views

How can I open the next/previous file alphabetically?

Say I have a bunch of files, ordered alphabetically: 1.txt, 2.txt, 3.txt, etc. (In a typical situation, I have hundreds of these, ordered by date.) If I open file 2, is there a quick way for me to ...
0
votes
2answers
495 views

Multi file search for selected text

Using atom I can CtrlShiftf while a word is selected in order to start a multi file search for a matching string. I would like to emulate this flow as much as possible with Vim. I know I can yank ...
5
votes
1answer
590 views

Spread already open files into split view

Suppose I open multiple files in vim like this: vim a.cc b.cc x.cc vim will open all files, but show only one at a time, the rest being accessible using the :next command. After having these files ...
2
votes
2answers
296 views

Open markdown filename under cursor like gf, and jump to the section?

I have the file /path/a.md which has many sections as follows: # abc this this the content of section abc # def this this the content of section abc ## defg this this the content of subsection defg ...
1
vote
3answers
158 views

“Next” behavior and “E165: Cannot go beyond last file”

I frequently use vim to edit multiple files. On the command line, I'll type vim * or the like, and use :wn to move through the files until I get to the end. Invariably, I get to the last file, and ...
8
votes
3answers
195 views

How to pass current file name with a different path to the command line

Is there any way to make the special symbol % work with path names on the command line? For instance, I'd like to do: :diffsplit Path\to\other\directory\% So that I can do a @: to quickly compare ...
5
votes
1answer
344 views

How to set manually the alternate file

Reading the documentation about alternate file, I thought I could manipulate # like a global variable, but it's not the case. I was thinking doing something like let &#='/path/to/alternate/file' ...
4
votes
3answers
2k views

How to open a file from active buffer into a split window?

I have some files in my vim buffer. :ls shows the list of active buffer, I want to open a file from buffer into a vertically/horizontally split window. I know :vsp or :sp open split window in vim ...
7
votes
1answer
3k views

How to quit one file and simultaneously open another file in vim?

I am currently editing one file and, after finishing its edit, I want to close the current file and at the same time (i.e., without closing Vim) open another file for editing. How it can be achieved?...
1
vote
1answer
126 views

navigating multiple files - arguments and buffers

I've been learning vi (as an autodidact) for some weeks. Actually I'm not yet sure about if I'm using vi or vim (does the command vi open vim if vim is installed?). Now I'm trying to edite multiple ...
1
vote
1answer
229 views

How to edit the next file when VI doesn't have buffer support?

If I open multiple files in vi, and then when issuing the :bnext or :bprev or :buffer command I'm presented with Feature not implemented, how do I edit one of the other files that I have open?
0
votes
1answer
207 views

Why argdo applies changes only to the last file?

Given the following files with two trailing spaces at the end: $ echo "test1 " > test1.txt; echo "test2 " > test2.txt; echo "test3 " > test3.txt $ hexdump -C *.txt 00000000 74 65 73 74 ...
3
votes
1answer
251 views

Using Vim gD on project with multiple folders

I am using Vim to edit Fortran 90 code. The code is structured in the following manner: ./srcs - contains main code file ./libs - contains some module file If I open the main file in Vim and then ...
0
votes
1answer
124 views

How to open multiple files except some files

Suppose we have several files f11.txt f21.txt f31.txt f01.txt f02.txt f03.txt Is there any vim option such that I can open all files except for f0*.txt? Something like gvim -O * --exclude=*0*? (-O ...
2
votes
1answer
146 views

Why does ':bufdo set fo=*' change window contents?

I have two files open, say File.h and File.m in separate tabs. ----------------------------------- | File.h | File.m | ----------------------------------- :ls reveals :ls 1 %a "...
16
votes
1answer
712 views

How do I reorder open tabs?

Let's say I have four open files: file0.txt, file1.txt, file2.txt, and file3.txt. I open all of them in that order as tabs. So my tab ordering is this: file0.txt file1.txt file2.txt file3.txt Then ...
2
votes
1answer
38 views

Open multiple files in new tabs as read only

I would like to open new tabs for each file matching an expression, each file in a new tab and as read only. I do not want to replace my current buffer, just append the new tabs. This comes very ...
5
votes
2answers
968 views

Gvim how to open several files in different buffers from MS Windows explorer

On MS Windows using gVim, is it possible to select several files from the explorer and open them in the same instance of gVim in different buffers? At the moment if I select 3 different files on ...
2
votes
1answer
852 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 ...
0
votes
1answer
59 views

Moving a visual range to a new tabpage?

I would like to make a new tab page from part of the current text. I would use visual selection, or other means to specify a text range. Is there a single command like "New tab from selection"? ...
43
votes
2answers
12k 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 ...
3
votes
2answers
417 views

How to search for a matching pattern only in the first line across multiple files?

How do I search in multiple files for 1st line of file matching a pattern? e.g. I want to search for files starting with ++ ++ Heading 1 and not + Heading 1 ++ Heading 2 Any pointers appreciated....
6
votes
1answer
2k views

Why vim cannot expand wildcards from the external command?

The following command works as expected within vim: :args `find . -type f` as well as this one (with wildcard): :args `find . -name \*.inc` However when I run the following: :args `find . -type f ...
1
vote
1answer
2k views

How to split window directly from command line? [duplicate]

I'm using Ubuntu system. I have files: A.txt, B.txt, C.txt I can split window in the following way: vim A.txt :vs B.txt // after entering into vim :vs C.txt Is there any way to achieve the same ...
17
votes
4answers
5k views

How to show search results for all open buffers

One thing I often do (but rely on the command line to do) is searching/grepping in multiple files. Is there a way to display search results for all the open buffers? Ideally, I'd like to have a new ...