How split window to a fixed size on refresh in nvim? - neovim

If I split a window with an specific size, after writing/saving a file, the window is resized to the default proportion set by nvim.
I split :26 split
I go back to the first window
run :w
Both windows now take 50% of the viewport
How do I keep the 26height when saving?
I have read this about the option winminheight, but I am very new to this and have no idea on how to set this!
Thanks!

Related

Auto frame splitting in emacs

Certain emacs function splits the current frame, for example magit-status or compile (probably there are dozens). How emacs decides whether to do a vertical split or a horizontal one?
My experiments suggests that if the frame's width is larger then 162 chars then it dose a vertical split, and otherwise a horizontal one. Is it the right value? More important, where is this value stored, how can I change this threshold?
split-width-threshold:
Minimum width for splitting windows sensibly. Hide If this is an
integer, split-window-sensibly may split a window horizontally only
if it has at least this many columns. If this is nil,
split-window-sensibly is not allowed to split a window horizontally.
Standard value is 160 here, looks pretty close to what you've found.

How to check current emacs window position relative to other windows

I am using S-<up> and S-<down> to run (enlarge-window) and (shrink-window), respectively.
I would like these keys to be sensitive to the position of the current window relative to others. If my frame is split horizontally into two windows, and the current window is the top one, then I would like S-<up> to run (shrink-window) instead of (enlarge-window).
How do I check the position of the current window relative to the others?
See the function (window-edges). It returns a list of the window's coordinates. Just compare the y-axis value with the other visible windows.
You can use (window-tree). It will return not only the size of windows, but also their position , as a tree (in emacs' internals the windows of a frame are kept into a tree strucutre).

How to automatically set optimal frame width of Emacs?

How to automatically set optimal frame width of Emacs?
When open a file with Emacs from command line, how to let it automatically set the frame size such that
width is 2 characters wider than the widest row or the computer screen width, which ever is smaller
height is 80 rows, or the computer screen height, which ever is smaller?
You can use a find-file-hook which sets your frame's size. You'll need things like display-width and display-height, and you'll need to loop through the whole file computing the width of each line (using forward-line to move to the next line, end-of-line to go the end of the line and current-column to find the width). And you'll probably need to fiddle with off-by-one details in order to account for things like the menu-bar, the fringes, ...
Me? I prefer to declare that files should not go over 80 columns so I don't need to adjust the frame width.
This is just what libraries fit-frame.el and autofit-frame.el are for. See also http://www.emacswiki.org/FrameSize.

Increasing text size in MuPAD?

MuPAD's text output is ridiculously small for me to read, and although every time I adjust the size, it does not seem to save my preferences. Is there any way to set MuPAD's text size so that it stays as I would like it to? Thanks! btw I am on a mac.
You can adjust the font size in the preferences menu:
matlab→Preferences→Notebook→Default Formats...
You can also change the text size as shown here and switch the pagination as shown here

How do I rearrange a split pane in Emacs?

In Vim I can move a split around. For example, if my window was split in two horizontally, with the topmost split split vertically (3 splits in total) I could move the top-right split to the right to become a vertical split taking up the entire vertical space.
Is this kind of rearrangement possible?
Update: I know resizing is possible, I'm looking to move though. I get the feeling this is not supported by Emacs.
You may be interested by C-x + when you have more than 2 windows. It rearranges equally the windows on the frame. It's convenient for example when you do two C-x 2 in a row and want to have the windows to occupy the same space on the frame.
No, not by default. What you have to play with is basically C-x 0, C-x 1, etc. Look in the Emacs Wiki for extensions that may or may not do what you're looking for.
FWIW, if you are running within a GUI, then you can precisely re-arrange window sizes quickly and easily with the mouse. This isn't quite the same thing as you're asking for, but may be a handy alternative in some cases.
You can click on any non-'active' area of the mode line (such as the buffer name) and then drag it up or down.
Dragging side to side is more fiddly. You must click on the exact border between the two mode lines, and then you can drag left/right.
For your specific example, I don't believe that is supported. AFAIK you can only reorganise the window splits within their existing 'parent' window (the upper split in this example). To make the upper-right window fill the vertical space you would either remove the bottom window with C-x 0, or use C-x 1 to remove all other windows, and then re-split them in the desired manner.
(Tangentially, I've often thought a custom library to 'rotate' the window splits would be a nice thing to have.)
I believe that the window resize commands are built in to window.el, from emacswiki the functions you want documented are:
shrink-window-horizontally ; C-x {
enlarge-window-horizontally ; C-x }
enlarge-window ; C-x ^
shrink-window ; not bound on my system
The comments are what they are bound to on my system, but I don't know if I did that myself.
All of them take a prefix argument, the number of lines to enlarge/shrink. The last two default to vertical.
As far as I know you cannot create a new window that runs the length or width of the screenfrom a window already split in that direction. Buffers remain open if you close the windows though so you can remove windows and then split them in the configuration you want. Then change which buffer is displayed in the window you are standing in by pressing C-x left arrow or right arrow.
I should add that this answer is regarding "vanilla" emacs, there is probably a way of doing what the OP asks if you really want to. It's emacs after all.