20090622 Vimm4

1,122 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,122
On SlideShare
0
From Embeds
0
Number of Embeds
340
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

20090622 Vimm4

  1. 1. (add-hook 'find-file-hooks (lambda () (cond (view-mode) (t (view-mode)))))
  2. 2. (defun toggle-view-mode () (interactive) (cond (view-mode (view-mode nil) (setq hl-line-mode nil)) (t (view-mode)))) (define-key global-map "C-xC-j" 'toggle-view-mode) (define-key global-map "C-x j" 'toggle-view-mode) (define-key global-map [C-backspace] 'toggle-view-mode)
  3. 3. (setq view-read-only t) (defvar pager-keybind `( ;; vi-like ("h" . backward-word) ("l" . forward-word) ("j" . next-line) ("k" . previous-line) ("J" . next-window-line) ("K" . previous-window-line) ("b" . scroll-down) ("f" . scroll-up) (" " . scroll-up) ("w" . forward-word) ("e" . backward-word) ("n" . ,(lambda () (interactive) (scroll-up 1))) ("p" . ,(lambda () (interactive) (scroll-down 1))) ("[" . forward-sexp) ("]" . backward-sexp) ("." anything-c-moccur-occur-by-moccur) ("c" . scroll-other-window-down) ("v" . scroll-other-window))) (defun define-many-keys (keymap key-table &optional includes) (let (key cmd) (dolist (key-cmd key-table) (setq key (car key-cmd) cmd (cdr key-cmd)) (if (or (not includes) (member key includes)) (define-key keymap key cmd))))keymap)
  4. 4. (key-chord-define-global "jk" 'toggle-view-mode)
  5. 5. (define-key global-map "C-xC-w" 'save-buffer) (define-key global-map "C-x w" 'write-file) (global-set-key "C-M-xC-w" 'save-buffer) nmap <C-W><C-W> :w<CR> nmap <C-X><C-W> :w!<CR>

×