Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Wrap text in post window #29

Open
madskjeldgaard opened this issue May 11, 2019 · 10 comments
Open

[FR] Wrap text in post window #29

madskjeldgaard opened this issue May 11, 2019 · 10 comments

Comments

@madskjeldgaard
Copy link
Contributor

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!

@madskjeldgaard madskjeldgaard added the bug Something isn't working label May 11, 2019
@davidgranstrom
Copy link
Owner

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

@davidgranstrom davidgranstrom removed the bug Something isn't working label May 12, 2019
@davidgranstrom
Copy link
Owner

This is also something that we should add to the scnvim (vim) documentation. Maybe we could have a "FAQ" section in the docs?

@madskjeldgaard
Copy link
Contributor Author

Sounds perfect. I'll try your idea out – it looks like the stuff!

@madskjeldgaard
Copy link
Contributor Author

Okay I tried 1 and it worked perfectly!

@kflak
Copy link
Contributor

kflak commented Nov 26, 2021

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

@kflak
Copy link
Contributor

kflak commented Nov 27, 2021

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.

@kflak
Copy link
Contributor

kflak commented Jul 22, 2022

This approach seems no longer to work. Can't quite pinpoint when it stopped working...

@madskjeldgaard
Copy link
Contributor Author

This seems to be an issue again

@davidgranstrom
Copy link
Owner

@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)

@kflak
Copy link
Contributor

kflak commented Aug 3, 2022

Works beautifully! Thanks for the (albeit temporary) fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants