Friday, February 25, 2011

bp and CTRL-^

all--

the help for CTRL-^ says it is the same as e #, but it is
clearly different when the alternate buffer is a Scratch
buffer -- if you try to use e # (or bp) you get the error

E499: Empty file name for '%' or '#'...

while CTRL-^ takes you obediently back to your Scratch buffer

so i was trying to use

command! BD normal ^^ | bd #

to delete my current buffer, return to the scratch, and
preserve my split window layout, but the normal made the whole
thing normal, didn't stop at the |

then i tried

command! BD normal ^^ \| bd #

and the CTRL-^ part worked, but the bd # didn't trigger --
help for normal simply states you can't use | after normal
because it gets interpreted as part of the command

help for normal shows an example using exe for a windows
command, so i tried

command! BD exe "normal <c-^><c-^>" | bd #

and the only thing that happened was i deleted the scratch
buffer -- so i put the delete inside the quotes as

command! BD exe "normal <c-^><c-^> | bd #"

and nothing happened

is there a way to do this or should i just type them as two
commands every time?

with 4 gig of ram i probably should just hit CTRL-^ and leave
the visited buffer there, but this is niggling at me

sc

ps. i will probably ignore any plugin recommendations

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment