Friday, February 22, 2013

Vim Editor Commands

Vim is a very powerful tool for editing text. It is widely used by programmers for source code editing and browsing. It is an improved version of the vi editor, hence stands for Vi IMproved.. It is freely distributed with most of the linux and unix systems. It can be downloaded from below link.

Graphical version of Vim is also available which is known as gVim, and it supports all of the Vim commands. It is also available for Windows.

Once you get used to Vim, you will definitely say like every programmer, "Vim is a life saviour".

Below are some of the widely used vim commands, every programmer/vim user must know:

Editing
r
replace a single character (does not use insert mode)
J
join line below to the current one
cc
change (replace) an entire line
cw
change (replace) to the end of word
c$
change (replace) to the end of line
s
delete character at cursor and subsitute text
S
delete line at cursor and substitute text (same as cc)
xp
transpose two letters (delete and paste, technically)
u
undo
.
repeat last command


Marking Text (visual mode)
v
start visual mode, mark lines, then do command (such as y-yank)
V
start Linewise visual mode
O
move to other end of marked area
Ctrl+v
start visual block mode
O
move to Other corner of block
Aw
mark a word
Ab
a () block (with braces)
aB
a {} block (with brackets)
Ib
inner () block
Ib
inner {} block
Esc
exit visual mode


Visual Commands
> 
shift right
< 
shift left
Y
yank (copy) marked text
D
delete marked text
~
switch alphabet’s case (lower to upper or upper to lower)


Cut and Paste
yy
yank (copy) a line
2yy
yank 2 lines
yw
yank word
y$
yank to end of line
P
put (paste) the clipboard after cursor
P
put (paste) before cursor
dd
delete (cut) a line
dw
delete (cut) the current word
X
delete (cut) current character


Exiting
:w
write (save) the file, but don't exit
:wq
write (save) and quit
:q
quit (fails if anything has changed)
:q!
quit and throw away changes


Search / Replace
/pattern
search for pattern
?pattern
search backward for pattern
n
repeat search in same direction
N
repeat search in opposite direction
:%s/old/new/g
replace all old with new throughout file
:%s/old/new/gc
replace all old with new throughout file with confirmations


Working with multiple files
:e filename
edit a file in a new buffer
:bnext (or :bn)
go to next buffer
:bprev (or :bp)
go to prev buffer
:bd
deletes the buffer currently active
:sp filename
open a file in a new buffer and split window
ctrl + ws
split windows
ctrl + ww
switch between windows
ctrl + wq
quit a window
ctrl + wv
split windows vertically

Friday, May 18, 2012

Intoduction to Linux (GNU Operating System)

Most often, we say that we are using linux operating system. When we say like this, we are wrong. Linux is not an operating system, its just a kernel for GNU operating system designed and coded by Linus Torvalds, a 21 years old student at the University of Helsinki, Finland in April 1991. Here is a quick intro about GNU and Linux kernel-

What is GNU?

GNU is a Unix-like operating system that is free software—it respects your freedom. You can install Linux-based versions of GNU which are entirely free software.
Screenshot of the Trisquel GNU/Linux distribution running OpenOffice.org, a free software office suite comparable to Microsoft Office or Apple iWork
The GNU Project was launched in 1984 to develop the GNU system. The name “GNU” is a recursive acronym for “GNU's Not Unix!”. "GNU" is pronounced g'noo,  as one syllable, like saying "grew" but replacing the r with n.
A Unix-like operating system is a software collection of applications, libraries, and developer tools, plus a program to allocate resources and talk to the hardware, known as a kernel.

The Hurd, GNU's own kernel, is some way from being ready for daily use. Thus, GNU is typically used today with a kernel called Linux. This combination is the GNU/Linux operating system. GNU/Linux is used by millions, though many call it "Linux" by mistake.


What is Free Software?


Free software” is a matter of liberty, not price. To understand the concept, you should think of “free” as in “free speech”, not as in “free beer”.
Free software is a matter of the users' freedom to run, copy, distribute, study, change and improve the software. More precisely, it refers to four kinds of freedom, for the users of the software: 

  • The freedom to run the program, for any purpose (freedom 0). 
  • The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this. 
  • The freedom to redistribute copies so you can help your neighbor (freedom 2). 
  • The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). Access to the source code is a precondition for this.

Friday, February 24, 2012

Just for fun - Cockroaches for your desktop

Hi Everyone..
  This time I'm introducing a good fun application for your desktop. Hope you all will love it and enjoy the tiny cockroaches moving on the screen of your desktop in randomized direction. You can download this software for free and can distribute it to your friends also.

When you see one of these cockroaches on the screen, they look very real. They even walk around the same way real cockroaches do. You can make beautiful laughter, if you like these types of jokes. 
You can manage all cockroach settings from system tray cockroach icon where you can enable it for startup, add more cockroach on desktop and exit option also. 
Application use less system resources so you can use it without think about system speed worry.


Click here to download the software application.