Linux

Indent/format an entire file using vim

You can format/indent an entire file using the vim editor and the gg=G command. gg – Goto the beginning of the file = – apply indentation G – till end of file If you decide not to indent your file, just press u to undo the last operation.

Read More
Linux

Switch off annoying bell/beep in xterm

My colleagues don’t like all the bell/beep sounds I make when I’m working in a xterm through my putty ssh client. To please them I’ve added this line to /etc/inputrc to disable bell on tab-completion. set bell-style none

Read More
Linux

vim search and replace text

Different ways of replacing text etc. Replace every occurrence of pattern1 (pat1) with pat2 :g/pat1/s//pat2/g Replace every occurence of pattern1 (pat1) with a newline :g/pat1/s//\r/g In practice this inserts a newline after every occurence of pat1.

Read More