davidgranstrom / scnvim

Neovim frontend for SuperCollider.
GNU General Public License v3.0
197 stars 26 forks source link

[BUG] Error If postwindow float in not enable #204

Closed gilfuser closed 1 year ago

gilfuser commented 1 year ago

Hi there!

After reinstalling scnvim (by mistake) I can't start scnvim anymore. I ran :checkhealth scnvim and there's nothing wrong there.

If I have in the config file

...
    postwin = {
        float = {
            enabled = false,
        },
    },
...

...which I prefer, and I do :SCNVimStart in a .scd file, sclang won't start and I'll get this:

Error executing Lua callback: ...vim/site/pack/packer/start/scnvim/lua/scnvim/postwin.lua:134: Vim(mkview):E32: No file name                                     
stack traceback:
        [C]: in function 'nvim_win_set_buf'
        ...vim/site/pack/packer/start/scnvim/lua/scnvim/postwin.lua:134: in function 'open_split'
        ...vim/site/pack/packer/start/scnvim/lua/scnvim/postwin.lua:151: in function 'open'
        ...nvim/site/pack/packer/start/scnvim/lua/scnvim/sclang.lua:54: in function 'default_fn'
        ...nvim/site/pack/packer/start/scnvim/lua/scnvim/action.lua:45: in function 'on_init'
        ...nvim/site/pack/packer/start/scnvim/lua/scnvim/sclang.lua:210: in function <...nvim/site/pack/packer/start/scnvim/lua/scnvim/sclang.lua:204>

Information

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"



- Package manager
packer.nvim

If there's any other information I could give to help to find out what's happening wrong, please ask.

best regards,
Gil
davidgranstrom commented 1 year ago

@gilfuser Hi, thanks for the report!

Error executing Lua callback: ...vim/site/pack/packer/start/scnvim/lua/scnvim/postwin.lua:134: Vim(mkview):E32: No file name                                     

The error suggests that the (post window) buffer does not have a name, are you perhaps using some kind of vim session handler plugin that tries to restore previously opened windows/buffers?

gilfuser commented 1 year ago

Ah... yes I am. I had this piece of code here to make vim remember folds between sessions:

augroup remember_folds
      autocmd!
      autocmd BufWinLeave * mkview
      autocmd BufWinEnter * silent! loadview
augroup END

changing to that solved the problem:

augroup remember_folds
    autocmd!
    autocmd BufWinLeave ?* mkview | filetype detect
    autocmd BufWinEnter ?* silent loadview | filetype detect
augroup END

thank you David!

best regards