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

[sourcecode language=”bash”]
[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
[/sourcecode]

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

[sourcecode language=”javascript”]
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
[/sourcecode]

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

적게 일하고 많이 버는 법을 늘 고민합니다. 일이 되게 하는 것에 간혹 목숨을 겁니다. 지금은 우아한형제들과 함께 일하고 있어요.

(c) 2013-2020 minieetea.com