Apr 262011
 

Feel bored with black and white display nginx configuration? Evan Miller create Syntax highlighting for the world’s best text editor, vim.

nginx configuration syntax highlighting

nginx

Here’s the tutorial http://www.vim.org/scripts/script.php?script_id=1886, or this how i’ve made it work on mine.

First change to .vim directory on home directory, then create directory called syntax.
example:

# cd .vim
# mkdir syntax
# cd syntax

Download latest nginx.vim to ~/.vim/syntax/
Create file called filetype.vim in .vim and then and then add this line.

au BufRead,BufNewFile /etc/nginx/* set ft=nginx

done. 😀

Sep 262009
 

Every person associated with the unix / linux would be familiar with the text editor called vi / vim. but not many people know that vi / vim can be used as a stream editor. This is one example of how to use vi / vim as a text editor. suppose we have a text file containing the following text:

sample.txt

hihihi
hahaha
hehehe

we will change the “hahaha” becomes “gagaga”

here’s what we do using vim

$ vim -b -c ":%s/hahaha/gagaga/g|:wq" sample.txt
"sample.txt" 6L, 24C
"sample.txt" 6L, 24C written

Now let’s see change that we’ve made

$ more sample.txt
hihihi
gagaga
hehehe

cool isn’t it? 🙂