logoalt Hacker News

Vim-pencil: Rethinking Vim as a tool for writing

136 pointsby gurjeetlast Friday at 12:35 AM45 commentsview on HN

Comments

pixelmonkeytoday at 1:21 PM

I've used vim as a prose editor in addition to a code editor for a long time.

For me, Goyo was the plugin that always matched what I wanted vim to become when I was in "prose writing mode."

https://github.com/junegunn/goyo.vim

I combine with limelight.vim:

https://github.com/junegunn/limelight.vim

This partially simulates the experience/UX of the product iA Writer on macOS or iPad, which is my favorite prose editor, but is proprietary software and doesn't work on Linux.

As others mentioned, when in prose writing mode you can also flip on a handful of vim options, I save these as hotkeys in my vimrc. For example, spell checking and line wrapping.

In case you're curious:

https://github.com/amontalenti/home/blob/master/.vimrc

show 2 replies
fleshmonadtoday at 12:16 PM

Vim is my only text editor, I use it for writing everything. Emails, scripts, messages, 100k+ lines codebases, prose, never needed this plugin. One line for 80 char wrap on certain filetypes, and a that is it, never needed such a plugin.

For prose, you can simply hard wrap at 80 (arguably you should), and vim supports this via a single config line. OOTB vim soft breaks anyway and you can navigate between in those broken lines via gj, gk etc.

Seems like bloat to me.

show 5 replies
paultopiatoday at 6:40 PM

I love this. I use various text editors mostly used by devs (moving back and forth between emacs and sublime on mac and textastic on ipad) for serious longform writing all the time, usually using markdown + pandoc, and it has a bunch of advantages and disadvantages.

IME the main advantages are (1) not having to fight with useless Microsoft word (and similar) behavior, bloat, bugs, etc. and (2) being able to mix in a spot of code as needed, for example compiling different sections together, doing a bit of text replacement and templating etc.

The main disadvantage is that the tooling isn't really there. I've done a stupid amount of yak shaving trying to get things like footnote folding in emacs, word count, etc., the spell checking is waaay behind, outline formats don't really work right (though they also don't really work right in word etc.)

So three cheers for anyone working on making the tooling problem better!!

commandersakitoday at 4:09 PM

I'm not sure if vim-pencil addresses this, but I find writing in the online typst editor to be a delight, particularly its soft-wrap mode and its auto-indent.

Even though I have a very narrow editor when you type for example:

    this is a very very long sentence
      - this is a very incredibly long sentence too
And say it is too narrow for the viewport, it will soft wrap like so:

    this is a very very
    long sentence
      - this is a very
        incredibly long
        sentence too
Even though the bulleted sentence is soft wrapped, it maintains the indent of the sentence which I find a really useful visual aid.
twobitshiftertoday at 2:27 PM

This is neat, but I think I would avoid it given the speed with which I can make edits in Vim.

One thing I’ve learned about writing prose vs. code is that you should not be quick to edit your prose and instead continue writing and finish the complete draft. This is why studies show that typewriters and pen and paper give a better creative process. I can’t foresee me looking for things like autocomplete or pure speed when trying to put thoughts to paper.

schmeicheltoday at 12:53 PM

As someone who writes academic essays and prose, I can't live without this plugin. I will constantly need to write multiple page paragraphs, and it's incredibility more convient to be able to navigate within a paragraph as if it was multiple lines, as opposed to needing to perform some horizontal motion gymnastics to get the cursor where I need it to be.

Hat's off to everyone who has worked on this plugin!

show 1 reply
dghftoday at 2:42 PM

I can't remember who suggested it, but I'm sold on the idea that if you're committing your drafts to version control, then you should break your lines at syntactic points: at the end of a short sentence, or at the ends of the component phrases of a longer sentence. This should typically lead to a cleaner and more readily comprehensible version history.

Of course, this assumes that you're writing in Markdown or ASCIIDoc or something else that will get processed into the final displayed form. But even with plain text, you could always run it through fmt or something similar.

show 3 replies
xavortmtoday at 12:48 PM

for writing - instead, it might've been more useful of a plugin if it was targeted at specific problem. Example - creative writing - if you had LSP-like feature on top that can link to characters, scenes, add scenes, find chapters, jump between content. Add character bio, traits and more and have easy "peak" as in a function signature to see details. I know it's different than what the plugin showcases, just sharing thoughts on what I find as a meaningful feature add. here, it's just as commented below, it's basically Vim.

evikstoday at 2:45 PM

> Think of them as the composable building blocks of a domain specific language for manipulating text, one that can become a powerful tool in expressing yourself.

Writers are renown for ther love of coding domain specific languages!

They'd even trade such writing fundamentals like bold in nicely looking proportional fonts for that!

show 1 reply
spankibalttoday at 2:45 PM

I'll keep using Symantec GrandView. For writing non-code, it outclasses anything mentioned so far by a considerable degree.

mmoosstoday at 5:55 PM

> You can configure the textwidth to be used in HardPencil (hard line break) mode when no textwidth is set globally, locally, or available via modeline. It defaults to 74, but you can change that value in your .vimrc

Suggestion: use 72. It's divisible by 2, 3, 4, 6, 8, 9, 12, 18, 24, and 36, simplifying tables, columns, centering, etc.

Asookatoday at 7:32 PM

Vim only works for writing if you are writing in a language that uses the latin alphabet. It's one of its bigger failings as a text editor and I have considered if it would be possible to remap everything so it uses only ctrl- and alt- key combinations for commands (those always send the equivalent ascii keycode), but in the end that sounds like a completely new editor.

show 1 reply
Finnucanetoday at 1:31 PM

Is there a way to do the equivalent of Word's 'track changes' feature in Vim/Neovim? As an editor who reviews manuscripts in Word, I want to be able to make edits, have the author review/approve them, then clean up the result into a file that goes to the typesetter. If I could do that, then a plugin like this becomes potentially more useful to our workflow.

show 2 replies
mmoosstoday at 5:48 PM

> Creates undo points on common punctuation during Insert mode, including deletion via line <C-U> and word <C-W>

When I've used Vim, the undo points frustrated me: One undo covers a much larger set of events / longer time than in other writing applications. I think it 'undoes' until the last command.

Every other program does it more granually and, once I thought about it, amazingly intuitively - I've never had to think about it. Is there a general algorithm they all use?

> soft line wrap

Also, is there a way to make Vim's soft line wrap break lines at standard points, such as between words and at hyphens? Vim seems to break lines at the line character limit, regardless of where that is in the word or sentence.

syngrog66today at 6:21 PM

solves no actual problem I have and not worth the security risk and extra complexity of a plugin by a random remote stranger