[Startup Engineering] #TIP: How to edit sources using vi

[email protected]:~$ cd bitstarter
[email protected]:~/bitstarter$ cat web.js
var express = require('express');

var app = express.createServer(express.logger());

app.get('/', function(request response)){
	reponse.send('Hello World!');
});

var port = process.env.PORT || 5000;
app.listen(port, function(){
	console.log("Listening on " + port);
});
[email protected]:~/bitstarter$ vi web.js

Then, you can see vi-editor. press ‘i’ in your keyboard. and vi become edit mode.

var express = require('express');

var app = express.createServer(express.logger());

app.get('/', function(request response)){
	reponse.send('Hello World!');
});

var port = process.env.PORT || 5000;
app.listen(port, function(){
	console.log("Listening on " + port);
});
~
~
~
~
~
-- INSERT -- // <- edit mode

Move the cursor using the direction key. If press ESC after editing, get out of edit mode.
If you want to end vi, press the semicolon(:) and wq(=write and quit).

see more about vi editor commands

앱 & 서비스 기획자입니다. 잘하고 싶어요.

Sliding Sidebar