0

When I run fc -l -20 in my zsh, I get the expected output.

However when running the same from within vim like so:

:r! fc -l -20 I get error saying: zsh:fc:1: no such event: 0

Why is that, and how to get my previous 20 history list entries into vim?

1 Answer 1

3

fc is a shell builtin and as such would have to be called from within your shell. Alternatives are fc -l -20 | vim - or maybe <c-Z> fc -l -20 | pbcopy % "*p.

Sign up to request clarification or add additional context in comments.

2 Comments

To clarify for the op, when you call fc from within vim like this vim is spawning a new shell and your invocation of fc is trying to recall the previous 20 commands of this new shell, but there are "no such event(s)"
But why then, when I spawn new zsh shell instance from say current shell, I still have access to history entries in the parent shell (as they are shared between spawned shells in my zsh setup)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.