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

Make the behavior of window splits consistent #1035

Merged
merged 7 commits into from
Sep 24, 2019

Conversation

PhilRunninger
Copy link
Member

@PhilRunninger PhilRunninger commented Sep 9, 2019

Description of Changes

Closes #941
This PR addresses changes requested for #941, and expands on the work started there.

Closes #327
This PR forces NERDTree to respect the user's values for the splitright and splitbelow settings, and the g:NERDTreeWinPos variable. This changes the current behavior of the splits opened by NERDTree, so this will be a new MAJOR release - 6.0.0. The changes are as follows:

  1. The window to be split will always be the previous window. This could be the one where :NERDTree (or :NERDTreeFocus or :NERDTreeToggle) was invoked. Or maybe a window command (such as 10<C-W>h) was used to jump directly to the NERDTree window. When in doubt, you can use the <C-W>p command to jump between the previous and current windows.
  2. The g:NERDTreeWinPos variable will always be respected. This pertains to a NERDTree created when g:NERDTreeHijackNetrw is 1, and Vim is invoked with a directory, as in vim .. When splitting the window multiple times in this scenario, NERDTree will stay full-height on the desired side of the screen.
  3. The vim setting splitright will be be respected. When performing a vertical split (s or gs), the previous window will be split to the right (splitright) or left (nosplitright) as directed by the user's setting.
  4. The vim setting splitbelow will be be respected. When performing a horizontal split (i or gi), the previous window will be split above (nosplitbelow) or below (splitbelow) as directed by the user's setting.

These changes bring consistency to the NERDTree split commands, which previously had worked differently for vertical vs horizontal splitting.


New Version Info

  • Derive a new version number. Increment the:
    • MAJOR version when you make incompatible API changes
    • MINOR version when you add functionality in a backwards-compatible manner
    • PATCH version when you make backwards-compatible bug fixes
  • Update CHANGELOG.md, following the established pattern.
  • Tag the merge commit, e.g. git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags

@PhilRunninger PhilRunninger changed the title Make behavior of window splits consistent Make the behavior of window splits consistent Sep 9, 2019
@PhilRunninger
Copy link
Member Author

@lifecrisis , would you have some time to look at this? It's not a huge change to the codebase, but it is a somewhat radical departure in terms of functionality. To test it, open vim both ways: both with a directory name argument, and without.

  1. Once inside NERDTree, open several files, splitting both vertically and horizontally.
  2. Go to a specific window you want to split, then open or focus NERDTree, and split-open a file.
  3. In each case, see if the right window was split correctly.

There's not a big rush on this; I'll be exercising this branch over the coming days to see if anything shakes loose. I just would like another pair of eyes on it.

@PhilRunninger PhilRunninger marked this pull request as ready for review September 16, 2019 04:20
@PhilRunninger PhilRunninger merged commit bd744ea into master Sep 24, 2019
@PhilRunninger PhilRunninger deleted the dragonxlwang-master branch September 24, 2019 05:19
PhilRunninger pushed a commit that referenced this pull request Sep 26, 2019
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

Successfully merging this pull request may close these issues.

Opening files by default to the right split?
1 participant