Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR - FollowLink in horizontal split #223

Closed
lyndhurst opened this issue Apr 28, 2022 · 10 comments
Closed

FR - FollowLink in horizontal split #223

lyndhurst opened this issue Apr 28, 2022 · 10 comments

Comments

@lyndhurst
Copy link

I am sorry if I missed something in the help, but I cannot find a command to follow a link in a horizontal split, only in a vertical one. I personally want to use vertical splits most of the time, but sometimes, I would find it useful to have more notes / windows open and visible.

Thank you for your time, and this cool plugin.

@lervag
Copy link
Owner

lervag commented Apr 28, 2022

Thanks for the suggestion. I fully agree. In fact, I think it could be possible to simplify and make a single command that takes a modifier to allow splitting. I'll look into it!

lervag added a commit that referenced this issue Apr 29, 2022
@lervag
Copy link
Owner

lervag commented Apr 29, 2022

Ok, so, I changed the default to a normal :split and you can now use modifiers for the command. Example:

:WikiLinkFollowSplit                  " follow in regular split
:vertical WikiLinkFollowSplit         " follow in vertical split
:topleft vertical WikiLinkFollowSplit " follow in vertical split on left side

I hope this matches your requested feature!

@lervag lervag closed this as completed Apr 29, 2022
@lyndhurst
Copy link
Author

Sorry I did not check my email for a couple of days.

Thank you very much for handling it so quickly, I will check it out tomorrow when I get back to my notes. 👍

@lervag
Copy link
Owner

lervag commented Apr 30, 2022

My pleasure; let me know if you have other suggestion/issues!

@lyndhurst
Copy link
Author

Hi, I tried your update, and modified my config accordingly, and everything works fine, as expected.

I do not think it is worth reopening an issue, but I believe it is worth mentioning. The only small down side I find about the implementation you went with, is that there is no <plug> command available for vertical splits. So I cannot use the g:wiki_mappings_local dictionary to set my :vert WikiLinkFollowSplit keyboard shortcut along with my other custom mappings.

I personally set up an autocmd group, and it is working fine, but that makes the config look a bit less coherent. Do not get me wrong, it does not bother me at all, and I really appreciate the enhancement you added as is, I just thought sharing this observation could be useful to you.

It is also possible that I am mistaken, in which case, I would gladly learn how to make it work using the g:wiki_mappings_local variable.

Either way, thank you again for your time.

@lervag
Copy link
Owner

lervag commented May 2, 2022

Ah, good point. I believe it is worth adding a new mapping for this and have both a normal split and a vertical split. Both can use the same command.

lervag added a commit that referenced this issue May 2, 2022
@lervag
Copy link
Owner

lervag commented May 2, 2022

I pushed an update for this. One thing: what would be considered good defaults mappings here? I've kept <c-w><cr> for the regular split, and I now pushed <c-w><tab> for vertical split. But in a way, <c-w><tab> might be a better choice for following with a new tab? Do you have any thoughts?

@lyndhurst
Copy link
Author

To be honest, I am myself still experimenting to settle on a key mapping for the new FollowLink horizontal split command.

To me, tab might rather be intuitively associated with wiki-link-prev or wiki-link-next, and I agree that it might be a little confusing for a vertical split. Maybe using another leader like <C-L> (for link, or f for follow) might open possibilities to more vim-like variations like s, v, and t. I personally use <C-L> for loclist mappings and that is easy to make them feel natural for a vim user.

I personally use <leader><Cr> and <leader><leader>Cr respectively for v-split, and split, and I am yet to set one for the open in new tab command. Overall, I do not use the vim tabs feature enough (yet).

I am sorry I could not be of more help, and, I will let you know if I get a stronger opinion on that matter. In the meantime, thank you again for adding yet another enhancement so quickly.

@lervag
Copy link
Owner

lervag commented May 3, 2022

Ok, thanks for sharing your thoughts. I think the most important thing is that one can disable all the default mappings and/or change any of them with relatively simple customization. Thus, we don't really need optimal defaults. I might change the defaults if I can decide on something I think is "objectively" better, but in the meantime, I'm happy with the current version.

@lyndhurst
Copy link
Author

I totally agree, optimal defaults are very subjective anyway. You offer sane defaults, and the freedom to modify them easily with an exhaustive documentation, I believe this is all that is needed to make any other vim user happy as well. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants