Questions tagged [multiple-files]
Questions about the use of vim for handling several files at the same time.
97 questions
1 vote
3 answers
350 views
Writing a visually-selected couple of files out to a file with an open buffer
This is vim 9.1 on arm64 macOS 15.5. Let's say I open file1.txt with: vim file1.txt but some of the lines I want to write into another file. If I open that file in a buffer with: :split file2.txt or:...
3 votes
1 answer
449 views
Is it possible to make gf know variables?
I'm writing some PowerShell scripts on Windows and they contain references to other script like this: & "$PSScriptRoot\install_scoop.ps1" $PSScriptRoot equals the same directory as the ...
7 votes
4 answers
2k views
Why does `p` not put all yanked lines after quitting and reopening Vim?
I have the following workflow: Open Vim Use Visual mode linewise (V), select some lines, and yank them (y) I get a message "151 lines yanked" or something like this Quit Vim Start another ...
1 vote
2 answers
67 views
Cannot go back to previous window of an opened one using bf, especially when having 2 or more windows open at the same time
I opened 3 files by: vim compile.f rtl.f tb.f -O I navigate to a window of interest, which is rtl.f, press gf to open file below cursor and bf to go back rtl.f window. After pressing gf, the window ...
0 votes
2 answers
132 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 ...
2 votes
1 answer
183 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 ...
2 votes
1 answer
1k 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 ...
0 votes
0 answers
175 views
How to "keep" Lexplore/Rexplore/Explore "memory" when toggling it?
Is there a way to keep Explore state? for example, If I open vim at ~/project, open :Lexplore, and navigate in the explore window to ~/project/a/b/c/1.txt. next time I open :Lex i would want to see ...
0 votes
2 answers
311 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/...
1 vote
2 answers
314 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 ...
2 votes
0 answers
300 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)....
3 votes
2 answers
518 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 ...
1 vote
1 answer
2k 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 ...
1 vote
1 answer
52 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 ...
3 votes
0 answers
220 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 ...