Como posso ativar a tecla backspace no VI?

4

Eu tenho a instalação do FreeBSD. Nenhum pacote instalado. E o VI não aceita a tecla de retrocesso. (Eu pressionei a tecla backspace mas nada aconteceu) Como posso ativar a tecla backspace no VI?

Ah, e estou usando o Mac e controlando o FreeBSD na VM ou via Terminal.

    
por Eonil 01.03.2011 / 14:12

3 respostas

3

Você pode tentar isso no terminal antes de executar o vi:

$ stty erase [Ctrl-V] [Backspace]

onde [Ctrl-V] pressiona Control + V e [Backspace] pressiona a tecla de retrocesso.

    
por 01.03.2011 / 14:49
1

O que me ajudou - em Preferências do Terminal - selecione a guia Avançado - marque a opção "Excluir envia Ctrl-H"

    
por 28.01.2013 / 19:14
-1

De :h backspace-delete :

Backspace and Delete keys *backspace-delete*


In 3.0 both the delete key and the backspace key worked as a backspace in insert mode; they deleted the character to the left of the cursor. In 4.0 the delete key has a new function: it deletes the character under the cursor, just like it does on the command-line. If the cursor is after the end of the line and 'bs' is set, two lines are joined. |<Del>| |i_<Del>|

In 3.0 the backspace key was always defined as CTRL-H and delete as CTRL-?. In 4.0 the code for the backspace and delete key is obtained from termcap or termlib, and adjusted for the "stty erase" value on Unix. This helps people who define the erase character according to the keyboard they are working on. |<BS>| |i_<BS>|

If you prefer backspace and delete in Insert mode to have the old behavior, put this line in your vimrc:

    inoremap ^? ^H

And you may also want to add these, to fix the values for <BS> and <Del>:

    set t_kb=^H
    set t_kD=^?

(Enter ^H with CTRL-V CTRL-H and ^? with CTRL-V CTRL-? or <Del>.)

If the value for t_kb is correct, but the t_kD value is not, use the ":fixdel" command. It will set t_kD according to the value of t_kb. This is useful if you are using several different terminals. |:fixdel|

When ^H is not recognized as <BS> or <Del>, it is used like a backspace.

    
por 01.03.2011 / 16:16