3

I have two different plugins doing different things while writing Go. Sometimes the plugin that runs the testing (vim-go) will write to the quickfix window, while the plugin that does linting (ALE) writes to the location list.

If they happen to be open and modified at the same time, I get a weird resize of the window until it takes up the whole screen.

Anyone seen anything like this before? Is there a way I can set a hard window size that cannot be changed?enter image description here

  • Maybe simply configure your plugins so that they don't trigger at the same time? Linting and testing don't need to be executed at the same time: maybe you can disable the automatic start of tests and keep only the linting or change the events which trigger their execution. – statox Nov 13 '17 at 8:53
1

Unfortunately there is no easy way to fix this at the moment, the OP has opened a vim-go issue and we agree that this is something vim-go can do better. Now we just need someone to spend time fixing it :-)

In the meanwhile, you can do some things to use ALE and vim-go simultaneously.

  1. Setting g:go_list_type = 'locationlist' will make vim-go always use the location list. It will overwrite the location list, though (so still not perfect), but it's better than having two lists.
    You can also use g:ale_set_quickfix = 1 to make ALE use the quickfix window, if you prefer.

  2. For many things, I use ALE and not vim-go, because I prefer to have the same behaviour in all filetypes:

    " No gofmt on save. We use ALE.
    let g:go_fmt_autosave = 0
    
    augroup my_go_settings
        autocmd!
    
        " Because I use ALE these commands are useless to me.
        autocmd FileType go
                    \  delc GoErrCheck | delc GoLint | delc GoVet
                    \| delc GoFmt | delc GoImports | delc GoFmtAutoSaveToggle
                    \| delc GoMetaLinter
    augroup end
    
    " Format code for me on :w
    let g:ale_fix_on_save = 1
    
    " goimports on save.
    let g:ale_fixers = {'go': ['goimports']}
    
    " Linters
    let g:ale_linters = {'go': ['gometalinter']}
    let g:ale_go_gometalinter_options = '--disable-all'
                \ . ' --enable=vet'
                \ . ' --enable=golint'
                \ . ' --enable=errcheck'
                \ . ' --enable=ineffassign'
                \ . ' --enable=goconst'
                \ . ' --enable=goimports'
                \ . ' --enable=lll --line-length=120'
                " These are slow (>2s)
                " \ . ' --enable=varcheck'
                " \ . ' --enable=interfacer'
                " \ . ' --enable=unconvert'
                " \ . ' --enable=structcheck'
                " \ . ' --enable=megacheck'
    

To be fair, vim-go's GoFmt implementation is actually better, and handles more cases. But ALE's syntax checking is better, and the fix_on_save feature works well enough (I use it daily). I plan to spend some time to improve ALE in this regard soon™.

This combination of settings doesn't cover 100% of the cases, but it does most of them, and overall it works quite well for me.

  • Thanks for your detailed response, There are no doubt some clashes between vim go and ALE but I think this specific resize issue was caused by the way that I had the windows set up. Notice how my qf and ll windows were the full width of the screen? It had something to do with the vertical NERDTree split and the full horizontal split at the bottom that was actually causing the resize – deltaskelta Nov 29 '17 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.