Have you ever needed to copy text from neovim and paste it in slack, discord, maybe a reddit post, on a google doc word document or any other app, but when you paste it, the formatting is all wrong so you have to manually edit the pasted text?
If that's your case, this video will show you the solution
This usually happens when you enable autoformat for your markdown files in neovim using prettier, When text reaches this limit, it automatically wraps to the next line.
I set the option vim.opt.textwidth = 80, this WILL NOT auto wrap existing lines, or if you paste a long line into a file it will not wrap it as well
But prettier on the other hand, can autoformat existing lines over 80 characters and also long lines that you paste that exceed the 80 characters, this is achieved using the following option proseWrap: "always"
When you have prosewrap enabled, prettier will automatically insert LF (Line Feed) or newline characters at the end of each line once the printWidth: 80 is reached
So I created a keymap that yanks that text to a temporary file, then runs the yanked markdown with the prettier --prose-wrap never --write command on that file, this command is going to remove all those LF characters, and after doing that, it will copy the contents of that file back to the system clipboard, so that you can paste it in slack, google docks, discord or your browser
If you find this video helpful and want to support me
https://ko-fi.com/linkarzu
Follow me on twitter
https://x.com/link_arzu
My dotfiles
https://github.com/linkarzu/dotfiles-...
0:00 - demo paste without newlines
2:35 - daily note
3:27 - keymap configuration
6:20 - prettier install
6:51 - my markdown workflow
7:12 - configure slack for markdown
8:26 - wezterm