Skip to content

Add toggle_show_linenumber, but got E21 #6

@ShortArrow

Description

@ShortArrow

Overview

I had forked and trying add action named toggle_show_linenumber.
But I had got error messsage E21: Cannot make changes, 'modifiable' is off.

Question

I think this is the one of way. It be toggle modifiable at before and after toggle_show_linenumber. Is this better? Or?

-- set buffer lines
local saved_view = vim.fn.winsaveview()
core.try({
function()
buffer:set_option('modifiable', true)
buffer:set_option('readonly', false)
buffer:set_lines(lines)
end,
finally = function()
buffer:set_option('modifiable', false)
buffer:set_option('readonly', true)
vim.fn.winrestview(saved_view)
end,
})

Code

https://github.com/ShortArrow/vfiler.vim/blob/20243fe163271cb62b21f369be8f6cf012d742ca/lua/vfiler/view.lua#L158-L168

Error

Attach toggle_show_linenumber to i key.
And type i then get error message, as a bellow.

E21: Cannot make changes, 'modifiable' is off

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions