Tag Archives: vim

python vim setting

忘了那邊找來的,不過覺得不錯用

將以下設定存到 /etc/vim/vimrc or ~/.vimrc

" configure expanding of tabs for various file types
au BufRead,BufNewFile *.py set expandtab
au BufRead,BufNewFile *.c set noexpandtab
au BufRead,BufNewFile *.h set noexpandtab
au BufRead,BufNewFile Makefile* set noexpandtab
" --------------------------------------------------------------------------------
" configure editor with tabs and nice stuff...
" --------------------------------------------------------------------------------
set expandtab " enter spaces when tab is pressed
set textwidth=120 " break lines when line length increases
set tabstop=4 " use 4 spaces to represent tab
set softtabstop=4
set shiftwidth=4 " number of spaces to use for auto indent
set autoindent " copy indent from current line when starting a new line
 " make backspaces more powerfull
set backspace=indent,eol,start
 set ruler " show line and column number
syntax on " syntax highlighting
set showcmd " show (partial) command in status line 

[Linux] binary file compare

Linux 下 binary 相關的工具如下..

hexdump:

將 hex 值dump 出來

最快的比較方式就是, hexdump file 輸出到文字檔之後, 再比較

hexedit:

修改 binary file.

常用指令

F2: Save
Ctrl + > 到檔案最尾端
Ctrl + s : Search, 找 binary  string , ex: “aabbccddee”

Ctrl + x : Save and Exit

vbindiff

視窗型的 binary diff 工具

dhex

同上, 不過 ubuntu 應該沒有收錄

cmp

$ cmp file1 file2 -l

這樣會列出兩個 binary file 的差異處.

vim

用 vimdiff 之後
再下command (兩邊的視窗都要下)
:%!xxd
就解決了.

vim 的介面算很親切的.