Reputation: 7201
I am new to VIM. It seems like, in order for copy and paste functionality to work between different files, one must open the files in the same VIM instance. Doing this, however, splits the terminal screen into 2. Opening a new file, splits it into 3, etc.
what happens if i have to open, say, 10+ files? how do developers who use VIM deal with this issue?
Upvotes: 2
Views: 711
Reputation: 901
If your only requirement is to copy paste between files. You can do this between different instances of vim if you set clipboard=unnamed
This causes vim to use the system clipboard instead of it's own internal buffer. so you can <C-c>
from firefox and then p
into vim, y
from one vim p
into another etc.
See http://vim.wikia.com/wiki/VimTip21
If you like having the files open in the same window I would use one of the other answers here and use either buffers (instead of splits) or tabs. I personally often have 10 or more buffers open in a single gvim window and 2 split windows that I use to view the buffer that I switch between using :bn
and :bp
.
Upvotes: 1
Reputation: 161614
Open all your txt
files in tabs:
$ vim -p *.txt
Use gtgT to switch between tabs.
Or you can put these key-mappings in your .vimrc
:
nmap <C-H> gT
nmap <C-L> gt
nmap <leader>t :tabnew<CR>
Upvotes: 3
Reputation: 536
You will find that VIM is a very flexible and customizable tool, so there are probably several approaches to this. Personally, I like to only have one buffer open at the time (I rarely need to split up) and use the Minibufexpl plugin to keep track of how many buffers are open and switch more efficiently between them.
Upvotes: 1
Reputation: 62528
Most users use splits only for simultaneous viewing of two files, when it is needed. You can open as many files as you want in different buffers, while only displaying one buffer on screen.
:e File1.txt
:e File2.txt and so on ...
and then switch through buffers with :bprevious
and :bnext
(and a variety of other commands). That is really the Vim's way of work.
There are many plugins for manipulating and navigating buffers.
One tab per file is really the wrong way to go ...
Upvotes: 3
Reputation: 13029
You can open files in the same vim instance and in the same window (without spliting it). That's what is called buffers. The view you see is current buffer, but the others buffers are still opened.
Here you have an introduction on how to work in vim with buffers.
Or type :help buffers
in vim.
You can use some plugin to work more user friendly with vim buffers. I recommend you bufexplorer or minibufexpl.
You can as well use tabs, but I have been always more confortable with buffers, but it's just my case.
Upvotes: 8