Problem: Tag jump currently only works with horizontal splits, not vertical splits.
Solution: Add support for vertical splits using wincmd [ or ]
Most modern desktop monitors are quite large. With only horizontal splits, screen space isn’t fully utilized. Vertical splits could be more useful.
https://github.com/vim/vim/pull/18845
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This seems a bit inconsistent. There are several different CTRL-W commands for tag jump with horizontal split, but you only added one command for vertical split here.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I also wonder if this should be controlled by the 'switchbuf' option instead. But it seems that this isn't what 'switchbuf' is meant for...
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@glepnir pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
aha okkk added g[
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Can we add an option to make all commands(:tag :tjump :help etc) that do horizontal split become vertical?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Can we add an option to make all commands(:tag :tjump :help etc) that do horizontal split become vertical?
A very long time ago, I wrote the splitvertical patch that would allow this. But I am not sure a general option is the best way. As a user I think I prefer having the full power of whether vim will split vertical or horinzontally, without having to toggle such an option all the time.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
But I am not sure a general option is the best way. As a user I think I prefer having the full power of whether vim will split vertical or horinzontally, without having to toggle such an option all the time.
Now most commands split horizontally unless user prefix it with :vert[ical]. If the option is on, they split vertically unless :hor[izontal] is provided.
In this way, user still has full power controlling how to split.
Most modern desktop monitors are quite large. With only horizontal splits, screen space isn’t fully utilized. Vertical splits could be more useful.
I agree with this. For most of the time I use vertical split, so it would be nice if this is the default behavior, without prefixing :vert. And I already have a keymap to do what this PR does.
nnoremap <silent>'] <cmd>execute $"vertical ptjump {expand('<cword>')}"<BAR>wincmd =<CR>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I also wonder if this should be controlled by the 'switchbuf' option instead. But it seems that this isn't what 'switchbuf' is meant for...
switchbuf applies to :stag commands, which is basically a way to split the window horizontally and open the tag window. So isn't this PR basically the same as :stag <C-R><C-W> when :set switchbuf+=vsplit ? Hm, no that currently does not work (I also do not see any test about vsplit). @yegappan I suppose this only applies to quickfix commands?
So how about then nnoremap <C-W>[ :vert :stag <C-R><C-W>? Do we really need this built-in?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra commented on this pull request.
> @@ -880,6 +880,17 @@ the buffer. The result is that all buffers will use the 'encoding' encoding Does ":tag[!] [tagname]" and splits the window for the found tag. See also |:tag|. +CTRL-W [ *CTRL-W_[* + Vertical split current window in two. Use identifier under + cursor as a tag and jump to it in the new upper window.
Copy paste error? Should be like this instead?
⬇️ Suggested change- cursor as a tag and jump to it in the new upper window. + cursor as a tag and jump to it in the new window to the right.
> @@ -880,6 +880,17 @@ the buffer. The result is that all buffers will use the 'encoding' encoding Does ":tag[!] [tagname]" and splits the window for the found tag. See also |:tag|. +CTRL-W [ *CTRL-W_[* + Vertical split current window in two. Use identifier under⬇️ Suggested change
- Vertical split current window in two. Use identifier under + Like |CTRL-W_]|, but vertical split current window in two. Use identifier under
> @@ -880,6 +880,17 @@ the buffer. The result is that all buffers will use the 'encoding' encoding Does ":tag[!] [tagname]" and splits the window for the found tag. See also |:tag|. +CTRL-W [ *CTRL-W_[* + Vertical split current window in two. Use identifier under + cursor as a tag and jump to it in the new upper window. + In Visual mode uses the Visually selected text as a tag. + Make new window N high. + *CTRL-W_g[* +CTRL-W g [ Vertical split current window in two. Use identifier under + cursor as a tag and perform ":tselect" on it in the new upper⬇️ Suggested change
- cursor as a tag and perform ":tselect" on it in the new upper + cursor as a tag and perform ":tselect" on it in the new window to the right.
In src/testdir/test_tagjump.vim:
> @@ -1670,4 +1670,34 @@ func Test_tag_excmd_with_number_vim9script() bwipe! endfunc +func Test_tag_jump_split()
there is no test for wincmd g[
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@glepnir commented on this pull request.
> @@ -880,6 +880,17 @@ the buffer. The result is that all buffers will use the 'encoding' encoding Does ":tag[!] [tagname]" and splits the window for the found tag. See also |:tag|. +CTRL-W [ *CTRL-W_[* + Vertical split current window in two. Use identifier under + cursor as a tag and jump to it in the new upper window.
oh right . but right or left depend on splitright
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@glepnir commented on this pull request.
In src/testdir/test_tagjump.vim:
> @@ -1670,4 +1670,34 @@ func Test_tag_excmd_with_number_vim9script() bwipe! endfunc +func Test_tag_jump_split()
also added more cases for wincmd (g)]
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I suspect it’s mainly for historical reasons. Early desktop monitors were very small, and an 80-column text width was the common recommendation. In that era, horizontal splits for tag jumps made more sense. But modern desktop displays are much larger. Since we already have a built-in horizontal split, providing a built-in vertical split tag jump becomes meaningful as well, because the two would form a natural pair 🤔
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I also wonder if this should be controlled by the 'switchbuf' option instead. But it seems that this isn't what 'switchbuf' is meant for...
switchbuf applies to
:stagcommands, which is basically a way to split the window horizontally and open the tag window. So isn't this PR basically the same as:stag <C-R><C-W>when:set switchbuf+=vsplit? Hm, no that currently does not work (I also do not see any test aboutvsplit). @yegappan I suppose this only applies to quickfix commands?
The 'switchbuf' option is used when splitting the window to edit a buffer and by the quickfix commands.
I will look into why this is not working with 'vsplit' when jumping to a tag later.
Regards,
Yegappan
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
So how about then nnoremap [ :vert :stag ? Do we really need this built-in?
It doesn’t seem to work. And g] / g[ can integrate with cstag and tselect. Since we already have Ctrl-W (g)], provide Ctrl-W (g)[ as a built-in feature would be better. It adds no mental overhead for users.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()