2013-05-16 44 views
0

正常情況下,當使用vim和cscope時,它會在底部的quickfix窗口中顯示搜索結果。 當在命令行中鍵入:cn時,它將跳轉到包含關鍵字的行的開頭。如何突出顯示quickfix結果關鍵字?

是否有解決方案來突出顯示關鍵字,並將光標放在關鍵字的同時會更好。

感謝您的幫助..

PS:在我看來,是有可能跳到第一線,然後用一個函數來搜索關鍵字,並強調它,但如何保存的關鍵字信息這些行動?

追加:現在,以下功能
第一:保留關鍵字gloablly 第二:顯示cscope結果在quickfix窗口。

行258總是失敗。有一些人知道如何在Cppsearch功能

252 "nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> 
253 let g:winword = "hello" 
254 map ch :call Cppsearch()<cr> 
255 function! Cppsearch() 
256  let wincursor = line(".") 
257  let g:winword=expand("<cword>") 
258  normal cs find s g:winword<cr>                      
259  "call setline(wincursor, "") 
260  "call append(wincursor+1, g:winword) 
261 endfunction 

回答

0

:cnext將跳轉到該關鍵字的開頭時,它知道它的起始列執行命令「CS發現的」,即當quickfix線看起來是這樣的:

file|3 col 29| cscope 

col信息丟失,Vim僅能找到行並跳轉到它的開始。

我不知道cscope幫助你爲什麼它不包括列。

+0

以及Ingo,下面是我的quickfix like:frameworks/av/services/camera/libcameraservice/CameraService.h | 144 | <> int mNumberOfCameras;並且我嘗試了我朋友的vim,並且他們都跳到了主窗口的行首 – harris

+0

是的,對,144是行號;沒有列的信息附加。 –