Emacs Through Putty - windows

So I opened emacs through putty by executing the command "emacs -nw FILENAME", where emacs opens up with the desired file. I split the screen in emacs in order to open different file by executing the command "C-x 2" in emacs to split the window horizontally so that I can view two windows at a time.
My question is, now that I can view both files next to each other through the split screen, how do I edit the other file? (I can't use the mouse to click on the other file (other split window) to edit it because I can only use key commands when using emacs through putty)

You might want to try the Emacs tutorial which will explain those things. Also, I believe it is possible to get mouse clicks to work under putty: try M-x xterm-mouse-mode.

Use C-x o, other-window.
See http://www.gnu.org/software/emacs/manual/html_node/emacs/Other-Window.html.

Another tip to use the other window as a terminal is to run:
M-x term

Related

Automatic meaningful titles for GNOME Terminal tabs

(related: Identify gnome-terminal window by tab title)
When I open several tabs in GNOME Terminal (Version 3.44.0 for GNOME 42) on my Ubuntu 22.04, all tabs have the uninformative title "Terminal". I want them to be automatically titled:
the current working directory if it's in shell prompt (e.g. /home/user123/Downloads)
the name of the open process (e.g. vim ~/.bashrc) in case there is an open process.
How can I achieve that? I use bash, but I can switch to zsh if necessary.
From another thread somewhere on the internet:
function termtitle()
{
printf "\033]0;$*\007";
}
I put this in my .bashrc right above my PS1Update(). Then I call it in PS1Update, right after I update the prompt. I call it with a string constructed from some env flags, username, hostname, pwd. You can put almost anything. I throw in $0. I did try using $PS1, but I use color and I think the printf in termtitle() trips over the escape sequences. So I build another string with the same info but w/o color.
Every time the prompt is updated, so it the terminal window/tab title, like if I change dir, ssh to another machine.
Hope this helps!

Disable cmd+k when using Vim in terminal?

So when I'm using Vim in the mac osx terminal I accidentally enter the command cmd+k that clears my terminal because I'm used to the motion, this makes me have to exit vim and enter again. I want to know if theres a way to disable this.
For example this is me editing my .vimrc
Then I enter the command and my terminal looks like this:
Is there a way to disable this command when using Vim only? I want to continue using it when using the terminal outside Vim. Thanks
Instead of restarting vim use CTRL-L to redraw the screen.

How do I change the cursor in emacs for cygwin?

I've looked multiple times online and can't find how to change the cursor type in emacs for cygwin on Windows. I'm trying to get it to the block cursor instead of the thin line which I can never tell which window I'm in. I've seen stuff about editing the .emacs file or the emacs init file but where do I find this if I use cygwin on windows? Any help would be great.
Editing your init file or customizing that variable will only work in a GUI version of emacs.
In this case, Cygwin (and the shell in which it is running) ultimately determines how the cursor looks. You should be able to change the cursor type by:
Right-click on the window title bar > Options > Looks > Cursor
My options are:
Line
Block
Underscore
With an option for Blinking
You should be able to do M-x customize-variable cursor-type and pick something better -- either a thicker bar or a block cursor (my favourite).
The default location for your .emacs file should be ~/.emacs.d/init.el interpreting "~" in the same way that cygwin does.
In general, I'd suggesting using the native windows version of Emacs rather than the cygwin one.

open a file in an emacs buffer while in emacs terminal

Suppose I am in terminal in Emacs (M-x term), and I list the following files in current directory:
text_code.R
Now I am in bash-3.2$ (terminal) and hope to open this .R file in another Emacs buffer and then edit. Is there a way to do it? This might be a trivial question, for I am a newbie to Linux and Emacs. Thanks in advance!
Remember that in Term Mode you can type C-c C-f to open a file (just like C-x C-f outside Term Mode). The prompt will already be on your current directory, so you just have to start typing the name of the file and autocomplete it with TAB.
I don't know the official procedure for what you want to do, but here is a procedure that works:
Either tell emacs to run as a daemon (Ref: EmacsAsDaemon) or in emacs start daemon via M-x server-start.
In the term, a command like emacsclient -n filename will start editing the specified file in the current window. Note, emacsclient also has a -c, --create-frame option to edit in a new frame. You probably will want to use a -n option as above, so you can continue using your term, after selecting it from the buffers list in another pane or frame.
If you start the daemon via M-x server-start in emacs, the daemon will terminate when you exit from emacs. If you set it up via reference mentioned above, use kill-emacs or save-buffers-kill-emacs commands or shell command emacsclient -e '(kill-emacs)' to stop it, as mentioned in part 6 of reference.

emacsclient dialog on Windows

I'm using EmacsW32 from http://www.emacswiki.org/emacs/EmacsW32. EmacsClient works great - opening a file with it always uses an existing emacs. However, starting emacs for the first time opens a dialog with the text "Waiting for emacs server to start...", which is very annoying. Is there any way to suppress this dialog, or at least automatically dismiss it when it connects?
[EDIT] The issue is starting emacsclientw for the first time pops up this dialog, which connects to emacs-server, but then does not close. I'm looking for a way to make this dialog close once it connects, or not show up in the first place. It this possible at all?
Try an -a switch. -a is used to set a fall-back editor. In Windows you can't run emacs with --daemon flag, so if you run emacsclient like emacsclient -a emacs (given it is in your PATH) and you've set up emacs-server, then the first run of the emacsclient will start emacs server and all subsequent runs will use that server.
Not sure if there's been an update, or if I'm just impatient, but it appears as if the dialog closes itself, after a few seconds delay.

Resources