Skip to content

feat: add focus_preview command #675

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

Merged
merged 2 commits into from
Jan 8, 2023
Merged

feat: add focus_preview command #675

merged 2 commits into from
Jan 8, 2023

Conversation

ttytm
Copy link
Contributor

@ttytm ttytm commented Jan 2, 2023

#672

Once you are in the preview window, it would be nice to add just two extra mappings:

  • One to close the window and end preview mode
  • One to move the cursor back to neo-tree

I didn't implement such additional mappings.

  • Moving the cursor back to the neo-tree: I don't think an additional mapping is necessary as this can be done with the present :Neotree commands and with vims window movement keys (<C-w>h <C-w> and the user-defined equivalents to it) etc..

  • Close preview: I was not 100% sure about this one. But I also left it out for now, since the window can be closed with the standard commands for closing windows (i.e. :q). Users can also assign buffer local commands to close popup windows. But I can certainly see a use case for implementing this to make it specific to the preview. Please let me know what you think about how it could be implemented (Should it be another separate command to close the focused preview window?)

@codecov
Copy link

codecov bot commented Jan 2, 2023

Codecov Report

Merging #675 (8b25320) into main (d9e50c1) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #675      +/-   ##
==========================================
- Coverage   49.53%   49.52%   -0.01%     
==========================================
  Files          47       47              
  Lines        6309     6312       +3     
==========================================
+ Hits         3125     3126       +1     
- Misses       3184     3186       +2     
Impacted Files Coverage Δ
lua/neo-tree/defaults.lua 96.96% <ø> (ø)
lua/neo-tree/sources/common/commands.lua 7.50% <0.00%> (-0.03%) ⬇️
lua/neo-tree/sources/common/preview.lua 9.95% <0.00%> (-0.09%) ⬇️
lua/neo-tree/utils.lua 38.88% <0.00%> (+0.21%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@cseickel
Copy link
Contributor

cseickel commented Jan 2, 2023

I tried it out and it works well. The only question I'll raise is if gp is the best choice for the default mapping. The problem is that it conflicts with git_push in the git status source, and some people (including me) apply those git mappings as global mappings for all sources.

I personally mapped the focus_preview command to l in my config which works great for me because I actually use h j k l for window navigation. I'm probably unusual in that, but l certainly has a certain logic to it. What do you think? If not l then I would choose some other mapping that is not used in any sources.

@ttytm
Copy link
Contributor Author

ttytm commented Jan 3, 2023

For me, l is perfectly fine as the default. - Sending this from my phone. I'll push the change when I get to my workplace tomorrow 🙂👍

@cseickel cseickel merged commit d8b8c83 into nvim-neo-tree:main Jan 8, 2023
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.

2 participants