code_junkie

How to accomplish equivalent of Vim's Ctrl-n in GNU Emacs

Nov 13th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. (global-set-key (kbd "M-/") 'hippie-expand)
  2.  
  3. ;; Allow tab to autocomplete
  4.  
  5. (defun indent-or-expand (arg)
  6. "Either indent according to mode, or expand the word preceding point."
  7. (interactive "*P")
  8. (if (and
  9. (or (bobp) (= ?w (char-syntax (char-before))))
  10. (or (eobp) (not (= ?w (char-syntax (char-after))))))
  11. (dabbrev-expand arg)
  12. (tab-to-tab-stop)))
  13.  
  14. (defun my-tab-fix ()
  15. (local-set-key [tab] 'indent-or-expand))
  16.  
  17. (add-hook 'as-mode-hook 'my-tab-fix)
  18. (add-hook 'java-mode-hook 'my-tab-fix)
  19. (add-hook 'c-mode-hook 'my-tab-fix)
  20. (add-hook 'sh-mode-hook 'my-tab-fix)
  21. (add-hook 'emacs-lisp-mode-hook 'my-tab-fix)
Add Comment
Please, Sign In to add comment