Skip to content

Latest commit

 

History

History
168 lines (117 loc) · 5.33 KB

File metadata and controls

168 lines (117 loc) · 5.33 KB

Welcome to Emacs

This is customized init file to remind myself of how to use Emacs and my personal customizations.

  • This file itself is in Org mode. Use C-c C-o to visit any hyperlink in this doc.
  • To edit this file, press C-x C-q to disable read-only mode.

Languages Supports

Common for Interpreters

For interpreter languages, such as Python or Ruby, here are common key bindings:

C-c !        Start the interpreter
C-c C-b      Execute buffer
C-c C-r      Execute region

For additional bindings, look at the corresponding init files in init/

Version Control System support

<f12> or M-x vc/dir will launch version control system (VCS) that matches with the current buffer. (e.g. GIT, SVN or CVS)

Global Key bindings

<f12>         launch version control system on current buffer
<f11>         toggle-case-fold-search  (ignore case)
<f10>         calc

C-c c         compile 
M-c           capitalize current word (e.g. word, Word, WORD)


C-x C-j       jump to the dired buffer 

For full list of custom key bindings, you can press C-c C-c on below find command. Then, press C-c _ to undo the result. (You need to exit read-only mode by C-x C-q first)

find . -path "./elpa" -prune -o \( -name '*.el' -a -type f \) -print | xargs grep global-set-key

Emacs features that I forgot frequently

Force inserting characters

  • C-q <tab> to insert a <tab> character.
  • C-q C-j t= insert a newline (useful when query-replace)

Tramp

ssh may not work on Darwin. I suspect it may be related to the ksh(1), or the prompt at least, but I have not had enough time to figure it out. Use sshx, which is the default tramp method.

See info:Tramp#Quick Start Guide for list of supported file name syntax.

Keyboard Macros

C-x ( to start a macro, C-x ) to end the recording, C-x e to replay. See info:Emacs#Keyboard Macros

Lisp Code in query

When you do M-x replace-regexp, you could insert \,(LISP...CODE). See also info:Emacs#Regexp Replacement for more and possible examples.

Recursive Edit

C-r to start it, C-M-c to exit, C-] to abort. See also info:Emacs#Recursive Edit

Completing read /w Helm

Emacs has various ways to read the predefine input using completion. The additional package, [Helm](https://github.com/emacs-helm/helm) also override this interface to use it’s own mechniasm.

  • To select none (to return ""), Use C-RET or M-RET.

Dired

  • 0 w copy the absulte file name into the kill ring.
  • % d flag files for deletion with the regular expression
  • % m mark files with the regular expression

Features I added/modified

remove all whitespaces

zap-to-nonspace, delete-chars-forward-with-syntax can delete one or more whitespaces starting from the point(cursor). Use C-c C-d.

launch VCS(version control system) like git, CVS, SVN, etc.

<f12> bounds to vc/dir, which is smart enough to launch corresponding Emacs feature for VCS it detects. For git(1), it uses magit.

Compile

C-c c bounds to dwim-c/compile, which try to understand the build(compile) tool name from the context.

insert License clause

To insert license clause on your text file, do M-x insert-license.

Capitalize Words

M-c, or M-x capitalize-word+ will capitalize (or de-capitalize) current word in the point.

For example, if the point is somewhere around “hello”, pressing one or more M-c will result “Hello”, “HELLO”, or “hello”.

It may use the other capitalized word if it found from other buffers. For example, if there was a word “EmaCS” available in current (or anyother) buffer, it will use it as one of candidates.

Unfill paragraph

Select the region, then pressing M-Q will change the paragraph to a single line. This is useful to create for example, Github friendly markdown text.

Shell

M-x shell will behave like a login shell.

Fonts

  • Use `M-x fontutil/set-font` to change the font family.
  • Use mouse scroll up/down to increase/decrease font size

See fontutil.el for more

Setup

Graphical display

Fonts
  • Install SourceCodePro font.
  • Install NanumGothicCoding font on your system if you need Korean font.
  • Install Symbola font on your system for symbolic fonts

To see if you have some fonts, run following elisp code. Hint. Turn off read-only this buffer (C-x C-q), evaluate the code block by C-c C-c. If you don’t see any line, no font is available. Update fontutil/default-fontconfig in fontutil.el. Make sure you undo by C-_. (Or C-c C-v k).

(fontutil/remove-unavailable fontutil/default-fontconfig t)