Refactor initfiles

This commit is contained in:
Henrik Lissner 2014-07-21 03:52:01 -04:00
parent d5f2bb1d23
commit 223e9843b6
11 changed files with 96 additions and 84 deletions

View file

@ -1,57 +1,39 @@
(require-packages
'(auto-complete ; self-explanity
auto-complete-config ; its default config
fuzzy ; fuzzy search engine for auto-complete
;; fuzzy ; fuzzy search engine for auto-complete
))
;;;; Auto-completion ;;;;;;;;;;;;;;
;; (setq ac-auto-show-menu nil ; Suggestions box must be invoked manually (see core-keymaps.el)
;; ac-use-menu-map t ; Enable ac-menu-map map when menu is open
;; ac-us-quick-help nil ; Don't show tooltips unless invoked (see core-keymaps.el)
;; ac-fuzzy-cursor-color nil)
;; Keep auto-complete quiet until it's needed (see core-keymaps.el)
(setq ac-auto-start nil)
(ac-config-default)
(ac-linum-workaround) ; Fix line number flux bug
(ac-flyspell-workaround) ; Compatibility with flyspell/make
(diminish 'auto-complete-mode) ; Hide mode-line entry
(define-key ac-completing-map [return] nil)
;; Use more vim-like keymappings
(evil-define-key 'insert ac-mode-map (kbd "C-SPC") 'auto-complete)
(evil-define-key 'insert ac-mode-map (kbd "C-S-SPC") 'auto-fuzzy-complete)
(define-key ac-completing-map (kbd "<tab>") 'ac-next)
(define-key ac-completing-map (kbd "S-<tab>") 'ac-previous)
(define-key ac-completing-map (kbd "<F1>") 'ac-quick-help)
(define-key ac-completing-map [return] 'ac-complete)
(define-key ac-completing-map (kbd "ESC") 'ac-stop)
(add-hook 'prog-mode-hook 'enable-path-completion)
(setq ac-auto-show-menu nil ; Suggestions box must be invoked manually (see core-keymaps.el)
ac-use-menu-map t ; Enable ac-menu-map map when menu is open
ac-us-quick-help nil ; Don't show tooltips unless invoked (see core-keymaps.el)
ac-fuzzy-cursor-color nil)
(defun enable-path-completion ()
(add-to-list 'ac-sources 'ac-source-filename)
(add-to-list 'ac-sources 'ac-source-files-in-current-dir))
(add-to-list 'ac-sources 'ac-source-filename)
(add-to-list 'ac-sources 'ac-source-files-in-current-dir))
;; Tell ido not to care about case
(setq completion-ignore-case t)
;;; Filters ido-matches setting acronynm matches in front of the results
(defadvice ido-set-matches-1 (after ido-smex-acronym-matches activate)
(if (and (fboundp 'smex-already-running) (smex-already-running)
(> (length ido-text) 1))
(let ((regex (concat "^" (mapconcat 'char-to-string ido-text "[^-]*-")))
(acronym-matches (list))
(remove-regexes '("-menu-")))
;; Creating the list of the results to be set as first
(dolist (item items)
(if (string-match (concat regex "[^-]*$") item) ;; strict match
(add-to-list 'acronym-matches item)
(if (string-match regex item) ;; appending relaxed match
(add-to-list 'acronym-matches item t))))
;; Filtering ad-return-value
(dolist (to_remove remove-regexes)
(setq ad-return-value
(delete-if (lambda (item)
(string-match to_remove item))
ad-return-value)))
;; Creating resulting list
(setq ad-return-value
(append acronym-matches
ad-return-value))
(delete-dups ad-return-value)
(reverse ad-return-value))))
;;
(provide 'mod-ac)

View file

@ -3,18 +3,20 @@
flyspell ; spell checker
))
;;;#flyspell
(diminish 'flyspell-mode " ?")
(setq ispell-program-name "aspell")
(setq ispell-list-command "--list")
(setq flycheck-indication-mode 'right-fringe)
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))
(add-hook 'after-init-hook (lambda() (global-flycheck-mode 1)))
(dolist (hook '(markdown-mode-hook git-commit-mode-hook org-mode-hook))
(add-hook hook (lambda() (flyspell-mode 1))))
;;;#flycheck
;; Removed checks on idle/change for snappiness
(setq flycheck-check-syntax-automatically '(save new-line mode-enabled))
(setq flycheck-indication-mode 'right-fringe)
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))
(global-flycheck-mode 1)
;;
(provide 'mod-fly)

View file

@ -15,9 +15,13 @@
(require-package 'yasnippet)
;;;#yasnippet
(yas-global-mode t)
;; (yas-global-mode t)
(associate-mode 'snippet-mode '("emacs.+/snippets/") t)
(diminish 'yas-minor-mode)
(add-hook 'prog-mode-hook
'(lambda ()
(yas-minor-mode)
(diminish 'yas-minor-mode " @")
))
;;
(provide 'mod-snippets)