308

professional dilettante

Emacs and Vim: Useful commands

I’m just learning how to use git, and I figured I would use it to store my Aquamacs config and files online.  This will prove useful when I’m setting up a new computer, etc. So that repo is here: http://github.com/zhannes/Aquamacs-Emacs/tree/master **Caveat** For any non-emacs peeps that want to follow along, the key commands work like [...]

I’m just learning how to use git, and I figured I would use it to store my Aquamacs config and files online.  This will prove useful when I’m setting up a new computer, etc. So that repo is here: http://github.com/zhannes/Aquamacs-Emacs/tree/master

**Caveat**
For any non-emacs peeps that want to follow along, the key commands work like so

C-something

just means hold the Control key, then press the next key. Not capital C, then hypen :) E.g.

C-x C-f

means hold control, press x. Release. Now hold Control and press f. This would let you auto complete through the directories to find a file instead of using

⌘ o

and to open the OS X finder dialogue.

M-x something

means hold the Alt or Option key, then x. Release. Then you can type a command in the mini-buffer.

Some cool things I’ve begun using lately are:

Split screen editing

 ⌘ 2

(To Split the current screen / buffer horizontally.  Repeat as needed if you want more splits.  This allows you to edit multiple documents or have multiple terminals and a documents open.)

 ⌘ 1

(Removes the split, brings you back to one buffer)

C-x o

(Important! This lets you switch between the split windows, considering remapping this maybe to ⌘ `)

Emacs as a terminal
eshell seems the least janky, but any of these work for starting up a shell or terminal session without leaving the editor:

 M-x eshell

(has colors, easy switching, use up arrow to see recent commands)

 M-x terminal-emulator

(has Ctrl+r to search bash command history, but no colors)

 M-x shell

( has colors, easy to switch between windows using C-x o )

 M-x ansi-term

One not so great thing is that when using split screen mode, if you do ⌘1 to return to one screen, it hides ECB (Emacs Code Browser). So you have to do

C-c . l w

to tell emacs to hide ECB (even though it’s already hidden) then, do it once more (it hides and reveals) to get ECB back.

Some cool Vim-age
Since I am not a Vim master, split screen works best if I start with a directory listing open. That way I can get to other files and such. To get a directory listing, just do

 vim <em>directory_name</em>

to open in vim like you would any document.

 :sp

(To split the current window horizontally, into two screens. Repeat as needed)

 Ctrl w

(To switch between the split screens)

What I don’t know how to do from within Vim is things like open a new file if I don’t have a directory listing. Or how to run a shell command.  In Emacs, I have ECB open to the left which shows me directory listings and files within those directories.  And I have tabs within the editor, which I guess is similar to having terminal tabs open and having Vim and multiple screens in one of those terminal tabs :)

Leave a Reply

Required fields are marked with an asterisk (*), you may use these tags in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free

Most Recent Post

It’s been a long time, I shouldn’t have left you, part 1 …

But now I’m back.All official like.I do social stuff again.I see my friends.I’m moving into my own place again.And all that adult shit.

Categories

Content © professional dilettante
Proudly powered by WordPress
Theme designed by Artisan Themes

Entries (RSS)
Comments (RSS)

22 queries.
0.508 seconds.