I've created two windows in Ruby using curses, which look something like this:
------------------------
| |
| Window 1 |
| |
| |
------------------------
------------------------
| Window 2 |
------------------------
Window 2 is static. Window 1 will have be filled with text. Currently, if the text gets to the bottom line, the next word is appended to the bottom line, rather than going on the next line. How do I make one of the following options possible:
(a) Window 1 grows is new lines are needed
(b) Window one has an 'overflow-y' feature, like in css.
I've tried having Curses.stdscr.scrollok enabled, and each time I get to the bottom of the window using window1.scroll, but neither achieve what I'm looking for.
Looking at the C library for curses, I've figured this out. Thought I'd post the answer in case anyone else needs it!
Overflow-y
You need to have two things set:
Curses.stdscr.scrollok true
window.scrollok(true)
When you get to the last line, it'll just keep appending to the current line. To solve this, I added:
if (window.cury + 1) == window.maxy
window.addstr("\n")
end
Scrollable window
window.scroll() # scrolls up one line
window.scrl(-1) # scrolls down one line
Related
I don't remember changing autocomplete but recently it started doing a pop-up style that looks sort of like this:
┌--------------------------------------------------┐
| Press t̲a̲b̲ or c̲l̲i̲c̲k̲ to insert, e̲n̲t̲e̲r̲ to execute |
| clear |
| cat /proc/sys/fs |
| cfoo |
| cbar |
└--------------------------------------------------┘
user#MACBOOK /usr/local/bin % c▯
How do I change it back to autocomplete that shows inline with the prompt?
I was not aware that Termius -- the terminal app that I use on my MacBook -- had added an autocomplete function. In the upper right corner, next to the "share session" button was a button labeled "au". I clicked on that button and it had an option to disable autocomplete.
That's what I get for not reading update release notes. In my defense, Termius rolls out new releases too often. In the past six months (at the time I'm writing this) Termius has had twenty-one releases. That's almost a release every week.
If an Emacs frame is split in several windows and a new buffer is opened, is there a possibility to tell Emacs in which window to open the buffer.
Especially, if one window contains a dired buffer and I want to tell Emacs in which of the other opened windows a new file shall be displayed.
If the Emacs frame is for example split like this:
____________________
| | |
| | |
| A | B |
| | |
| | |
--------------------
| | |
| C | D |
| | |
--------------------
Where A,B,C and D are the windows. If A contains a dired buffer, can I tell Emacs to open a new file in a new buffer in window D?
Here's another answer --
You can do what you want using Icicles. In Icicle mode, C-x o, which is normally other-window, is icicle-other-window-or-frame. A prefix arg gives it several alternative behaviors, one of which (for Emacs 24 and later) is to choose a window that will be used by the next buffer-displaying operation (e.g., C-x C-f, C-x b).
That's what happens if you use a double plain prefix arg: C-u C-u C-x o. That invokes command icicle-choose-window-for-buffer-display, which you could of course also bind to any other key.
You choose the target window by name (using completion or cycling etc.).
All that command does is set variable icicle-next-window-for-display-buffer to the window that you choose. Icicles advises commands display-buffer, switch-to-buffer, and switch-to-buffer-other-window so that the next time they are called they use the window that is the value of icicle-next-window-for-display-buffer. (After that invocation they return to their normal behavior.)
This means too that if you have another method of choosing a window, which you prefer (e.g. cycling using one of the other methods mentioned here), then you could modify that method to set icicle-next-window-for-display-buffer to the chosen window, to get the same effect (in Icicle mode). IOW, it does matter how you choose the window; just set the variable value to it and the next buffer-displaying action will use it.
Others will probably give you answers that more directly respond to your question. My answer is to just move the focus to the window you want and then use C-x C-f or whatever to open the file or display the buffer you want in that selected window.
In order to do what you requested directly, you need anyway to use a key sequence that invokes the command you want. And if you want something general that works with different commands (e.g. find-file and switch-to-buffer) then you need to use a prefix key or repurpose the prefix arg. That is typically just as many key strokes as it is to switch to the window and then use the usual command.
Of course, with my suggestion you need a command to quickly switch to the window you want. There are various commands out there that let you cycle among windows or use completion to quickly pick a window by name or number.
So that's what I would suggest: switch to the window and then display whatever you want there, instead of trying to combine (a) designating the target window with (b) invoking the command that displays the buffer. IOW, just do it the old-school way: go to the window and then display there.
Of course, if you don't really want to end up in that newly displayed buffer, and you just want to keep the focus where you started, then with my suggestion you would need to cycle (e.g.) back to your starting window. It's not clear from your description whether this is your use case. If it is, then my solution is probably not that helpful.
But even in that case, it might still be useful to split things up: (a) a command to (only) designate the window to use for the following display-buffer command and (b) the display-buffer command. IOW, do essentially the same thing I suggested, but the first step would only designate the target window instead of switching to it, and the second step would use that designated window. (You would need to define (a) and (b), as a general mechanism.)
In this case too my suggestion differs probably from what others might suggest, in that it does not try to combine window choice with display command. They are coupled sequentially, but not combined in one command.
make the window that you would like to load the buffer in, activated and press:
C-x b
and you will be prompted by:
Switch to buffer (default *Buffer List*):
press enter(ret) without writing anything to choose the default. and then you will find buffer list loaded in that window. then choose the one you like to load and you will find it loaded in the same window.
Normally I can open two Editor panes in Xcode: one for the .h and one for the .m as counterpart. But presently I need to open four panes. So I click on the upper-right + sign. But this cause the splits to happen on the right pane so that I have one left pane and three right panes stacked vertically. How might I move the panes around so that one pane shows in each quadrant? This very easy to do in eclipse. I imagine Xcode can do it too.
Here is what I want
_______________________
| | |
| .h | .m |
|__________|__________|
| | |
| .h | .m |
|__________|__________|
You imagine wrong. Xcode can't do that. (The problem is partly that Xcode has no notion of equivalent panes. You always have one "real" editor and everything else is an "assistant" to it.)
Your best bet is to use separate tabs (or windows). These can be configured differently, though in your case I think you just want two tabs configured the same way (assistant on right).
I'm using Sublime Text 3. I have a layout with a screen-height column on the left and three panes on the right (see figure below). This setup is great (especially with the Golden Ratio plugin), but I still miss one feature I had in vim. I had a hotkey that caused the pane that had focus to take up the entire window, like entering full-screen mode for that one file. When done, you could enter the hotkey again to revert to your previous layout. It's as if the original layout of the panes is saved, and the focused pane temporarily takes over the whole window, and when you're done editing the file full-screen, the program remembers how things were laid out and reverts to that. Here's an ASCII-art example:
BEFORE AFTER
---------------------------- ----------------------------
| | | | |
| | | | |
| |-------------| | |
| | | | |
| | | | |
| |-------------| | |
| | | | |
| | | | |
---------------------------- ----------------------------
By typing a hotkey, you switch from BEFORE to AFTER; typing the same hotkey again reverts you to BEFORE, with the same layout and the same tabs in each pane.
Is there a way to do this in Sublime Text 3, including a plugin that might enable this? If the reader knows how to write Sublime plugins, how hard do you imagine writing such a plugin would be? I would guess it wouldn't be too bad: a matter of stashing state somewhere and programatically telling Sublime to revert to that when switching back from full-screen mode.
I know this is a year on, but the MaxPane plugin solves this problem.
https://github.com/jisaacks/MaxPane
Install through package manager, and then use Command Shift Enter to toggle a pane between full screen and within whichever layout you are using.
You may try using Origami, it helps organising layouts, it doesn't have what you want, but it has a Zoom functionality, here's a quote from the author:
Additionally, Origami allows one to zoom the current pane, making it
take up a large portion of the window. As above, first press super+k,
then press:
super+z: Zoom the current pane so it takes up 90% of the screen (the
fraction is changeable in the keybindings) shift+super+z: Unzoom:
equally space all panes (Note: Windows and Linux use ctrl instead of
super.)
There's no way to do what you want currently, though you may try writing a plugin yourself
You could also chose 1, a single panel default switcher: ALT+SHIFT+1-3
https://superuser.com/questions/368785/switch-between-columns-active-tabs-in-sublime-text-2/424987#424987
I use a wide screen and like to code in 16:9. So sometimes there is a string.Format... or whatever the is larger than the old 4:3 screen format. But VS does not want to use the avaiable space and just always makes a line break at about 50% of the visible line.
Where can I adjust the automatic line break to the wider screen?
btw I am using ReSharper (5.1).
example:
I think this is ReSharper's doing. In ReSharper | Options | Languages | C# | Formatting style | Line Breaks and Wrapping, under Line wrapping there is an entry Right margin (columns) - adjust this upwards to match the width you want ReSharper to wrap to.
I don't believe VS on its own will reflow text.
Note that there is a VS option to display wrapped text (Edit | Advanced | Word Wrap), but as can be seen from the line numbers when this is turned on, that doesn't actually change the text.