Open madskjeldgaard opened 5 years ago
Yes, this is possible. The post window actually have its own filetype
called scnvim
. So you could make this happen by:
1) Creating an autocmd in you vimrc/init.vim autocmd FileType scnvim setlocal wrap
2) Create a file in your runtimepath (usually .config/nvim
) nvim/after/ftplugin/scnvim.vim
and add your settings in that file e.g. setlocal wrap
This is also something that we should add to the scnvim (vim) documentation. Maybe we could have a "FAQ" section in the docs?
Sounds perfect. I'll try your idea out – it looks like the stuff!
Okay I tried 1 and it worked perfectly!
Reopening this, as I can't seem to make it work any longer. At some point in the not too distant past, none of the two proposed solutions take any effect. Could there be some runtime voodoo that has changed at some point in the last few months? I have tried both of the above strategies, and none of them work. The output of
:verbose setlocal wrap?
is
nowrap
Last set from ~/.local/share/nvim/site/pack/packer/start/scnvim/ftplugin/scnvim.vim line 5
Edit: I'm on nvim 0.5
OK, it seems this might be connected with packer
and how this loads stuff. If I follow the lead of @madskjeldgaard and do this:
use {
'davidgranstrom/scnvim',
config = function()
vim.cmd[[autocmd filetype scnvim setlocal wrap]]
end,
}
things work as they should.
This approach seems no longer to work. Can't quite pinpoint when it stopped working...
This seems to be an issue again
@kflak @madskjeldgaard Got a chance to take a look at this just now. I've found the reason, but I don't have a clear solution just yet. The bug was introduced when I added the on_open
action to the post window, the action will be applied after the autocmd is triggered so in effect it will overwrite the value of setlocal wrap
in the autocmd. I need some more time to investigate, but you can use the built-in actions as a work around for now:
require('scnvim.postwin').on_open:append(function()
vim.opt_local.wrap = true
end)
Works beautifully! Thanks for the (albeit temporary) fix.
Text in the post window goes beyond the window, making it a bit hard to read, without resizing. This is a common problem in the SCIDE as well. It would be nice if there was a way to make this text wrap automatically according to screen size. Maybe this is already possible via som nvim magic that I didn't notice? I dunno, otherwise it's an idea for a feature!