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

Distraction free mode/centered buffer in Spacemacs? #247

Closed
ghost opened this issue Dec 11, 2014 · 26 comments
Closed

Distraction free mode/centered buffer in Spacemacs? #247

ghost opened this issue Dec 11, 2014 · 26 comments
Labels
- Forum - Feature request Fixed in develop stale marked as a stale issue/pr (usually by a bot)

Comments

@ghost
Copy link

ghost commented Dec 11, 2014

I usually try to make my emacs as beautiful and noiseless as possible, think Sublime text in the distraction free mode or something like emacs strip-tease.

When I try to emulate this with the following function in Spacemacs, I am only half successful:

  ;; Added to .spacemacs in the dotspacemacs/config section.
  (defun my-resize-margins ()
  (let ((margin-size (/ (- (frame-width) 160) 2)))
    (set-window-margins nil margin-size margin-size)))

  (add-hook 'window-configuration-change-hook #'my-resize-margins)
  (my-resize-margins)

The problem (apart from the ugly edges around the buffer) is that when pressing space the menu looks all weird:

screen shot 2014-12-11 at 07 41 30 3
screen shot 2014-12-11 at 07 42 04 3

I hereby suggest a distraction-free mode in Spacemacs.

I will post updates here if I find workarounds for the problems above, but my elisp skills and understanding of emacs is pretty limited ATM.

@syl20bnr
Copy link
Owner

This can be a cool mode to add. Since it is a distraction free mode guide-key should be disabled so the issues with the guide-key buffer will just disappear.
I'm sure that we can find a package that does all the necessary steps to get the result you have. I would prefer such a package over a function because it can be maintained outside of spacemacs.

@herbertjones
Copy link
Contributor

On my big monitor, bzg-big-fringe-mode works like this (SPC w M). On my laptop, bzg-big-fringe-mode doesn't do anything when I enable it. Perhaps it will work for you if your screen is big enough.

@syl20bnr
Copy link
Owner

Oh I forgot about this, I though it was not in spacemacs anymore. I think it works only if there are at least two windows on screen. Thank you @herbertjones for pointing this out.

@ghost
Copy link
Author

ghost commented Dec 12, 2014

Okay, to get bzg to look pretty one needs to do the following:

  1. Turn of the tildes (~) that show "unused line" (a vim-feature, not emacs). These are in the wrong position.

  2. Turn off the guide key menus. Like I show in picture 2 above, they do not work

  3. Make the fringe color the same as the background color. I did not find a way to do this programatically (i.e. fringe_color = background color), I had to manually find the background color value and set the fringe color to the same value. The problem with the latter is that the old fringe color remains when changing themes.

Here is what bzg-spacemacs looks like to me without any of the three modifications I describe above:

spacemacs

@ghost
Copy link
Author

ghost commented Dec 12, 2014

To set the fringes and take care of the tildes, use this code in your dotspacemacs/init (do not set them in the dotspacemacs/config, because then they will look wrong while loading):

(set-face-attribute 'fringe nil :background "#3F3F3F" :foreground "#3F3F3F")

To find the correct color, look up the theme you are using on github and start testing colors. In my case it was https://github.com/bbatsov/zenburn-emacs/blob/master/zenburn-theme.el

You should probably look for the :background color that is in a line similar to this:

(default ((t (:foreground ,zenburn-fg :background ,zenburn-bg))))

@ghost
Copy link
Author

ghost commented Dec 12, 2014

I still have trouble with the vertical leader key menu that pops up (see the second picture from the top), so 2) remains.

Is there a way of turning off the vertical menus (the ones that pop up when using space or g)? It would be nice if these could be made horizontal...

@ghost
Copy link
Author

ghost commented Dec 12, 2014

Hallelujah, to turn off the menus add the following to your dotspacemacs/config in .spacemacs:

(guide-key-mode -1)

Q1) Is this stuff that could be made into a simple contrib layer or is it too trifling? Would need some way to fix the colors, but that should be simple to hardcode for the supported themes.

@ghost ghost closed this as completed Dec 12, 2014
@ghost ghost reopened this Dec 12, 2014
@syl20bnr
Copy link
Owner

I think it could be something to have in spacemacs layer directly. A good distraction free mode is a pretty useful feature.

@syl20bnr
Copy link
Owner

@endrebak do you have some news on this ? Do you think you can contribute a layer for a distraction free mode ? Even if it has rough edges it could be a good starting point to let others hack on it. When the contrib is mature we will be able to put it into spacemacs layer.

@ghost
Copy link
Author

ghost commented Dec 24, 2014

I have made it work for me with the settings above. Since spacemacs has bzg-big-fringe-mode included the only thing you need to do is turn off the guide-key mode and choose a theme with the same background and fringe color such as Monokai. I doubt such a simple thing is worth its own layer; it might be more of an .spacemacs init-file thing.

@jezeniel
Copy link

@endrebak 👍 on this, and I agree with @syl20bnr.

@kini
Copy link
Contributor

kini commented Mar 25, 2015

Possibly related: #481

@nixmaniack
Copy link
Contributor

As of current state, you can achieve almost distraction free mode with SPC w M and SPC t m t which maximizes and centeres buffer, and hides the modeline.

@cocodrino
Copy link

Hi guys, I'm getting this error everytime than I try SPC w M

jump-to-register: Register doesn't contain a buffer position or configuration

what could be the reason?...I'm trying to get a distraction free mode

thanks

@StreakyCobra
Copy link
Contributor

PR Pending: #4262

@arronmabrey
Copy link
Contributor

I have a silly question. does this mode work in the terminal version or only gui? I have tried enabling it in the terminal, and I see no change. Except the message that it's now "enabled"

@xerron
Copy link

xerron commented Oct 26, 2016

I like the features of this plugin Vim:
https://github.com/junegunn/goyo.vim

@sebhahn
Copy link
Contributor

sebhahn commented Mar 1, 2017

What is the latest status on the distraction free mode?

@JAremko JAremko mentioned this issue Mar 28, 2017
32 tasks
@nothingmuch
Copy link

writeroom-mode seems to work nicely out of the box.

@sebhahn
Copy link
Contributor

sebhahn commented May 14, 2017

@nothingmuch How can I add it to my spacemacs config?

@nothingmuch
Copy link

I just did package-install writeroom-mode for now, but I will probably add to my dotspacemacs-additional-packages.

There's also focus-mode, I haven't tried that one yet.

@JAremko
Copy link
Collaborator

JAremko commented Jul 4, 2017

I added something like distraction free mode. Try SPC w C with develop branch 😉

@justinmoon
Copy link

This is a relevant issue: #9488

@adimit
Copy link

adimit commented Jan 26, 2018

I must say, I prefer writeroom-mode to the current SPC w C feature. It is nicer for writing prose, as it center-justifies the text, and really hides every distraction.

auto-fill-mode needs to be activated for together with writeroom-mode, as the latter has a maximum width of stuff it displays.

@freddie-freeloader
Copy link
Contributor

I agree with @adimit. Also writeroom-mode seems to handle bigger font-sizes better.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Forum - Feature request Fixed in develop stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests