:set paste command in vi

Alexander Kriegisch Alexander at Kriegisch.name
Tue Dec 11 11:38:29 UTC 2007


Hi Alexander!

> Is there a way to support the ':set paste' or command or something 
> similar to this in busybox' vi? The reason for me asking is that if I
> paste text into vi with the mouse when working over an SSH connection
> f.ex. each line gets more and more indented. vim offers a feature
> called ":set paste" resp. ":set nopaste" which allows for toggling
> auto-indenting lines when pasting text.

Variant #1: interactively change settings in vi
-----------------------------------------------

:set
autoindent noflash ignorecase showmatch tabstop=8
:set noai
:set tabstop=4
:set
noautoindent noflash ignorecase showmatch tabstop=4

The "noai" is what you want in this case. BTW: Do not try to change
multiple settings by one "set" command, it will not work in BB vi.

Variant #2: set preferences upon vi start
-----------------------------------------

# 2a: parameter "-c" variant
vi -c "$(echo -e "set noai\nset tabstop=4")"

# 2b: environment variable variant
EXINIT="$(echo -e "set noai\nset tabstop=4")" vi

# 2c: environment variable again, but this time interactively
# typing a linefeed
EXINIT="set noai
set tabstop=4" vi

Variant #3: shell profile
-------------------------

Feel free to use 2b or 2c in your global or personal shell profile,
exporting EXINIT. In ash those would be /etc/profile or ~/.profile,
respectively.

Variant #4: ~/.virc or ~/.exrc
------------------------------

Do not try these, either. BB vi does not support them, the environment
variable is the best you can currently get.

Regards
--
Alexander Kriegisch




More information about the busybox mailing list