Linux For Cynics One user's experiences with Linux

2Aug/130

Reset or Change Terminal Background

Sometimes if you use vim in a virtual terminal with a color scheme with more than a 256 color pallet, you will have some ugly results:
debian-2013-08-02 14_46_17-
Even worse, those ugly colors may stick around after vim has exited. This is because a virtual terminal is essentially a state machine. When something changes, it has to be explicitly changed back to reverse it:
debian-2013-08-02 14_48_40-

One way to do this is to use the

tput

command. To go back to the normal colors, simply use this command:

$ tput reset
15May/130

Fizz Buzz in Vim

The "Fizz Buzz" problem is a beginner's programming exercise. It is stated as:

Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz"

Fairly simple, you can even get vim to do it:
vim_fizz_buzz

Tagged as: , No Comments