레이블이 ubuntu인 게시물을 표시합니다. 모든 게시물 표시
레이블이 ubuntu인 게시물을 표시합니다. 모든 게시물 표시

2017년 3월 3일 금요일

Backspace in insert mode in vi doesn't erase the character and vi command

$ set nocompatible
$ set backspace=2


You need to change to the "insert" mode by moving the cursor with i. There are other ways to delete characters directly. You can download a powerpoint that I use when teaching a class on VI here.

It sounds like you are in the "Command" mode. To move your cursor:
H = Left, J = Up, K = Down, L = Right

Once you have your cursor positioned you can delete text as follows:
x Deletes the character under the cursor
X Deletes the character before the cursor
dw Deletes from the cursor to the next word
dd Deletes the line the cursor is on.
To enter text, you can use one of the text entry modes.
a Adds text to the right of the cursor
A Adds text to the end of the current line
i Adds text to the left of the cursor
I Adds test to the beginin of the current line
o Opens a new line below the current line and places you in text entry mode
O Opens a new line Above the current line and places you in text entry mode
To exit Text entry mode, and return to the Command mode, use Esc.
To Undo changes: (A student favorite)
u Undo the last command entered
U Undo all changes to the ** current line**
To Save/Quit: :w Writes (Saves) the file and remains open
:wq Writes (Saves) the file and exits VI
:q Quits (Exits) if you've made no changes
:q! Quits (Exits) without saving changes
ZZ Writes (Saves) the file and exits VI (same as :wq)

viで矢印キーを押すとABCDが入ってしまう

■viで矢印キーを押すとABCDが入ってしまう

vi で、矢印キーを押すとABCDなんて文字が入ってしまうのに困っていたのですが、解決方法をみつけました。

ポイント
vi 起動直後にコマンドで :set nocompatible と入力する。
毎回コマンドを入力するのは面倒なので、~/.vimrc にこれを記述しておく。

参考にさせていただいたサイト Vimで方向キーを押すとABCDが出る問題を直す
ありがとうございます。

簡単!UbuntuにApache2をインストールする方法

簡単!UbuntuにApache2をインストールする方法

sudo apt-get install apache2 
http://localhost/
 

index.htmlを編集

なお、このとき表示されているファイルは、/var/www/index.htmlファイルです。
編集するには、
 
chown -hR 自分のユーザ名 /var/www
 
とやって、あとは/var/www/ の中の index.htmlファイルをエディターで編集すればOK!
楽しくなってきた〜