OCaml Emacs Mode (Tuareg)

advertisement
OCaml Emacs Mode (Tuareg)
Generic Emacs Bindings
MCSC-x
C-g
M-x
C-h
Meta modifier (usually Alt or Esc key)
Control modifier
Shift modifier
C-c
exit Emacs
abort current command
command call function command
b
describe all key bindings
File Manipulation
C-x
C-x
C-x
C-x
C-x
C-f
C-s
b
b TAB
k
open a new file
save current file
switch between opened files
list opened files and switch
close current file
compile
goto next error (also C-g p)
goto preivous error
Windows
C-x
C-x
C-x
C-x
C-x
C-x
C-x
5 f
5 b
5 0
1
2
3
o
open file in new frame
switch to opened file in new frame
close current frame
unsplit current window (if splitted)
split window horizontally
split window vertically
switch focus between splitted windows
Navigation
C-a
C-e
C-Home
C-End
C-Left
C-Right
C-Up
C-Down
M-g g
M-x goto-char
C-l
go to beginning of line
go to end of line
go to beginning of file
go to end of file
go backward one word
go forward one word
go backward one paragraph
go forward one paragraph
goto line number
go to position
center window on current position
Editing
C-_
C-t
C-k
M-d
C-backspace
M-u
M-l
C-d
C-num letter
Help and Completion
Search and Replace
C-s
C-r
M-x replace-string
M-x replace-regexp
M-%
C-M-%
incremental forward search
incremental backward search
replace string
replace regexp
query before replacing string
query before replacing regexp
Selection (copy and paste)
C-Space
M-w
C-w
C-y
M-y
start selecting text
copy selection
cut selection
paste selection
circulate between selections (after C-y)
Tuareg Key Bindings
Compiling
C-c C-c
C-x ‘
C-g p
c 2011 OCamlPro SAS — http://www.ocamlpro.com/
June 27, 2011 — Copyright h
TAB
[
]
i
caml-help
tuareg-complete
ocaml-open-module
ocaml-close-module
ocaml-add-path
Inserting Constructions
C-c
C-c
C-c
C-c
C-c
C-c
C-c
C-c
C-x
. b
. c
. f
. i
. l
. m
. t
. w
C-x
tuareg-insert-begin-form
tuareg-insert-class-form
tuareg-insert-for-form
tuareg-insert-if-form
tuareg-insert-let-form
tuareg-insert-match-form
tuareg-insert-try-form
tuareg-insert-while-form
Switch between mark and cursor
Using type information
Emacs Configuration
You must have
C-mouse-2
C-c C-t
unbound
Sample ˜/.emacs file
compiled your code with the -annot option.
caml-types-explore
caml-types-show-type
caml-types-show-ident
Edting
C-c C-q
C-c home
C-M-h
C-M-\
C-x n d
tuareg-indent-phrase
tuareg-move-inside-module-or-classopening
tuareg-mark-phrase
indent-region
tuareg-narrow-to-phrase
Interaction with the Toplevel
C-c C-s
C-x C-e
C-c C-e
C-M-x
C-c ‘
C-c C-b
C-c C-r
C-c C-k
tuareg-run-caml
tuareg-eval-phrase
tuareg-eval-phrase
tuareg-eval-phrase
tuareg-interactive-next-error-source
tuareg-eval-buffer
tuareg-eval-region
tuareg-kill-caml
Navigation
C-c C-a
undo last operation
permute two letters
cut end of line
cut end of word
cut beginning of word
end of word to uppercase
end of word to lowercase
delete current character
print num times letter
C-c
C-c
C-c
C-c
C-c
C-c C-down
C-M-down
C-c C-n
C-M-n
C-M-p
C-c C-up
C-c C-p
C-M-up
tuareg-find-alternate-file (switch between
.ml/.mli files)
tuareg-next-phrase
tuareg-next-phrase
tuareg-next-phrase
tuareg-next-phrase
tuareg-previous-phrase
tuareg-previous-phrase
tuareg-previous-phrase
tuareg-previous-phrase
(setq auto-mode-alist
(cons ’("\\.ml\\w?" . tuareg-mode)
auto-mode-alist))
(autoload ’tuareg-mode "tuareg"
"Major mode for editing Caml code" t)
(autoload ’camldebug "camldebug"
"Run the Caml debugger" t)
(if (and (boundp ’window-system) window-system)
(when (string-match "XEmacs" emacs-version)
(if (not (and (boundp ’mule-x-win-initted)
mule-x-win-initted))
(require ’sym-lock))
(require ’font-lock)))
(add-hook ’tuareg-mode-hook ’(lambda ()
(define-key tuareg-mode-map "\M-q"
’tuareg-indent-phrase)
(define-key tuareg-mode-map "\C-c \C-i"
’caml-types-show-ident)
(define-key tuareg-mode-map [f4] ’goto-line)
(define-key tuareg-mode-map [f5] ’compile)
(define-key tuareg-mode-map [f6] ’recompile)
(define-key tuareg-mode-map [f7] ’next-error)
(auto-fill-mode 1)
(setq tuareg-sym-lock-keywords nil)
))
(setq column-number-mode t)
(setq mouse-wheel-follow-mouse t)
(setq standard-indent 2)
(transient-mark-mode 1)
(setq visible-bell t)
(setq show-paren-face ’modeline)
(setq global-font-lock-mode t)
(setq global-auto-revert-mode t)
Download