Description TBD
set tags=./tags,/usr/src/linux/tags,/usr/include/tags set number set csprg=/usr/bin/cscope set csto=0 set cst set mouse=a set nocsverb set encoding=utf-8 "set sw=4 "set tabstop=8 "set expandtab set autoindent set cindent set smartindent set ruler set wmnu set lpl set ic set scs set sc set sm set sel=exclusive abbr #b /********************************************************* abbr #e *********************************************************/ "color advantage color impact if $LANG[0] == 'k' && $LANG[1] == 'o' set fileencoding=korea endif if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif if &term=="xterm" set t_Co=8 set t_Sb=^[[4%dm set t_Sf=^[[3%dm endif if filereadable("./cscope.out") cs add cscope.out else cs add /home/share/linux/cscope.out endif set csverb if version >= 500 func! Sts() let st = expand("<cword>") exe "sts ".st endfunc nmap ,st :call Sts()<cr> func! Tj() let st = expand("<cword>") exe "tj ".st endfunc nmap ,tj :call Tj()<cr> endif map ,1 :b!1<CR> map ,2 :b!2<CR> map ,3 :b!3<CR> map ,4 :b!4<CR> map ,5 :b!5<CR> map ,6 :b!6<CR> map ,7 :b!7<CR> map ,8 :b!8<CR> map ,9 :b!9<CR> map ,0 :b!0<CR> map ,w :b!bw<CR> map <F1> v]}zf nnoremap <silent> <F2> :copen<CR> nnoremap <silent> <F3> :cclose<CR> nnoremap <silent> <F4> :make uImage<CR> :cw 7<CR> nnoremap <silent> <F5> :cs find f nnoremap <silent> <F6> :BufExplorer<CR> nnoremap <silent> <F7> :Tlist<CR> nnoremap <silent> <F8> :make cscope ARCH=arm<CR> :cs kill 0<CR> :cs add cscope.out<CR> func! Man( ) let sm = expand("<cword>") exe "!man -S 2:3:4:5:6:7:8:9:tcl:n:l:p:o ".sm endfunc nmap <F9> :call Man( )<cr><cr> nmap <C-[>s :cs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-[>g :cs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-[>c :cs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-[>t :cs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-[>e :cs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-[>f :cs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-[>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-[>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Show trailing whitespace and spaces before tabs
hi link localWhitespaceError Error
au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
au Syntax * syn match localWhitespaceError / \+\ze\t/ display
| Palm pre vs iPhone 3G vs iPhone 3GS (0) | 2009/06/27 |
|---|---|
| AMOLED has RGB color filter!? (0) | 2009/06/27 |
| Configuring your own vim (0) | 2009/06/09 |
| VIM & CSCOPE configuration for kernel development (0) | 2009/06/09 |
| If your Ubuntu (9.04 Jaunty Jackalope) laptop has problem with sleep-resume (0) | 2009/06/04 |
| MIPI CSI-2 layer overview (0) | 2009/06/03 |
Tag : vi, vi shortcut keys, vim, vim shortcut keys, vimrc
Ubuntu is not serving vim full packages for default. So, if you need to use advanced features of vim, just type like following
sudo apt-get install vim
Hey, M$ users. You can even use reference library like MSDN in vim as well. Just install man pages for development and press shift+k on symbol in vim. Then, you’ll see.
sudo apt-get install manpages-dev
And even use symbol search feature in vim also.
sudo apt-get install cscope
Just add following lines in your .vimrc which is stored in your home directory.
set csprg=/usr/bin/cscope if filereadable("./cscope.out") cs add cscope.out else cs add "your project cscope.out" endif set csverb
If your project is not supporting cscope through Make, then you can make a script on your own and locate it in your /usr/local/bin directory with executable permission. And execute that script in your top directory of your project. BTW, kernel project just supports cscope through Makefile. You can just issue “make cscope ARCH=…”
#!/bin/sh rm -rf cscope.* find . \( -name '*.c' -o -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.s' -o -name '*.S' \) -print > cscope.files cscope -i cscope.files
Enjoy your vim&cscope life.
Cheers,
| AMOLED has RGB color filter!? (0) | 2009/06/27 |
|---|---|
| Configuring your own vim (0) | 2009/06/09 |
| VIM & CSCOPE configuration for kernel development (0) | 2009/06/09 |
| If your Ubuntu (9.04 Jaunty Jackalope) laptop has problem with sleep-resume (0) | 2009/06/04 |
| MIPI CSI-2 layer overview (0) | 2009/06/03 |
| Getting started with Chrome on Linux (ubuntu box) (0) | 2009/06/01 |
Tag : vi, vi + cscope, vim + cscope, vim. cscope
vi 에서 코드 분석하거나 작성할때 C 함수들을 쉘에서 man page 를 통해 볼수 있지만
vi 에서 곧바로 확인하는 방법이 있습니다.
우선 개발자용 맨페이지를 받아야하는데요
1. ubuntu 기준으로
sudo apt-get install manpages-dev
하시면 Linux programmer's manual 을 받을수 있습니다. (리눅스는 섹션 2네요...솔라리스나 HPUX 같은건 7 이었던 것 같은데..)
2. vi 에서 표준 C 함수에 커서를 놓고 shift + k 를 누르시면 해당 함수의 매뉴얼이 나옵니다.
즐개발~
| git pull & patch 간략 정리 (0) | 2009/02/18 |
|---|---|
| Hello San Francisco. (0) | 2009/02/13 |
| vi 와 Linux programmer’s manual 연동 (0) | 2009/02/12 |
| cscope with linux kernel source code (0) | 2009/02/10 |
| Firefox url bar problem on Ubuntu 8.04 (0) | 2009/02/02 |
| V4L2 개발 관련 정리. (0) | 2009/01/21 |
Tag : Linux programmer's manual, man page, MSDN, vi, vim
cscope 를 사용하시면 커널소스안에서 파일 위치나 함수 위치 같은걸 기억하지 않아도 금방 찾을수 있습니다.
심볼 싱크하는 시간도 IDE 들에 비해 훨씬 빨라서 좋습니다.(아무리 늦어도 30초 이내에 전체 프로젝트가 싱크됨)
ubuntu 기준으로
sudo apt-get install cscope
우선 자신의 계정에 .vimrc 를 열어서 편집합니다.
set csprg=/usr/bin/cscope
......
if filereadable("./cscope.out")
cs add cscope.out
else
cs add /home/share/linux/cscope.out
endif
set csverb
이걸 추가 해주시구요.
커널 소스의 최상위 디렉토리에서
kdsoo@chromatix:/home/share/GIT/OMAP3430/linux-2.6.29-rc3-omap$ make cscope
합니다.
그럼 cscope index 를 만들기 시작합니다.
kdsoo@chromatix:/home/share/GIT/OMAP3430/linux-2.6.29-rc3-omap$ vi .
위와 같이 커널소스 최상위 디렉토리에서 "vi ." 이라고 치시면 vim 이 cscope 가 생성한 db와 연동하여 open 됩니다.
vi 의 command mode (: 를 누르면 들어감) 에서
- 파일 찾기: cs find f 파일명
- 심볼 찾기 : cs find s 심볼
- 함수등의 원형 찾기 : cs find g 심볼
- 해당함수를 호출하는 함수 찾기 : cs find c 심볼
- 해당함수가 호출하는 함수 찾기 : cs find d 심볼
더 있는데 저는 대충 이거만 써서...
사용법은 vim의 command mode 에서
:cs
라고 치시면 나오니 참고하세요.
단축키 만들어 두면 편합니다.
.vimrc에 다음을 구미에 맞게 추가하세요. (F 키는 키보드의 펑션키를 말함..취향에 맞게 변경해 쓰세요)
- cscope db 빌드 단축키 (F8)
nnoremap <silent> <F8> :make cscope ARCH=arm<CR> :cs kill 0<CR> :cs add cscope.out<CR>
- 파일찾기 단축키
nnoremap <silent> <F5> :cs find f
vim 의 visual mode (마우스로 해당 심볼을 선택가능한 모드)에서
해당 심볼을 마우스로 선택하고(그냥 원클릭)
ctrl + [ 를 누른후 s g c t e 등의 cscope 커맨드 옵션을 입력하면
cs find "옵션" 심볼
과 같은 효과를 낼수 있습니다.
다음을 .vimrc에 추가하세요.
nmap <C-[>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-[>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-[>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-[>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-[>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-[>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-[>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-[>d :cs find d <C-R>=expand("<cword>")<CR><CR>
위 옵션들을 추가하면 vim 에서 원하는 심볼을 선택하고 해당 심볼을 call 하는 심볼을 찾는 작업등을 할수 있습니다.
그럼 즐거운 vi 생활 되세요.
추가로... 지금 열고있는 소스파일의 심볼 목록을 쉽게 보고 싶으신 경우를 위해 다음 단축키도 편하게 사용하실수 있습니다.
nnoremap <silent> <F7> :Tlist<CR>
| Hello San Francisco. (0) | 2009/02/13 |
|---|---|
| vi 와 Linux programmer’s manual 연동 (0) | 2009/02/12 |
| cscope with linux kernel source code (0) | 2009/02/10 |
| Firefox url bar problem on Ubuntu 8.04 (0) | 2009/02/02 |
| V4L2 개발 관련 정리. (0) | 2009/01/21 |
| Diff tools (0) | 2009/01/16 |
Tag : cscope, Linux Kernel, vi, vim
| 잡스씨...왜 only in Leopard인가요 (0) | 2007/09/23 |
|---|---|
| 일에 대한 권태 (4) | 2007/09/06 |
| 집에서도 열혈 코딩/코드분석을... (1) | 2007/08/28 |
| 영화나 드라마에 종종 나오는 컴퓨터 터미널의 모습들... (0) | 2007/06/30 |
| IPhone 풀렸구나 (0) | 2007/06/30 |
| 또 구미 =ㅅ= (0) | 2007/06/14 |
Tag : cscope, ctags, kernel, Linux, taglist, vi
Send me an instant message!