When I write in a bash commamd line

vim -u /root/.vimrc -c "set textwidth=0"

this works as expected.

When using same in FCEDIT= it does not work:

FCEDIT='vim -u /root/.vimrc -c "set textwidth=0"'

The phrase "settextwidth=0" is taken as a filename.

Inclosing /root/.vimrc in any kind of quotes is no help.

I would not like to write a second version of .vimrc for this special case.

Do you have a solution?


Anton Wessel

1 Answer 1


Here I can suggest two workarounds.

They are solutions to this task:

In FCEDIT to use vim with an option different from the settings in .vimrc.

E.g. I have in .vimrc set textwidth=66. But when I write code for one-liners I need no limit on linelentgth, i.e. textwidth=0.

The first solution is simple in regard to the code, but it needs to steps.

To write the new option into a file:

echo "set textwidth=0">/tmp/WEx_vimrc

And to setup FCEDIT:

export FCEDIT='vim -u /root/.vimrc -S /tmp/WEx_vimrc'

The second solution has the advantage that all what has to be done is to type "fc":

alias fc="echo \"set textwidth=0\">/tmp/WEx_vimrc; export FCEDIT='vim -u /root/.vimrc -S /tmp/WEx_vimrc'; fc"


Anton Wessel

== addendum 21.12.2022

It is desirable to have both version of fc available:

  1. the normal version fc which is determined when FCEDIT is setup,

  2. this special FC with a different vim option.

This can be achieved when both are setup in a script.

For this now I add following IMPORTANT REMARK:

The order is important:

first must be setup

alias fc="echo \"set textwidth=0\">/tmp/WEx_vimrc; export FCEDIT='vim -u ~/.vimrc -S /tmp/WEx_vimrc'; fc"

and afterwards as second:

export FCEDIT='vim -u ~/.vimrc'


Your Answer

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

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