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

fix: error when swap file is in use #243

Closed
wants to merge 1 commit into from

Conversation

NeilGirdhar
Copy link

Fixes #242

@mikesmithgh
Copy link
Owner

Hi @NeilGirdhar thank you for the PR!

I prefer not to add pass any additional arguments to nvim by default, and let the user decide if they would like to add those arguments.

I have some examples in the README.md, this is similar: https://github.com/mikesmithgh/kitty-scrollback.nvim#no-configuration

For example, you could update your kitty.conf alias:

action_alias kitty_scrollback_nvim kitten /path/to/your/install/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --nvim-args -n

Do you know what file in particular it is having errors with related to the swap file? I am not able to reproduce this locally. If you could provide the error and let me know if you have the nvim setting directory set to anything in your config?

If you don't have any setting for directory Neovim should default writing swap files to ~/.local/state/nvim/swap. You could list that directory when you see the error as well.

It looks like there is a buffer local option swapfile that can be used to disable swapfiles for specific buffers. I think that makes sense to disable for the scrollback buffer and pastewindow. That could be a fix to the issue as well if we can reproduce the problem.

@mikesmithgh mikesmithgh changed the title Fix error when swap file is in use fix: error when swap file is in use May 15, 2024
@NeilGirdhar
Copy link
Author

Thanks for taking a look!

I prefer not to add pass any additional arguments to nvim by default, and let the user decide if they would like to add those arguments.

Without this flag, you don't even get an error. Your console just freezes until you hit ctrl-C. Isn't this then something that every user of your package should do?

Do you know what file in particular it is having errors with related to the swap file? I am not able to reproduce this locally. If you could provide the error and let me know if you have the nvim setting directory set to anything in your config?

Have you tried:

  • navigating to a folder, opening nvim, and editing a file, and
  • in a separate tab, navigating to the same folder and editing the scrollback buffer?

Maybe I have a setting that auto-reloads the session? I can't seem to find such a setting though.

It looks like there is a buffer local option swapfile that can be used to disable swapfiles for specific buffers.

Awesome, how do we set that?

Also, is there a way to tell nvim not to reopen other buffers according to the saved session? That is to ignore the session?

@mikesmithgh
Copy link
Owner

mikesmithgh commented May 16, 2024

Hey @NeilGirdhar, thanks for the info. I experimented a bit and believe this is related to a session manager plugin that you may be using. Could you share what plugin you are using for session management and the config?

I don't use a session manager, so I have never encountered this issue. I tried https://github.com/rmagatti/auto-session and do see some odd results opening kitty-scrollback.nvim in a directory that has previously been opened. Sometimes it hangs, other times I get warnings related to ignoring swap files.

I'd like to see what you are using and reproduce as well.

FYI if you are using auto-session, you can disable it for kitty-scrollback.nvim in the setup with:

    require('auto-session').setup({
      auto_session_enabled = vim.env.KITTY_SCROLLBACK_NVIM ~= 'true',
    })

@NeilGirdhar
Copy link
Author

@mikesmithgh Thanks very much for looking into this, and for providing a perfect fix!

Yes, you're exactly right. I'm using auto-session. It seems like you've reproduced my exact problem, and your fix worked for me.

@mikesmithgh
Copy link
Owner

@mikesmithgh Thanks very much for looking into this, and for providing a perfect fix!

Yes, you're exactly right. I'm using auto-session. It seems like you've reproduced my exact problem, and your fix worked for me.

Awesome!

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.

Bug: scrollback editing freezes when used with with auto-session
2 participants