Questions tagged [multiple-files]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
59 views

Change what Vim does by default when no files are given

When running vim with no command line arguments, it opens a splash screen describing Vim. I would like to control what vim does "by default", so I can make it do something more useful like ...
Greg Nisbet's user avatar
  • 1,839
2 votes
1 answer
127 views

E93: More than one match when <C-d> shows only one match

When jumping between buffers in Vim, most the time things work quite smoothly. I like to jump to buffers by writing :b something1*something2, checking if the match is unique by invoking C-d, and if so ...
user22476690's user avatar
2 votes
1 answer
309 views

How to come out to the previous file in vi after entering a file with 'gf'? [duplicate]

When using vi for a file A, if I want to go to a file B when the cursor is on file B's filename, I press gf and vi opens file B. After navigating inside file B, if I want to come out to file A, what ...
Chan Kim's user avatar
  • 123
0 votes
0 answers
80 views

How to "keep" Lexplore/Rexplore/Explore position?

When navigating large projects, in IDEs like intellij, I keep opening and closing the navigation/file tree tab and moving around files. On vim I tried to create a similar functionality, adding to my ~/...
gcb's user avatar
  • 101
0 votes
2 answers
108 views

How to open files from terminal in desired pattern (tabs, vertical and horizontal splits on desired files)

So, I wrote next bash script: #!/bin/bash if [ "$#" -gt 1 ]; then path=$1 else path=$(cat subject.txt | tr -d '\n') fi nvim -p 1 "setup/$path/body.tex" -p 1 preamble/...
Vladyslav Rehan's user avatar
1 vote
2 answers
136 views

Disable E173: X more files to edit warning in neovim

How can I make :q and other standard ways of exiting quit immediately even if E173 would ordinarily have stopped me in my tracks? Because this doesn't seem possible in regular VIM, how can I do it in ...
minseong's user avatar
  • 2,291
2 votes
0 answers
180 views

CTRL-^ work in Vim but not in Neovim

I'm reading Neovim's usr_07.txt. When I start Neovim like neovim t1.txt t2.txt t3.txt, and then issue :next, the shortcut CTRL+^ is supposed to bring me to the previous file (i.e., the alternate file)....
robertspierre's user avatar
3 votes
2 answers
446 views

The way to excute same command in command-line mode multiple times

I'm recently working on a project in vim, and I need to execute the same command in command-line mode multiple times to different files which are in the same folder. like :%s/V1/V2/g Is there a ...
Daybreak Texas's user avatar
1 vote
1 answer
836 views

Vimscript - Loading function(s) from another .vim file

I'm forking an old vim plugin (effectively dead since 2018) that needed some love. Once I got to the .vim file, I noticed that the functions were all defined in there, which made the file unreasonably ...
gabca's user avatar
  • 11
1 vote
1 answer
28 views

Give error if more than one file opened

I usually don't use Vim's multiple-files features. If I open Vim on multiple files, it is usually user error. For example, a common mistake of mine is that I end up entering the following: vim vim ...
scottkosty's user avatar
3 votes
0 answers
143 views

Showing different directories in multiple netrw instances

I was hoping that I could have splits or tabs in which I would use different netrw instances to see different folders or to use separate hide lists. Unfortunately any change in split/tab A affects ...
user1068352's user avatar
1 vote
3 answers
1k views

Netrw-R Renaming multiple Files with vim

After going through the renaming guides from the doc folder in vim I found a way to replace text with the input :%s/frompattern/topattern/g. Reaching the renaming files with the file browser tutorial/...
ThunderDream's user avatar
1 vote
3 answers
305 views

Can I open a file using the index shown by ":scriptnames"?

I am wondering how to open a file or load it into a buffer using the index shown by :scriptnames? 23: /usr/share/vim/vim80/plugin/tarPlugin.vim 24: /usr/share/vim/vim80/plugin/tohtml.vim 25: /usr/...
l00p's user avatar
  • 253
1 vote
4 answers
608 views

Vim: how to make :q shut up about unvisited files?

When Vim is invoked on multiple files from the command line, then if any of those files have not been visited with :next or via buffer switching, the :q command pointlessly warns about the situation ...
Kaz's user avatar
  • 481
-1 votes
1 answer
105 views

vimrc, like exec but replaces current process (fork?)

Such as in the following code: let cpath = getcwd() let cfile = expand('%') function Run_file_hopper(cpath, cfile) silent exec "! . ~/path/somescript.sh" a:cpath a:cfile ...
john-jones's user avatar
0 votes
3 answers
1k views

search and replace in whole directory recursively

I have many entities in my java project like this: public class MyCar { // The brand of the car private String brand; // The time owner bought it private Date obtainTime; // The price in dollar ...
yz zheng's user avatar
1 vote
1 answer
62 views

Printing the name of all files inside the buffer inside a file

Let's say I have 10 files opened in buffer with vim *. One way of saving the name of all those files inside a new file would be using the command: :argdo !echo % >> filenames.txt This command ...
raylight's user avatar
  • 525
1 vote
1 answer
248 views

Is there any way of editing multiple files in a buffer at once?

Let's say I have 10 files inside a folder and I open them all with vim *. All those files will be opened in the buffer. Many times when I want to edit all of them at once, I create a small macro that ...
raylight's user avatar
  • 525
1 vote
1 answer
212 views

How can I keep open buffers whose contents match a pattern and delete the rest?

Let's say I have three files opened in my buffer list: file1,file2 and file3. I know that if I use the command :vimgrep /pattern/ ## I'll populate the quickfix list with the files that have the ...
raylight's user avatar
  • 525
1 vote
2 answers
101 views

How open two files but one came from stdout

all these works git show bf5500a8 | vim -R - vim file1 file2 -O git show bf5500a8 > tmpfile ; vim tmpfile file2 -O ; rm tmpfile but I'd like to know if I can open stdout and other file ...
Sérgio's user avatar
  • 153
0 votes
0 answers
53 views

Tool for convert multi files vimrc into single file

i try to collect my .vimrc files into single file is there anyway to generate single file using vimscript depending on source vimscript keyword or python code example of my .vimrc if isdirectory($HOME....
Sajjad Jawad's user avatar
0 votes
1 answer
77 views

Can you open two files from command line and go to end?

On Windows I'm trying to start editing two files and check or edit the end of both files. I didn't manage to jump to the end of both files. It only works for the first file: gvim -O "+norm Go&...
vimmer's user avatar
  • 1
1 vote
1 answer
742 views

How do I delete matching lines in multiple files at once?

I want to delete lines containing a search term from multiple files. I used bufdo or argdo for similar tasks such performing a replacement with s over multiple files. However, bufdo g/SearchString/d | ...
l4mpi's user avatar
  • 845
5 votes
2 answers
2k views

"3 files to edit" after quit from editing multiple files in Vim

I open vim with three files: vim a.txt b.txt c.txt. Then: edit a.txt, save it by :w, switch to b.txt by :n. edit b.txt, save it by :w, switch to c.txt by :n. edit c.txt, save it by :w, and quit vim ...
Bicheng's user avatar
  • 247
1 vote
3 answers
1k views

File Tabs and Tree in vim

I read this topic on how to open multiple files and edit. But there was a demo I saw where the user had multiple files open and showing as tabs in vim. How can I get that too ? Also, there was a tree ...
anjanesh's user avatar
  • 111
5 votes
2 answers
767 views

Open multiple files in custom split layout

I want to open three files file1.txt file2.txt file3.txt in vertical and horizontal split combination, like this: +-------------------------------+ | | | | file1.txt | ...
Przemysław Czechowski's user avatar
0 votes
2 answers
80 views

Vim misses a few files when opening multiple files

I use vim -o a* to open 25 files (filenames starting with 'a') together and search & replace (:windo %s/old/new/gcI) some common word in these files. Later I found that not all of them have been ...
xiaohuamao's user avatar
8 votes
2 answers
11k views

How to avoid "Avoid E173 (n more file(s) to edit)?"

So, when I open multiple files, but don't visit the all of them (or the last one), and I try to :quit neovim yells at me that I have to edit those files. No I don't! Stop giving me this error : ) It ...
Costa Michailidis's user avatar
0 votes
2 answers
84 views

Open some files in split and some other in tab at the vim invocation

I have four files file1, file2, file3, & file4. So I want to open them with vim directly from command line and get the following structure: Tabulation 1: file1 taking whole tab Tabulation 2: ...
fauve's user avatar
  • 111
0 votes
1 answer
31 views

How can I modify OpenMultipleTabs so that I can open buffers for new files?

When searching for a command to enable me to open multiple tabs in normal mode, I found a custom command to do this: " Open multiple tabs at once fun! OpenMultipleTabs(pattern_list) for p in a:...
bitmask's user avatar
  • 143
1 vote
1 answer
46 views

Search and Replace - How do you change a specific string across syntactically similar files?

I'm attempting to write a Vim macro that will allow me to replace a single variable of a single service across multiple Icinga configuration files. Services are syntactically very similar so I ...
Dan's user avatar
  • 13
2 votes
0 answers
235 views

"Edit with existing Vim" - how does it work?

I have Vim 8.1.1 on Windows 7. I can click on the file with right mouse button, and there will be an option "Edit with Vim". Then, if I click another file, there will be two options: "Edit with Vim" ...
john c. j.'s user avatar
1 vote
0 answers
749 views

How to do operations like copy, rename, delete on multiple files in NERDTree vim?

Is there any way to do this for multiple files in NERDTree? Something similar along the lines of vifm. From the m menu I see that it is only possible for one file at a time.
amitoz's user avatar
  • 123
3 votes
1 answer
168 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 ...
user3342981's user avatar
4 votes
1 answer
10k 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 ...
user1717828's user avatar
2 votes
3 answers
1k 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 ...
Rafael Muynarsk's user avatar
3 votes
1 answer
3k 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 ...
Jingyu Gong's user avatar
7 votes
1 answer
3k 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] ...
August Janse's user avatar
21 votes
1 answer
4k 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 ...
user1717828's user avatar
1 vote
0 answers
46 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 ...
acppcoder's user avatar
2 votes
1 answer
62 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 ...
N3buchadnezzar's user avatar
1 vote
0 answers
153 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 ...
woodstok's user avatar
  • 195
1 vote
1 answer
58 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 ...
dman's user avatar
  • 143
0 votes
1 answer
74 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 ...
hgiesel's user avatar
  • 1,934
0 votes
2 answers
468 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 ...
Greg Nisbet's user avatar
  • 1,839
5 votes
3 answers
610 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 ...
user2297550's user avatar
4 votes
2 answers
742 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 ...
mike23's user avatar
  • 290
3 votes
4 answers
10k 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 ...
mike23's user avatar
  • 290
3 votes
2 answers
117 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/...
mike23's user avatar
  • 290
1 vote
1 answer
1k 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>, ...
b00t's user avatar
  • 119