Hacker News new | past | comments | ask | show | jobs | submit login
Vimroom (mikewest.org)
167 points by drKarl on Oct 8, 2011 | hide | past | web | favorite | 38 comments

I wrote an xmonad layout manager that will make any application work like this:


It looks something like:


Awesome! I'll be using this. Have you submitted it for contrib?

Could you please upload it to vim.org for posterity? http://www.vim.org/scripts/index.php

This'll get mirrored to the vimscripts github account and then let us install it via the Vundle vim package manager.

Thanks for the cool plugin!

I'll take a look at getting it up to vim.org. Thanks for your interest!

I'm not the author, just found it interesting and wanted to share with the community :)

Woops. Pardon me.

you can install it with vundle anyway:

Bundle "mikewest/vimroom"

Nice! I recently started using Vim for prose and was mentally writing (in preparation for actually writing) a plugin that would do just this. I couldn't think of any better way to do it either, other than what you've done, setting up splits to the left and right. You've added some stuff that I hadn't thought of that makes it even nicer.

This is something else I use:

  function TextEdit()
    set spell
    set formatoptions=1
    set linebreak
    set wrap
    set nolist
    nnoremap j gj
    nnoremap k gk
    vnoremap j gj
    vnoremap k gk
    set guifont=Monaco:h16
  if has('autocmd')
    au BufRead,BufNewFile *.txt call TextEdit()
    au BufRead,BufNewFile *.markdown call TextEdit()
It gets paragraphs wrapping at words and and lets you move up and down by visual lines rather than actual lines. The last bit applies the settings automatically when opening a .txt or .markdown file. It looks like your plugin already does this, but maybe it would be useful for someone who wants a partial solution.

If you just want full-screen, it's ":set fullscreen" on MacVim, or ":set fu" for short.


:set nofu to get back

My pet peeve with vim is the :set paste, :set nopaste things why not have :set paste false....

You can also do

    :set fu!
    :set paste!
Instead of nofu or nopaste.

Learn something new everyday. Thanks, shazow!

I also don't like this, although it's no big deal, and it happens with a few other settings (e.g., 'number'). One way around it is to forget about using the 'set' command entirely and to assign all settings using the setting variable directly. Every setting has a corresponding variable that can be accessed by prefixing with &, so to set paste off you can just do ':let &paste=0'.

cmd + return is the shortcut for fullscreen on MVim too.

Funny, I wrote a plugin earlier this year and came up with the exact same name. I never had time to polish and release it, but if you're interested, here's the source on GitHub:


The feature sets are different, from what I can tell.

Found the same thing on emacs: https://bitbucket.org/phromo/darkroom-mode/

I can never focus on something long enough that this would become important.

I didn't know I wanted something like this so much.

What kind of visual distractions does Vimroom hide with the background color setting?

I must admit, having text centered like that is intriguing. I'm going to give this a try.

I wrote a color scheme/plugin to do something similar a while back (I think it's darkroom.vim on vim.org). Never really developed it fully. Ratings indicate people were underwhelmed :) Looks like this guy may have given the idea a much better treatment.

Instead of using splits you could set a large foldcolumn combined with word wrapping. Unless you are actually using folding it will result in a large area of blank space on the left of the window.

Doesn't really work for me, but there is already an issue on GitHub for this. However, I don't really see the added value if you are using MacVim in the first place.

The big advantage over MacVim is that Vimroom works from the terminal, anywhere. I can use the plugin no matter which machine I'm logged into, which is pretty valuable to me.

I fixed the only issue that was on the project before today (errors when mapping keys that were already mapped), and pushed a v0.7. I hope that fixes the issue you experienced.

What I do is split the window vertically (C-w v), and resize the left window so that the text in the right window is centered on the screen.

How does this stand up when there are split windows? Is this mostly for single window/terminal use?

It appears to be implemented using split windows, so the results if you try and use split windows normally are somewhat surprising.

(It also doesn't work well with my settings as it shows a statusbar on some of these split windows acting as padding, so the effect is ruined slightly.)

It is implemented using splits, so you're right: if you're already using split windows then your results will be a bit off. :)

Regarding your settings, would you mind filing a bug report with some detail? I'm happy to try to fix things if there's a bug: https://github.com/mikewest/vimroom/issues

The article mentions the same is possible in MacVim, but not how to do it. Any pointers?

In vimrc:

    if has('gui_macvim')
      set fuoptions=background:Normal
Screenshot: http://i.imgur.com/HeWkK.png

Also curious about this. Entering fullscreen used to do it correctly, but in the latest MacVim the document spans 100%, even if you have "Prefer native fullscreen support" unchecked.

Snapshot 61 added maxhorz and maxvert to fullscreen options by default. You have to set fuoptions yourself if you want something different. See my other comment for what I do.

How does this compare to just having a desktop devoted to a single instance of vim?

love this. I've been crafting my blog articles in vim lately as well and this will definitely make that a more pleasant experience.

Sumblime Text 2 has exactly this, very neat.

vertical split with three windows, adjust their size to control the margins, and set the border to the same color as the background. Put these commands on your .vimrc. Should work too.

Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact