Search code examples
unixvibusybox

vi can't set paste(turn off auto indent while paste) in BusyBox


vi version is BusyBox v1.20.2 (2014-08-27 12:48:18 PDT) multi-call binary, which run on esxi machine.

Can't paste text without auto indent by these methods:

  • :set paste in vi editor
  • configure set noautoindent in .vimrc which located in $HOME directory.

How could I achieve that?


Solution

  • BusyBox's vi is tiny and doesn't know what paste is.

    It also isn't VIM, so won't read .vimrc, but will read $HOME/.exrc if it exists and is only owned and writable by the user. You should be able to put set noautoindent there in a more recent version.

    You also have the option of placing commands in the EXINIT environment variable, or passing them as an additional parameter with -c "some_command" (both of which should be implemented in the version you're using, and both of which allow multiple commands separated by \n).

    I'll note that all of the above depends on vi having been built with the SETOPTS, SET and COLON features enabled (though -c should work without COLON), which should be the default.

    The set of options supported by a current version appears to be:

    • autoindent
    • expandtab
    • flash
    • ignorecase
    • showmatch
    • tabstop