How to turn on, VIM syntax highlighting


Bookmark and Share

If you guys are using the vi editor in ubuntu, like I do then you guys would have also noticed that – it would be great if there was syntax highlighting, To unlock syntax highlighting and whole lot of features in VIM we need to install the full package of vim.

go to your terminal and write the command

Once this package in loaded you can turn on the syntax in your vim by using this command ” :syntax enable “. Now your programming experience would become much more hazel free.

If you hate writing that command every time you enter vim , then there is even a solution for that as well.

go to your terminal and write the commands

There you will find some line saying :

There just remove the double quote( ” ) in the last line(“syntax on) and the syntax will be on by default now onwards in your VIM.

Happy Coding

Read More

How to make self executing ruby scripts in Linux?


Bookmark and Share

To run a ruby program we use the command ruby

ruby program_name.rb Ruby being an interpreter style language, each line is implemented one after the other and executable object code file is created for reuse like in case of compiler languages C, C++, etc.. To run a ruby code you need a ruby interpreter installed in your system.

Linux (all UNIX like operating systems) has a way of executing a file that can help make a script self executable (that is making a ruby script ruby by just calling its name, with no need to specify the interpreter program). Its called #!. Dennis Ritchie, who introduced it, referred it as hash-bang though over the course of time it came be known by many names such as shebang/hashbang/pound-bang/hash-exclam/hash-pling.

This #! character are never used alone, it is followed by the location of the interpreter program using which you want to run that particular file (script).

Now to make our ruby script executable we need to add to the first line the following statement

puts “The ruby code, starts from line 2” How does this work?

A program is executed using a tool known as program loader. In linux when a …

Read More