important vim commands

important VIM commands

Important VIM commands for daily usage

Important VIM commands is selected vim commands that every programmer shall have by heart.

By far important vim commands might be those we use in everyday programming life. But there more to it.

What is vim

Vim is a smart text editor for linux distros. It allows plugs ins for different usages. Basically, it pretty much knows most of programming languages you open with it.

Important vim commands will allow you to have a fast and productive usage of VIM while working on it.

Why should I use vim

You should use vim because it is cool. Really it is cool. Apart from being cool, it is light weight and almost available in most linux distributions.

Vim allows having third party plugins that will allow you to do multiple tasks from coloring to memory based copy and more.

Vim is programming language friendly. If you are working on java, it will highlight the keywords for you. Same for PHP or javascript or almost for lots of languages.

how it install vim

Usually VIM will come with most of the linux flavors:

If you are on Ubuntu installing vim on ubuntu will be
Continue reading important VIM commands

using express package in node – installation and usage example tutorial

This is a continuation of the tutorial started on node js angular and mongo db shown on
node js console tutorial

By far, you have seen how to write to the console and to display hello world through web using node.

But, showing simply Hello World is not that interesting and fun at all. And it doesn’t show anything that simulates real world example of accepting input from user and processing that.

Before doing that, lets see the express package which would enable us to do that.

installing express package and creating a page with input boxes.

1. create a directory node-input

2. move to that directory and issue the following command to install express in it

sudo npm install express

3. The above command would install express package in node_modules folder. This is the folder where all third party packages would be stored.

4. create server.js file in the folder node-input.

5. add the following code into server.js file.

 var express = require("express");
 var app = express();
 console.log("Something awesome to happen at http://localhost:8080");

6. Go to command line and start the web server, by now we know how to start the web server as

node server.js

Now you will see something interesting when you go to browser and type http://localhost:8080.

This time you would get Cannot GET / Unlike the previous time.

What is going on

express is framework that would make life way easier for the http communication between the nodejs server and whoever wants the request.

Among other things, it handle the http verbs, GET POST, DELETE, PUT, also it make the routing very easier. That is when you want to access some pages with something like or That means the /list and /register are handles through routing mechanisms of express.

Ok, lets fix the that “Cannot GET /” error.

Update the server.js as follows

 var express = require("express");
 //use the application off of express.
 var app = express();
 //define the route for "/"
 app.get("/", function (request, response){
     response.end("Hello World");
 //start the server
 console.log("Something awesome to happen at http://localhost:8080");

Now you will see Hello World on your browser when you type http://localhost:8080.

This time, we have created a router to response when the user lands on the root of the website.

Next: Serving html files from node js