Live Chat!

compare files and edit simultaneously with vimdiff

*         3 votos

November 24th, 2006 mysurface

Refers to How to create patch file using patch and diff, you can actually read the diff file to compare the difference between the files. But what if you wanna compare and edit simultaneously?
Given 2 different files at your hand, you can do that with vimdiff. Let say I wanna compare this two files Tb01/TbApi.cpp [...]

Posted in Developer, vi, vim, vimdiff | Hits: 11406 | No Comments »

Running vim command while opening files

          0 votos

November 19th, 2006 mysurface

Refers back to Open file to edit with vim at desire line, here is another short tips of vim.
You can execute the vim command, while opening files with vim with option -c. While I wanna replace a string from a huge file, first I need to check whether I can do it with sed or [...]

Posted in Text Manipulation, sed, vi, vim | Hits: 6670 | No Comments »

search and replace

* * * *   1 votos

November 1st, 2006 mysurface

This is a very common needs, to search a keyword and replace it with another. Give you a simple example, when I want to perform a ubuntu distribution upgrade from dapper to edgy, I need to edit the file /etc/apt/sources.list.
To do that i can either uses vim, or simply uses sed.
The vim way.
sudo vim /etc/apt/source.list
When [...]

Posted in Misc, Text Manipulation, sed, sudo, vi, vim | Hits: 7308 | 2 Comments »

Some Trick for VIM

          0 votos

September 4th, 2006 liewsheng

When I converting a e-code to SystemVerilog syntax, I realize that I don’t like the format created by the script. The script creating port which group them under a line, but I like them if they separte in different line for different port. So I need to replace some special character with a new line.
Here [...]

Posted in vi, vim | Hits: 1558 | 2 Comments »

split windows view in vim

* * * * * 2 votos

August 21st, 2006 mysurface

Sometimes you would likes to have split view. You can compare the codes at the same time on the same screen. So when switching tabs or buffer is not convenience to you, you can consider to open more split windows.
To open another windows, and lead you to current directory for file selection, you can do [...]

Posted in Text Manipulation, vi, vim | Hits: 4534 | No Comments »

open multiple files in tabs, vim 7 can do that.

          0 votos

August 16th, 2006 mysurface

Remember last time when I open multiple files using vim, it will be loaded and store at the back buffer, in order to bring it to front, you need to first save your current file with :w then :bn for next :bp for previous. But seems vim 7 support tabs, I would like to open [...]

Posted in Text Manipulation, alias, vi, vim | Hits: 5327 | 3 Comments »

key mapping of vim 7

          0 votos

August 15th, 2006 mysurface

vim is a very popular editor which it have more than one mode, and it is flexible to allow you for mapping your key to the features. The common map keywork is :map, which the key is map and functional when you are in normal, visual mode. To make a key to edit a file [...]

Posted in Text Manipulation, vi, vim | Hits: 1660 | 2 Comments »

tabs in vim 7

          0 votos

August 15th, 2006 mysurface

This was amazing when I get to know that vim can do tab. Okay to do that, it is easy, what you need is to do a key binding. Create a file .vimrc into your home folder, and paste the lines bellow into it.
:map <F4>:tabprevious<cr>
:map <F3>:tabnext<cr>
:map <C-t>:tabnew .<cr>
:imap <F4>:tabprevious<cr>i
:imap <F3>:tabnext<cr>i
:imap [...]

Posted in Text Manipulation, ln, vi, vim, which | Hits: 4720 | 1 Comment »

searching man page inside vi editor

          0 votos

August 4th, 2006 mysurface

This is a tips provided by my friend durian. In order to search for man page while you are viewing either script or source code using vi editor, you can search for man page without quiting vi editor.
put your cursor over the keyword which you want to look up, and press shift-K
Let say if you [...]

Posted in Text Manipulation, vi, vim | Hits: 2031 | 1 Comment »