Reading the documentation about alternate file, I thought I could manipulate # like a global variable, but it's not the case. I was thinking doing something like

let &#='/path/to/alternate/file'

Which is not possible.

How would you set manually the alternate file?


The alternate file is stored in a register, "#. Change you line to:

let @#='/path/to/alternate/file'

For more help see:

:h registers
:h quote#
:h :let-@

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.