顯示具有 vim 標籤的文章。 顯示所有文章
顯示具有 vim 標籤的文章。 顯示所有文章

2011年8月16日 星期二

vimdiff比對檔案 忽略空白

vimdiff a.txt b.txt
:set diffopt+=iwhite

Ref:
http://zh-tw.w3support.net/index.php?db=so&id=1265410

透過Facebook分享

2011年8月12日 星期五

使用vimdiff做合併

vimdiff a.txt b.txt

移動到差異的地方
(目前是在a.txt)
使用do可以將b.txt的差異複製到a.txt
使用dp可以將a.txt的差異複製到b.txt
如果要兩個檔案之間互相切換, 請按下Ctrl , 接著按兩下w

Ref:
http://www.ibm.com/developerworks/cn/linux/l-vimdiff/

透過Facebook分享

2011年8月9日 星期二

用vim來排版

用vim開啟檔案
按下v進入選取模式

用上下鍵來選取範圍

最後按下=

就會自動排版

非常的方便

透過Facebook分享

vim+ctag - 快速追蹤function def來源

Ref:
http://stenlyho.blogspot.com/2008/11/ubuntuvim-plugin-ctagstaglist.html


Ctrl+] : 跳到游標所指function的implement 位置 ,注意游標要在function的第一個字。
Ctrl+t : 返回到剛剛的位置。

透過Facebook分享

2011年8月8日 星期一

拼裝的藝術:vim 之 IDE 進化實錄

我喜歡他介紹vim+ctags的部份
可以增強你看code的速度

PDF 版本下載

Ref:
http://linuxtoy.org/archives/vim-evolution-from-editor-to-ide.html

透過Facebook分享

2011年5月26日 星期四

vim 換行自動對齊功能

【軟件應用】vim 換行自動對齊_Glaivelee --- LIFE NOT IF ELSE_百度空間: "set number

- 已使用 Google 工具列寄出"

在home目錄下
vim .vimrc

set autoindent
set smartindent

另外我加上
set number
可以顯示行號

透過Facebook分享

2010年12月29日 星期三

vimdiff 比較檔案之間的差異

使用vimdiff 可以比較兩到四個檔案之間的差異

vimdiff file1 file2 file3 file4
依照這種方式可以比對到四個檔案之多

預設使用垂直的方式比對
如果有些字會被遮到
可以使用-o更換成水平方式

vimdiff -o file1 file2

default顏色比對效果不明顯
可以參考

Change vimdiff color

修改比對顏色


比對時需要切換到不同的檔案
可以使用
ctrl+w w
ctrl先按住 w按兩次


Reference:
http://man.chinaunix.net/newsoft/vi/doc/diff.html

透過Facebook分享

2010年11月25日 星期四

vim - 編輯顯示的顏色

Follow

挑選 Vim 顏色(Color Scheme)


請在這裡挑選你喜歡的layout

create folder
~/.vim/colors

編輯.vimrc (如果沒有就產生一個)
colorscheme brookstream
syntax on 
set t_Co=256

藍色部份就是你下載layout檔案的檔名


透過Facebook分享

vim - 顯示目前編輯的檔名

:f 或 Ctrl+g
顯示目前編輯的檔名、是否經過修改及目前游標所在之位置。

Reference:
http://edt1023.sayya.org/vim/node7.html

透過Facebook分享

2010年11月23日 星期二

vim - undo

用vim編輯檔案
打錯字想要恢復成上一次存檔(:w)前的狀態

請使用:u

透過Facebook分享

2010年11月19日 星期五

vim - 搜尋 and 取代功能

進入console mode
[ESC]
:%s/A/B

找到A字串
用B字串取代

透過Facebook分享

2010年11月18日 星期四

搜尋某目錄下某副檔名中的字串

find ./myandroid9.1/kernel_imx/ -name \*.h -exec grep -wnH SERIAL_IO_MEM {} \;

搜尋此目錄下 - ./myandroid9.1/kernel_imx/
副檔名為.h
搜尋字串為SERIAL_IO_MEM

Reference:
http://blog.roodo.com/jaytech/archives/9783869.html

透過Facebook分享

2010年11月17日 星期三

移動資料夾下的內容

當下目錄有B目錄
要將B目錄下的所有資料搬到當下目錄

mv ./B/* .

透過Facebook分享

2010年11月10日 星期三

如何找出.git目錄

開發android
要搜尋某個字串 在整個android內
想要跳過.git目錄不搜尋
藉此來降低搜尋上的時間

如何找出該目錄下的.git目錄了

find . -type d -name '\.git'

-type d 找目錄
-type f 找檔案

-name '\.git'
找尋.git目錄

感謝charles教學
要犧牲下班時間教學
尤其感動

所以我要把所有.git刪掉才可以下班

Update 20101112
Checko提供的指令完全正確

完全正確
真的是太神了
find . -type d -name '\.git' -print0 | xargs -0 rm -rf

find
-print0
True; print the full file name on the standard output, followed
by a null character (instead of the newline character that
-print uses). This allows file names that contain newlines or
other types of white space to be correctly interpreted by pro‐
grams that process the find output. This option corresponds to
the -0 option of xargs.

xargs - build and execute command lines from standard input

--null
-0 Input items are terminated by a null character instead of by
whitespace, and the quotes and backslash are not special (every
character is taken literally). Disables the end of file string,
which is treated like any other argument. Useful when input
items might contain white space, quote marks, or backslashes.
The GNU find -print0 option produces input suitable for this
mode.

透過Facebook分享