Forcing gvim to open all files in the same window (using gvim with cscope)
Question
I was wondering if anyone knew of way of making gvim to default to the behavior of opening all files opened by gvim into the same gvim instance. I know there are parameters that could be sent to it by command line to force this, but I was wondering if there was something that that could be added to the .gvimrc file rather than a command line parameter.
The reason for this is that I'm using gvim with cscope. So I'm setting cscope to use gvim as my editor. However I don't know how to or its not allowed (probably the former) to force cscope to allow me to send parameters to the editor.
A solution to either problem would suffice.
Thanks in advance.
Solution
I don't think you can really do this from your .vimrc or .gvimrc. By the time that file is being read you've already started a new instance.
If you can tell cscope to use gvim --remote
instead of just gvim
as your editor then you might get the behavior you want.
OTHER TIPS
Why don't you use vim's cscope integration?
:cscope add /path/to/your/cscope.out
:cscope find s your_symbol
see :help :cscope
and :help quickfix for details.
Here are my mappings:
" F11 and F12 to go to previous/next entry
nnoremap <F11> :silent! cc<CR>:silent! cp <CR>
nnoremap <F12> :silent! cc<CR>:silent! cn <CR>
" Shifted: go to previous/next file in entries list
nnoremap <S-F11> :silent! cc<CR>:silent! cpf<CR>
nnoremap <S-F12> :silent! cc<CR>:silent! cnf<CR>
" Ctrl-F11/F12 : jump through quickfix lists history
nnoremap <C-F11> :silent! col <CR>
nnoremap <C-F12> :silent! cnew<CR>