Emacs personal configuration
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

66 líneas
2.5KB

  1. (require-package 'auto-complete)
  2. (require 'auto-complete-config)
  3. (global-auto-complete-mode t)
  4. (setq-default ac-expand-on-auto-complete nil)
  5. (setq-default ac-auto-start nil)
  6. (setq-default ac-dwim nil) ; To get pop-ups with docs even if a word is uniquely completed
  7. ;;----------------------------------------------------------------------------
  8. ;; Use Emacs' built-in TAB completion hooks to trigger AC (Emacs >= 23.2)
  9. ;;----------------------------------------------------------------------------
  10. (setq tab-always-indent 'complete) ;; use 't when auto-complete is disabled
  11. (add-to-list 'completion-styles 'initials t)
  12. ;; Stop completion-at-point from popping up completion buffers so eagerly
  13. (setq completion-cycle-threshold 5)
  14. ;; TODO: find solution for php, haskell and other modes where TAB always does something
  15. (setq c-tab-always-indent nil
  16. c-insert-tab-function 'indent-for-tab-command)
  17. ;; hook AC into completion-at-point
  18. (defun sanityinc/auto-complete-at-point ()
  19. (when (and (not (minibufferp))
  20. (fboundp 'auto-complete-mode)
  21. auto-complete-mode)
  22. (auto-complete)))
  23. (defun sanityinc/never-indent ()
  24. (set (make-local-variable 'indent-line-function) (lambda () 'noindent)))
  25. (defun set-auto-complete-as-completion-at-point-function ()
  26. (setq completion-at-point-functions
  27. (cons 'sanityinc/auto-complete-at-point
  28. (remove 'sanityinc/auto-complete-at-point completion-at-point-functions))))
  29. (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
  30. (set-default 'ac-sources
  31. '(ac-source-imenu
  32. ac-source-dictionary
  33. ac-source-words-in-buffer
  34. ac-source-words-in-same-mode-buffers
  35. ac-source-words-in-all-buffer))
  36. (dolist (mode '(magit-log-edit-mode
  37. log-edit-mode org-mode text-mode haml-mode
  38. git-commit-mode
  39. sass-mode yaml-mode csv-mode espresso-mode haskell-mode
  40. html-mode nxml-mode sh-mode smarty-mode clojure-mode
  41. lisp-mode textile-mode markdown-mode tuareg-mode
  42. js3-mode css-mode less-css-mode sql-mode
  43. sql-interactive-mode
  44. inferior-emacs-lisp-mode))
  45. (add-to-list 'ac-modes mode))
  46. ;; Exclude very large buffers from dabbrev
  47. (defun sanityinc/dabbrev-friend-buffer (other-buffer)
  48. (< (buffer-size other-buffer) (* 1 1024 1024)))
  49. (setq dabbrev-friend-buffer-function 'sanityinc/dabbrev-friend-buffer)
  50. (provide 'init-auto-complete)