mpwang / perfect-margin Goto Github PK
View Code? Open in Web Editor NEW[emacs] auto center emacs windows, work with minimap and/or linum-mode
[emacs] auto center emacs windows, work with minimap and/or linum-mode
When I enable perfect-margin-mode
, I got this warning
Package linum is deprecated
M-x info
seems not affected by perfect-margin-mode.
When perfect-margin-mode
is turned on, windows seem to be always split horizontally (i.e. into top and bottom windows).
This probably relates to the behaviour of split-window-sensibly
, so I had better suggest you override the function, like olivetti-mode
does: https://github.com/rnkn/olivetti/blob/master/olivetti.el#L382
It's shown as follows:
Is it by design, or an unexpected effect?
It may not be clear, since the example shown is in a small size, but when I full screen emacs, it'd become so apparent as the text is still too wide in the buffer. since perfect-margin doesn't work at all when treemacs is activated.
Here's the configuration:
(use-package perfect-margin
:ensure t
:init
(defcustom perfect-margin-ignore-regexps
'("^minibuf" "^[[:space:]]*\\*")
;;'("^minibuf" "^[[:space:]]*\\*" "*Treemacs*")
"List of strings to determine if window is ignored.
Each string is used as regular expression to match the window buffer name."
:group 'perfect-margin)
(defcustom perfect-margin-ignore-filters
'(window-minibuffer-p)
"List of functions to determine if window is ignored.
Each function is called with window as its sole arguemnt,
returning a non-nil value indicate to ignore the window."
:group 'perfect-margin)
:custom
(perfect-margin-visible-width 128)
:config
;; enable perfect-mode
(perfect-margin-mode t)
;; auto-center minibuffer windows
(setq perfect-margin-ignore-filters nil)
;; auto-center special windows
(setq perfect-margin-ignore-regexps nil)
;; add additinal bding on margin area
(dolist (margin '("<left-margin> " "<right-margin> "))
(global-set-key (kbd (concat margin "<mouse-1>")) 'ignore)
(global-set-key (kbd (concat margin "<mouse-3>")) 'ignore)
(dolist (multiple '("" "double-" "triple-"))
(global-set-key (kbd (concat margin "<" multiple "wheel-up>")) 'mwheel-scroll)
(global-set-key (kbd (concat margin "<" multiple "wheel-down>")) 'mwheel-scroll))))
Any ideas?
First of all, let me say that this package works very well indeed! Just what I needed for my 38" super-wide monitor. Thank you.
The only issue I have had is that if I have a single window (placed nicely in the centre of my monitor), if a new window pops up (e.g. asking for vc-log), Emacs splits the window vertically and places the new window below my current one. This is not ideal as there is plenty of room to split horizontally but Emacs doesn't know this due to the large margins.
I have solved this with some hard-coded values: I set the perfect-margin-visible-width to slightly more than half the screen/frame width and then set split-width-threshold to 1 less than that.
I am not expecting a fix to this issue as I don't think it's necessarily fixable and so I'm simply noting it here with a potential hacky solution.
Thanks again!
I'm trying to use perfect-margin with doom and when I exec evil-window-vsplit
it fails with Window too small for splitting
, but I have only one window.
I've been using this package for about a year, and it has saved my neck health in EXWM with a 32:9 display.
just discovered today that setting (setq perfect-margin-ignore-filters nil)
centers the minibuffer, and it has absolutely made my day.
you're great, and thank you for your development!
Hi, first of all, thanks for this great package. It's one of the main features of my workflow. However, after your recent updates, I started to get these errors. When I try to split window right (C-x 3
), it complains about window size and doesn't split. I use Emacs fullscreen and with perfect-margin-visible-width = 120
, so window is not actually small.
What do you think?
I don't know the internals of term well enough to explain why, but removing the fringe wrecks term-mode
. These screenshots are from running fzf in term mode. And i have added term-mode
to perfect-margin-ignore-modes
but it doesn't disable the perfect margins for those modes.
https://github.com/mpwang/perfect-margin/blob/master/perfect-margin.el#L258
Hi,
Thanks for your package. I'm always looking for this kind of center layout setup in all my editors. This one is working great, just two things:
(perfect-margin-visible-width 100)
, and even with 100 width, there is some which-key menus that get cutoff.Thanks again.
Could you add option to keep some margins when windows are split? Same for buffers that start with *. Thanks.
First of all thanks for the package, it is an improvement over olivetti mode, I'm just missing a per-buffer activation (like olivetti has). Is it possible to achieve?
Thanks in advance.
First of all, thank you @mpwang for the energy and effort spent in this package. It has become a must need for a wide monitor that I use daily!
Perfect-margin seems to not keep working when a certain sidebar window is opened. Closing that sidebar would bring back effect of perfect-margin in the main buffer.
For those of you that may wonder, why not add a general solution to support various sidebar windows but to instead open an issue for a particular specific sidebar, see issue: #17
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.