How to Split Screen Emacs and Terminal - linux

everyone.
I use PuTTY and I am wondering if it's possible to open an emacs text file in split screen with the terminal window.
I looked everywhere for the answer, but all I've found is how to have two emacs windows open, and I would like to be able to see and switch between the terminal window and an emacs file.
Thanks.

You could use the region feature in screen rather than using the split screen within emacs... but then you might want to rebind the escape key in screen.

Related

Using console as tab

I have several cpp source files in tabs in vim. I would like to have another tab with command prompt in order to run make. I open net tab , run sh and now I have console. But how to move from this console to other tabs? If I press ctrl+page up I have garbage in console and no tab change. How to move to another text tab when staying in console tab?
As I said, vim 8 or neovim both have an terminal emulator in it.
Since you are using vim 7 here are some other ways:
Tmux as #wizzup mentioned is perfect for this use-case. I think it is the most used Terminal-Multiplexer and extremly mighty. It is complex in comparison but since you are using vim, a steep learning curve should not be a killer point. However there are a few cavehats but you will find thousands of articles to solve them.
GNU Screen is an alternative to tmux, I have no experience with it, but should be usable pretty good with vim too.
With them you can use something like this Plugin which allows you to use the terminal in vim itself. However I haven't tested it but it seems to be rather groomed.

IntelliJ terminal cursor shape

So, I am obsessed with Vim. I use vi mode everywhere - in all the editors and IDEs that support it. I use it it my browser (vimium, wasavi). I use 'hjkl' navigation everywhere thanks to awesome Karabiner. I use vi mode in my terminal via iTerm under zsh. Long time ago I found this little trick that changes cursor shape in the terminal depending of what mode you're currently in.
Now, although it perfectly works for iTerm, sadly it doesn't work in OS X's builtin terminal. I couldn't care less about that, except it also doesn't work in my favorite WebStorm. I thought I could trick it and instead of changing cursor's shape I could try tweaking its color. Still didn't work.
Please guys, help me to find a way to tweak cursor in IDEA's Terminal.
Thanks!
p.s.: Some may suggest to change the prompt depending the mode, but honestly I don't like that. I still believe there's a way to change cursor shape or color. Prob. just need to find the right escape sequence.
Unfortunately it looks like Intellij terminal draws it's own cursor without respect to bash or zsh settings.
Note I'm assuming community and pro editions of Intellij use the same terminal plugin
You can see the Terminal plugin source here
The terminal plugin uses Jediterm, a Java based terminal emulator written by JetBrains
Most of the drawing of the terminal window is handled in TerminalPanel.java and has a nested class called TerminalCursor
From the TerminalCursor class you can see that Java Graphics is used to draw boxes for regular cursors and blinking cursors.
Code that draws a rectangle for the cursor
I'm still not sure how the unfocused cursor is drawn since it's just an outline, and I can't find a handler for lost focus on the frame.
You can change the terminal cursor shape from the dialogue below:
Now, this is a lot prettier to work with:

gnu screen not to change my window titles

I set meaningful names to new windows I create in gnu screen, but then when I 'cd' or open vim that name gets changed to 'pwd' for instance. Is there a way to prevent screen from changing the title? I know there's a setting like that in tmux, but for some reason vim scrolls really slow in tmux with multiple vertical splits, so I had to abandon it (tmux). Ideas appreciated!
Add the following line to your .screenrc if you are using the latest version:
defdynamictitle off

Focus follow mouse in vim

I am aware that the mousefocus option is only supposed to work in gVim. But I was wondering, if it's possible to have the console Vim switch to different windows in response to mouse clicks, would it be not possible to easily add following mouse movement to it, too?
I'm an xmonad user, I love the focus following the pointer feature, I do a lot of pdf viewing and browsing while writing in Vim, and I'd be so much happier if I didn't have to keep mentally switching back and forth between two different types of focus changing.
If that's completely not possible, I guess opening new Vim windows (as with :split) in new instances of the terminal is no easier to do?
It would not be at all simple to add this. Using the mouse within the terminal works by vim sending control codes to the terminal requesting that mouse actions be sent as part of the input stream. Terminals only report clicks not changes in the pointer position, so vim has no way of knowing where the mouse is.
With major changes it would likely be possible for a vim with X support to get pointer activity directly from the X server, but that would likely be reported by pixel rather than by character so further work would need to be done before it could determine which vim window is currently under the pointer.
set mouse=a
should do the trick but it will probably depend on your terminal emulator. See :help 'mouse'.
This works for Windows 7/Cygwin 32bit mintty/vim 7.3: (I DO NOT use gvim!)
Having installed this: http://ehiti.de/katmouse/, I can scroll the window under my cursor without having to have clicked to select a window, click-selecting of single vim-windows works, too. It does not pull the vim window to the foreground, if another window overlaps it, if that is what you desire. Still it can be scrolled without click-selecting it first.
So:
Check if there exists a software paket for your distribution, that implements your desired mouse behavior on the OS level. When this works for my self-compiled vim in cygwin, it might very well work with console vim on linux, too.
This post here serves as evidence, that it is possible at all, that is the reason this was not made a comment. When I am on linux again I will investigate this further and update this post, but that might take a while.
On set mouse=a: The vim help states you a need a terminal capable of handling mouse inputs, further information can be found here. :help ttymouse might also be helpful, i.e. if you have a xterm-compliant console, but :help term is set to something else.
UPDATE: (Freshly installed Fedora 19 with packages, no self-compiled stuff.)
Fedora 19 + se mouse=a = scrolling in single console vim window with several buffers opened next to each other independently works, too. Window manager used is LXDE.

Creating a ctrl+tab keybinding in PuTTY

I'd like to be able to map the vim commands :tabnext and :tabprev to CTRL+TAB and CTRL+SHIFT+TAB respectively. Unfortunately, I seem to be running into the problem where PuTTY eats these character combinations.
I've tried searching for information, but to no avail. I'm pretty sure this is a PuTTY thing but there doesn't seem to be any sort of help/reference area for the application.
I am curious if anyone here has any experience or suggestions for figuring this out.
#rmeador: try mapping the key combo within vim.
I have attempted to do this, but it doesn't appear like vim is getting the combo. I'm not certain if this is related to the term settings or an issue with PuTTY.
PuTTY doesn't send anything when you press Ctrl+Tab.
You can patch PuTTY as it is described here: Using Ctrl+Tab in GNU Screen over PuTTY
I believe that at this time, using Ctrl+Tab is not possible with PuTTY, because PuTTY does not allow you to configure specific translations for keys. Here is a decent article that shows how you would set this up if PuTTY did support this feature:
http://www.staldal.nu/tech/2009/01/10/how-to-use-ctrl-tab-in-gnu-screen/
If you use (or would consider using) a hotkey/macro program like Autohotkey, you could emulate this behavior yourself. For example, this Autohotkey config script would do exactly what you want:
#IfWinActive PuTTY
^Tab::Send :tabnext
^+Tab::Send :tabprev
#IfWinActive
(Note that this example is just looking for any window title starting with PuTTY, so you'd have to adjust based on your title configuration.)

Resources