分页: 1 / 1

改了一个gvim menu

发表于 : 2009-02-19 12:15
eexpress

代码: 全选

2009-02-19 12:12:03 四 ~/.vim/plugin  
☎ cat  cscopemenu-exp.vim 
" Add_Cscope_Menu
"   Adds a cscope menu
"   All the commands work on the word that is under the cursor
function! s:Add_CScope_Menu(menu_clear)
    if has("gui_running")
                if (a:menu_clear)

                        silent! unmenu &Cscope
                        silent! unmenu! &Cscope
                        amenu <silent> &Cscope.查找调用本函数的函数 :cs find c <C-R>=expand("<cword>") <CR><CR>
                        amenu <silent> &Cscope.查找本函数调用的函数 :cs find d <C-R>=expand("<cword>") <CR><CR>
                        amenu <silent> &Cscope.查找egrep模式 :cs find e <C-R>=expand("<cword>") <CR><CR>
                        amenu <silent> &Cscope.查找并打开文件 :cs find f <C-R>=expand("<cword>") <CR><CR>
                        amenu <silent> &Cscope.查找函数、宏、枚举等定义的位置 :cs find g <C-R>=expand("<cword>") <CR><CR>
                        amenu <silent> &Cscope.查找包含本文件的#including文件 :cs find i <C-R>=expand("<cfile>") <CR><CR>
                        amenu <silent> &Cscope.查找C语言符号 :cs find s <C-R>=expand("<cword>") <CR><CR>
                        amenu <silent> &Cscope.查找指定的字符串 :cs find t <C-R>=expand("<cword>") <CR><CR>
                endif
    endif

endfunction

autocmd BufEnter * call s:Add_CScope_Menu(1)
居然这个出错。vim正常的。可vim不认这菜单。不知道谁会改成vim使用热键启动的菜单。
E567: 没有 cscope 连接

Re: 改了一个gvim menu

发表于 : 2009-02-19 12:53
poet
这个与 gvim 无关吧。连接应该是你自己在 .vimrc 中创建的。或者你再加个菜单创建连接。

用 cs add 命令创建连接。

Re: 改了一个gvim menu

发表于 : 2009-02-19 12:56
eexpress
是刚才清除了某个插件,导致没add。这不重要。

重要的是,可以改成vim的热键菜单不。

Re: 改了一个gvim menu

发表于 : 2009-02-19 13:02
sarrow
参考2楼即可。

比如,添加:
:cs add cscope.out
到你的自动命令里面。

我则是做了一个快捷键。

<Ctrl-F10>是更新ctag
<Alt-F10>则是更新(并链接)cscope.out

Re: 改了一个gvim menu

发表于 : 2009-02-19 13:04
eexpress
????

Re: 改了一个gvim menu

发表于 : 2009-02-19 13:48
lerosua
map <C-\> : call xxx<CR>

Re: 改了一个gvim menu

发表于 : 2009-02-19 15:40
eexpress
这样可以出来。没popu!出来。

代码: 全选

	:source $VIMRUNTIME/menu.vim
	:set wildmenu
	:set cpo-=<
	:set wcm=<C-Z>
	:map <F1> :emenu <C-Z>
	:map <F2>	:popu Cscope<C-Z>
F2不出来的。F1正常。

各种命令的tab补全,也显示的。蛮好

Re: 改了一个gvim menu

发表于 : 2009-02-19 16:05
eexpress
lersoua 帮忙改的。谁帮忙改出popu的效果哦。

代码: 全选

☎ cat ~/.vim/plugincscope-menu-exp.vim 
" Add_Cscope_Menu
"   Adds a cscope menu
"   All the commands work on the word that is under the cursor
"function! s:Add_CScope_Menu(menu_clear)
function Add_CScope_Menu(menu_clear)
        if (a:menu_clear)

                silent! unmenu &Cscope
                silent! unmenu! &Cscope
                menu 19.405  &Cscope.查找调用本函数的函数 :cs find c =expand("") 
                menu 19.406  &Cscope.查找本函数调用的函数 :cs find d =expand("") 
                menu 19.407  &Cscope.查找egrep模式 :cs find e =expand("") 
                menu 19.408  &Cscope.查找并打开文件 :cs find f =expand("") 
                menu 19.409  &Cscope.查找函数、宏、枚举等定义的位置 :cs find g =expand("") 
                menu 19.410  &Cscope.查找包含本文件的#including文件 :cs find i =expand("") 
                menu 19.411  &Cscope.查找C语言符号 :cs find s =expand("") 
                menu 19.412  &Cscope.查找指定的字符串 :cs find t =expand("") 
        endif

endfunction

autocmd BufEnter * call Add_CScope_Menu(1)

Re: 改了一个gvim menu

发表于 : 2009-06-27 11:36
ihw
偶喜欢用快捷键
记得有一个这样的插件
Ctrl-\然后就可以用cscope了