1. Define Variables
Vim:
Run a = 123
Emacs:
(Setq a' 123)
2. define functions
Vim:
Function Fun () // if the scope limit is not used, the first letter must be capitalized.
Endfunction
Command Line call: command! -Nargs = 1 Gdb :! Command "<args>"
Emacs:
(Defun fun ()
"Message"
(Interactive)
.....
)
3. Execute Functions
Vim:
Call function ()
Emacs:
(Fun)
4. conditional statements
Vim:
If c
Elseif B
Else e
Endif
While
Endwhile
Emacs:
(If
'Thenfun
'Elsefun)
(While (equal a B)
Body...
(Counter ))
(Cond
(First ...)
(Second ...))
5. Automatic Execution
Vim:
Autocmd BuffRead *. cpp: call fun
Emacs:
(Add-hook 'C ++-mode-hook' (lambda ()
(Interactive)
.....))
6. Reference other files
Vim:
Source name. vim
. Name. vim
Emacs:
(Require 'name); you must add (provied 'name) at the end of the file)
(Load "name. el ")
7. Bind a shortcut key
Vim:
Nmap <silent> <F8>: call fun () <CR>
Imap <F9>: call fun () <CR>
Vmap <F10>: call fun () <CR>
Emacs:
(Global-set-key [f8] 'fun)
(Define-key c ++-mode-map (kdb "C-\") 'fun)