Wednesday, September 21, 2016

Re: vim & ctags: how to jump to the definition in new window

On Wed, Sep 21, 2016 at 10:49:48AM +0800, 张正宇 wrote:
> Hello list!
>
> I am reading some source code with vim & ctags these days. You know
> sometimes people just forget those input/output parameters while
> diving into functions ...
>
> So, is there some good way to open a new window to view the
> definition after I press 'G+] ' while keep the previous file shown?

The split version of 'g ]' is 'CTRL-W g ]'. The commands versions of
those keybindings are :tselect and :stselect.

> All I want is a 'Cover Flow' style. For example, after I press 'G+]'
> in file A, a new window split up from A's to show file B. When I
> press 'G+]' again in file B, file A is hidden and replaced by B,
> while a new file C will show up in B's former window.

Here's a sample workflow. It could be made easier with some custom
commands...

" Begin with a fresh tab page while in file A

:tab split

" Split and view a definition.

CTRL-W g ]

" Now A and B are visible. From file B, jump further forward.

:only
CTRL-W g ]

" Further... (C and D become visible)

:only
CTRL-W g ]

" Now backwards! (B and C are visible again)

:only
:below split
:pop

" ...
"
" Leave the 'Cover Flow' view

:tabclose

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment