Is there a way to do a vertical split where you can read something
like you read a book?
Let's say you cannot edit in the right window but that it shows what
comes after the left window.
It would be useful for reading source code in wide-screen monitors.
Regards.
Try ":vsplit" followed by adjusting the views (e.g. PgDn in one of the
windows), and then ":setlocal scrollbind" in both windows. Then both
windows will scroll together; if they come out of sync, adjust them (in
gvim) by means of the non-current window's scrollbar.
Best regards,
Tony.
--
Join in the new game that's sweeping the country. It's called
"Bureaucracy". Everybody stands in a circle. The first person to do
anything loses.
Thanks a lot for your answer. I am really sorry for replying this late
because you tried to help me promptly.
I tried this and I got exactly the same thing in both windows after
:setlocal scrollbind, which is what is supposed to happen anyway.
Anyway, I think I can do with vsplit...
What I really wanted to have was the illusion that I had a big
vertical monitor and not a wide screen when scrolling windows.
Thus if each number form the following list were pages say in a C program:
1
2
3
4
4
5
6
I really wish I could get this in my wide-screen monitor:
23
And if I scrolled a little (in only one of the windows) I could eventually get
34 or 56
I don't know if this is possible. It would really be useful for
today's laptop with wide-screens when programming.
Thanks again.
I'd really like someone to look at the tip and report:
1. Is it the same as was posted here?
2. Does it work?
3. Is it worth keeping on the wiki?
John
":set [no]scrollbind" should be ":setlocal" -- you don't want new [No
Name] buffers to open in 'scrollbind' mode (to be scrolled "together"
after you fill them with more than one screen of data).
Best regards,
Tony.
--
So when I saw the post to comp.editors, I rushed over to the FTP site to
grab it. So I yank apart the tarball, light x candles, where x= the
vim version multiplied by the md5sum of the source divided by the MAC of
my NIC (8A3FA78155A8A1D346C3C4A), put on black robes, dim the lights,
wave a dead chicken over the hard drive, and summon the power of GNU GCC
with the magic words "make config ; make!".
[Jason Spence, compiling Vim 5.0]
By "keymap" you mean a mapping, don't you? The term "keymap" has a
technical meaning in Vim, as a script containing the ":loadkeymap"
command followed (in a specific format) by several (often many)
language-mappings. See the scripts in $VIMRUNTIME/keymap/ for examples.
These scripts are activated by setting the 'keymap' option (again,
preferably by a ":setlocal" command).
The mapping you show (and where I know my mailer probably misquoted the
spaces next to <> signs) includes two instances of the ":setl[ocal]"
command, none of the ":set" command. I won't criticize its contents
(favourably or unfavourably), I'm leaving that to better specialists of
Vim's scrolling commands.
Best regards,
Tony.
--
God made machine language; all the rest is the work of man.
Woah, thanks a lot! Works like a charm.
Well, let's set out the workflow (from top to bottom, and looks best in
a fixed-width font):
|
+------<----+----->-----+
| |
| (split off)
| (window 2 )
| |
| +-------->--------+
| | |
| | (split off)
| | (window 3 )
| | |
(make sure window 1 ) (make sure window 2 ) (make sure window 3 )
(is scrolled the way) (is scrolled the way) (is scrolled the way)
( you want it ) ( you want it ) ( you want it )
| | |
(setlocal scb in) (setlocal scb in) (setlocal scb in)
( window 1 ) ( window 2 ) ( window 3 )
| | |
+------>----+-----<-----+--------<--------+
|
The vertical lines show the "leeway" in executing each task or set of
tasks. There may be additional constraints if you define "the way you
want it" by comparison with another window whose scroll position you
have to set first (if only by deciding that "that"'s your reference) --
and remember that you can never scroll higher than the top or lower than
the bottom.
You may want to do it first by hand, either writing down your keystrokes
or "recording" them in a register by means of the q Normal-mode command,
then putting that into the {rhs} of your mapping (by means of CTRL-R if
you used q).
See
:help q
:help i_CTRL-R
:help c_CTRL-R
in addition to the help for the commands you used.
Best regards,
Tony.
--
Statisticians do it with 95% confidence.
Local and global-local options can be set by means of three closely
related commands:
- ":setlocal" sets only the local value (for the current buffer or
window, depending on the option);
- ":setglobal" sets only the global default (which will usually be used
when creating a new buffer or window);
- ":set" sets both.
Modelines set only the local value (as with ":setlocal")
In the ":let" command before the = sign, &l:option, &g:option or &option
set the local value, the global value, or both (in an expression,
&option "reads" the local value).
For global settings, which have only one value, all three commands are
equivalent (and modelines set the global value in that case, but it is
"unusual in the extreme" to set a global setting with a modeline).
Best regards,
Tony.
--
Females are strictly forbidden to appear unshaven in public.
[real standing law in New Mexico, United States of America]
On Fri, 20 Feb 2009, Tom Link wrote:
> But this doesn't work (for me) when being executed from a function
> or if you source those lines from a file. So you'd have to enter the
> commands on the command line which isn't really practical. I also
> noticed minor "line shifts" so 2<pagedown> doesn't always get you to
> the next book page -- but maybe there is an option I forgot/don't
> know about controlling the behaviour of pagedown.
How about this "hackish" solution
function! Reader(nr)
if a:nr==0
return ''
else
:ka
:1
setl noscrollbind scrolloff=0
let a=''
let i=a:nr
let a .= repeat(':bo vsp\<CR>', i)
let a .= repeat(':normal Ljzt\<CR>',i)
let a .= ':setl scb\<CR>'
while i>1
let a .= ':wincmd h\<CR>'
let a .= repeat(':normal Ljzt\<CR>',i-1)
let a .= ':setl scb\<CR>'
let i-=1
endwhile
let a .= ':wincmd h\<CR>'
let a .= ':setl scb\<CR>'
let a .= ':normal `a\<CR>'
return a
endif
endfu
and then call this function via
:exe ':call feedkeys("' . Read(2) . '","t")'
If you want to open 2 new scrollbinded windows. Adjust the number to
the number of windows you like to open.
Mit freundlichen Grüßen
Christian
--
Wer viel Freude hat, muß ein guter Mensch sein: aber vielleicht ist
er nicht der Klügste, obwohl er gerade das erreicht, was der Klügste
mit all seiner Klugheit erstrebt.
-- Friedrich Wilhelm Nietzsche
On Fri, 20 Feb 2009, Christian Brabandt wrote:
> :exe ':call feedkeys("' . Read(2) . '","t")'
execuse me, I meant:
:exe ':call feedkeys("' . Reader(2) . '","t")'
regards,
Christian
--
hundred-and-one symptoms of being an internet addict:
122. You ask if the Netaholics Anonymous t-shirt you ordered can be
sent to you via e-mail.
Thanks for explaining, I'll use that as a starting point for future
changes to the macro.
- melisizwe
http://mysite.verizon.net/astronaut/vim/index.html#MPAGE
that supports multiple windows with sequential text.
:MPage 3
will, for example, set up three windows with sequential text for the
current buffer. It works
with AsNeeded, too (so you don't have to have the plugin always loaded,
just loaded on demand).
Regards,
Chip Campbell