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

[Bug]: FocusToggle don't enable the plugin when called for the first time in a nvim instance #34

Closed
younger-1 opened this issue Sep 11, 2021 · 3 comments
Labels
good first issue Good for newcomers

Comments

@younger-1
Copy link

younger-1 commented Sep 11, 2021

Problem:

After I started nvim with two windows in a tab, I called :FocusToggle and no window resized. If I I call :FocusToggle second time, it works. If I call :FocusEnable at the begining, it works too.

Expeced behavior

Calling :FocusToggle for the first time will resize windows

This is my focus config and mapping.

{
    "beauwilliams/focus.nvim",
    cmd = { "FocusToggle" },
}
nnoremap <leader>kz <cmd>FocusToggle<cr>
@beauwilliams
Copy link
Collaborator

beauwilliams commented Sep 11, 2021

Problem:

After I started nvim with two windows in a tab, I called :FocusToggle and no window resized. If I I call :FocusToggle second time, it works. If I call :FocusEnable at the begining, it works too.

Expeced behavior

Calling :FocusToggle for the first time will resize windows

This is my focus config and mapping.

{
    "beauwilliams/focus.nvim",
    cmd = { "FocusToggle" },
}
nnoremap <leader>kz <cmd>FocusToggle<cr>

You should not be using FocusToggle with lazy loading for now.

At the moment focus is loaded by default.

So when you load focus, and issue the command FocusToggle at the same time

What you are saying is load focus, and then toggle it off.

Instead I suggest using FocusEnable as your lazy load command

Once you lazy load, all the rest of the focus commands are loaded anyways

The only way to fix this is not to load focus by default, for now at least.

Perhaps there is another way. But for now the only way would be if I disabled focus by default

@younger-1
Copy link
Author

So when you load focus, and issue the command FocusToggle at the same time

What you are saying is load focus, and then toggle it off.

Instead I suggest using FocusEnable as your lazy load command

Once you lazy load, all the rest of the focus commands are loaded anyways

The only way to fix this is not to load focus by default, for now at least.

Perhaps there is another way. But for now the only way would be if I disabled focus by default

Thanks you. It is a workaround for me.

@beauwilliams
Copy link
Collaborator

I will try and think of a way to deal with this edge case but for now I will close it and add a note in the readme

beauwilliams added a commit that referenced this issue Sep 11, 2021
@beauwilliams beauwilliams added the good first issue Good for newcomers label Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants