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

[Feature Request] Open old buffers with modifiable off #516

Closed
Rizhiy opened this issue Jun 24, 2024 · 2 comments
Closed

[Feature Request] Open old buffers with modifiable off #516

Rizhiy opened this issue Jun 24, 2024 · 2 comments

Comments

@Rizhiy
Copy link

Rizhiy commented Jun 24, 2024

Would be great if old versions of the file were opened with modifiable off / noma.
I sometimes start typing and realise that my cursor is in the wrong window.

@Rizhiy Rizhiy changed the title Open old buffers with modifiable off [Feature Request] Open old buffers with modifiable off Jun 24, 2024
@simonmandlik
Copy link

The following config works for me:

hooks = {
    diff_buf_read = function()
        -- make "diff" buffers non-modifiable
        local fname = vim.fn.expand('%:h')
        if fname:match("diffview") then
            vim.opt_local.modifiable = false
        end
    end
}

@Rizhiy
Copy link
Author

Rizhiy commented Sep 22, 2024

@simonmandlik Thank you, that works

@Rizhiy Rizhiy closed this as completed Sep 22, 2024
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

No branches or pull requests

2 participants