Vim-go: When errors found vim spitting errors "Connot make changes, 'modifiable' is off

Created on 12 Feb 2016  路  7Comments  路  Source: fatih/vim-go

With vim-go when doing save and the source code have errors which are added to 'llist' vim spitting errors Connot make changes, 'modifiable' is off.
modifiable

Most helpful comment

Hi @osleg, I had the same problem while using the editorconfig/editorconfig-vim plugin with the trim_trailing_whitespace option enabled.

This fixed it for me then:

[*.go]
indent_style = tab
insert_final_newline = false
trim_trailing_whitespace = false

Hope it helps,
Marcus

All 7 comments

Hi @osleg. Please provide a test case. A simple demo.go file with errors, and then the exact commands you input to Vim to reproduce it. Also please provide your Vim version and also which Version of vim-go you're using. Thanks

@osleg are you trying to modify the location list? You cannot do that.

@nhooyr I know :)

@fatih
That's usually happens when there is syntactic error like missing brackets like this:

package main

func main() {
    a := "asd"
    if a == "asd" {
        b := a
 }

With this case it spitting when i'm writing the buffer :w<Enter>:

"main.go" 8L, 71C written
0
Gofmt returned error
Error detected while processing function StripTrailingWhitespace:
line    6:
E21: Cannot make changes, 'modifiable' is off
Gofmt returned error
E21: Cannot make changes, 'modifiable' is off
Gofmt returned error
"main.go" 8L, 70C written
Press ENTER or type command to continue

Though after hitting "Enter" the loc list is filled anyway, but this is quite annoying :)

I don't know what StripTrailingWhitespace is doing as it's not a function inside vim-go. I don't think this is vim-go related, one of your plugins is misbehaving. I'm closing this. Thanks

Hi @osleg, I had the same problem while using the editorconfig/editorconfig-vim plugin with the trim_trailing_whitespace option enabled.

This fixed it for me then:

[*.go]
indent_style = tab
insert_final_newline = false
trim_trailing_whitespace = false

Hope it helps,
Marcus

FYI, this is related to, at least, spf-13, a workaround is available here : https://github.com/spf13/spf13-vim/issues/957#issuecomment-306510976

It seems that both vim-go and trim white list function are trying tobwrite into file while one of them (vim-go I suspect) setting modifiable to no while working.
Looks like a race condition here

Was this page helpful?
0 / 5 - 0 ratings

Related issues

surest picture surest  路  3Comments

wpaulino picture wpaulino  路  4Comments

danielmanesku picture danielmanesku  路  4Comments

johnzeng picture johnzeng  路  3Comments

svanharmelen picture svanharmelen  路  3Comments