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

Add <mods> support for opening new window #776

Merged
merged 2 commits into from
Apr 19, 2020
Merged

Add <mods> support for opening new window #776

merged 2 commits into from
Apr 19, 2020

Conversation

thinca
Copy link
Contributor

@thinca thinca commented Mar 31, 2020

This is an another approach of #763.
First, I don't think this is completely better than #763. This is just a suggestion. I don't care which one you choose.

What this PR changes

:LspDeclaration, :LspDefinition, :LspImplementation and :LspTypeDefinition now accept <mods> commands.
<mods> is combinations of following Ex commands:
:aboveleft, :belowright, :botright, :browse, :confirm, :hide, :keepalt, :keepjumps, :keepmarks, :keeppatterns, :leftabove, :lockmarks, :noswapfile :rightbelow, :silent, :tab, :topleft, :verbose, :vertical

When no <mods> is specified, do not open a new window (same as before).

Example of usage:

:leftabove LspDefinition Splits horizontally and opens a window to the above.
:rightbelow vertical LspDefinition Splits vertically and opens a window to the right.
:tab LspDefinition Opens a window to the new tabpage.

Pros

  • Using native Vim features.
  • Various combinations.
  • Argument of Ex commands is not used. Leaves scalability for the future.

Cons

  • There is no :horizontal mod command. We cannot specify "just spliit horizontal".
    • To this, use :belowright or :leftabove, or specify other mod that not related to splitting like :silent(hacking way).
  • Some people may find it not intuitive. (What do you think?)

thinca added 2 commits March 31, 2020 21:41
Supported commands:
- :LspDeclaration
- :LspDefinition
- :LspTypeDefinition
- :LspImplementation
@prabirshrestha
Copy link
Owner

Merged. Thanks.

agrinh pushed a commit to agrinh/vim-lsp that referenced this pull request Apr 22, 2020
PR prabirshrestha#776 negated the original condition for opening definitions in new
splits. I believe that was not the intentional behavior.

This simply reverts that condition to avoid opening goto's from
unmodified buffers in new splits.
@thinca thinca deleted the add-mods-support branch May 8, 2020 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants