Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch to a different buffer from a terminal buffer

Tags:

emacs

emacs23

I've been using emacs for few weeks and it's been great so far - coming from vim was easier than I expected (actually - emacs' keyboard shortcuts feel more... natural).

I have added few customizations like moving between buffers using M-Left/Right/Up/Down because C-x o felt a little bit too slow when I had four files opened at once.

So far - so good :-)

One thing bugs me though:

  1. I open some splits using C-x 3 and C-x 2
  2. I open the terminal in one of them using M-x term ENT
  3. How do I switch to different split using keyboard?

Usual shortcuts obviously don't work - terminal is intercepting every emacs command, and I have to click on different buffer to activate it.

like image 687
lukaszkorecki Avatar asked Jan 31 '10 21:01

lukaszkorecki


People also ask

How do I switch between buffers in Vim?

Pressing Alt-F12 opens a window listing the buffers, and you can press Enter on a buffer name to go to that buffer. Or, press F12 (next) or Shift-F12 (previous) to cycle through the buffers.

How do I switch between NVIM and terminal?

Use ctrl-w N to switch to "terminal-normal mode", which will let you navigate around. It could be useful to then copy content to the clipboard. Then return to regular terminal mode, simply type i just like how you'd enter insert mode from a regular window. ctrl-w : will open command mode like in regular Vim.

How do I switch buffers in Emacs?

To move between the buffers, type C-x b. Emacs shows you a default buffer name. Press Enter if that's the buffer you want, or type the first few characters of the correct buffer name and press Tab. Emacs fills in the rest of the name.


2 Answers

In term-mode, any regular C-x whatever keybinding becomes C-c whatever instead.

like image 136
Josh Matthews Avatar answered Nov 08 '22 22:11

Josh Matthews


I'm not sure I understand your question. If you run M-x terminal, most of the key events are sent to the underlying terminal, so the standard C-x o binding and your M-Left are not available in the terminal.

Try using M-x shell to get a shell in one of the windows, and the navigation bindings you set up should still work.

like image 41
Trey Jackson Avatar answered Nov 08 '22 23:11

Trey Jackson