Refactor initfiles
This commit is contained in:
parent
d5f2bb1d23
commit
223e9843b6
11 changed files with 96 additions and 84 deletions
|
@ -55,7 +55,6 @@
|
||||||
|
|
||||||
(eval-when-compile (require 'cl))
|
(eval-when-compile (require 'cl))
|
||||||
|
|
||||||
(provide 'ruby-mode-indent-fix)
|
|
||||||
(require 'autopair)
|
(require 'autopair)
|
||||||
|
|
||||||
|
|
||||||
|
@ -194,5 +193,6 @@ Note that all params line up after the function.
|
||||||
;; (t
|
;; (t
|
||||||
;; ad-do-it))))
|
;; ad-do-it))))
|
||||||
|
|
||||||
|
(provide 'ruby-mode-indent-fix)
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;; ruby-mode-indent-fix.el ends here
|
;;; ruby-mode-indent-fix.el ends here
|
||||||
|
|
4
init.el
4
init.el
|
@ -11,8 +11,8 @@
|
||||||
(cd "~") ; Default directory, instead of /
|
(cd "~") ; Default directory, instead of /
|
||||||
;; (setq debug-on-error t)
|
;; (setq debug-on-error t)
|
||||||
|
|
||||||
(server-mode t)
|
;; (server-mode t)
|
||||||
(unless (server-running-p) (server-start))
|
;; (unless (server-running-p) (server-start))
|
||||||
|
|
||||||
;; Global vars
|
;; Global vars
|
||||||
(defvar my-dir (file-name-directory load-file-name))
|
(defvar my-dir (file-name-directory load-file-name))
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
key-chord ; for mapping key chords in insert mode
|
key-chord ; for mapping key chords in insert mode
|
||||||
multiple-cursors ; cursors, of the numerous variety
|
multiple-cursors ; cursors, of the numerous variety
|
||||||
ediff
|
ediff
|
||||||
|
deferred
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
(gmap (kbd "<C-escape>") 'open-scratch-buffer)
|
(gmap (kbd "<C-escape>") 'open-scratch-buffer)
|
||||||
(gmap (kbd "M-x") 'smex)
|
(gmap (kbd "M-x") 'smex)
|
||||||
(gmap (kbd "M-X") 'smex-major-mode-commands)
|
(gmap (kbd "M-X") 'smex-major-mode-commands)
|
||||||
(gmap (kbd "C-c p") 'package-list-packages)
|
(gmap (kbd "C-c C-p") 'package-list-packages)
|
||||||
|
|
||||||
(when (is-osx)
|
(when (is-osx)
|
||||||
(map (kbd "C-c o") 'send-dir-to-finder)
|
(nmap (kbd "C-c o") 'send-dir-to-finder)
|
||||||
(map (kbd "C-c u") 'send-to-transmit)
|
(nmap (kbd "C-c u") 'send-to-transmit)
|
||||||
(map (kbd "C-c l") 'send-to-launchbar)
|
(nmap (kbd "C-c l") 'send-to-launchbar)
|
||||||
(map (kbd "C-c L") 'send-dir-to-launchbar)
|
(nmap (kbd "C-c L") 'send-dir-to-launchbar)
|
||||||
(map (kbd "C-c t") (lambda() (interactive) (shell)))
|
(nmap (kbd "C-c t") (lambda() (interactive) (shell)))
|
||||||
(map (kbd "C-s-RET") 'send-to-iterm)
|
(nmap (kbd "C-s-RET") 'send-to-iterm)
|
||||||
|
|
||||||
;; Evaluating elisp
|
;; Evaluating elisp
|
||||||
(nmap (kbd "C-c x") 'eval-buffer)
|
(nmap (kbd "C-c x") 'eval-buffer)
|
||||||
|
@ -41,14 +41,14 @@
|
||||||
(imap (kbd "<kp-delete>") 'delete-char)
|
(imap (kbd "<kp-delete>") 'delete-char)
|
||||||
|
|
||||||
;; Leader alternatives
|
;; Leader alternatives
|
||||||
(map (kbd "s-f") 'projectile-find-file)
|
(nmap (kbd "s-f") 'projectile-find-file)
|
||||||
(map (kbd "s-F") 'projectile-ag)
|
(nmap (kbd "s-F") 'projectile-ag)
|
||||||
(map (kbd "s-r") 'helm-recentf)
|
(nmap (kbd "s-r") 'helm-recentf)
|
||||||
(map (kbd "s-R") 'projectile-recentf)
|
(nmap (kbd "s-R") 'projectile-recentf)
|
||||||
(map (kbd "s-o") 'ido-find-file)
|
(nmap (kbd "s-o") 'ido-find-file)
|
||||||
(map (kbd "s-O") 'open-major-mode-conf)
|
(nmap (kbd "s-O") 'open-major-mode-conf)
|
||||||
(map (kbd "s-d") 'mc/mark-next-like-this)
|
(nmap (kbd "s-d") 'mc/mark-next-like-this)
|
||||||
(map (kbd "s-D") 'mc/mark-all-like-this)
|
(nmap (kbd "s-D") 'mc/mark-all-like-this)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -119,12 +119,6 @@
|
||||||
(evil-visual-restore))
|
(evil-visual-restore))
|
||||||
)
|
)
|
||||||
|
|
||||||
(imap
|
|
||||||
; Auto-completion
|
|
||||||
(kbd "C-SPC") 'ac-fuzzy-complete
|
|
||||||
(kbd "C-S-SPC") 'ac-quick-help
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Commenting lines
|
;; Commenting lines
|
||||||
(nmap "gcc" 'evilnc-comment-or-uncomment-lines)
|
(nmap "gcc" 'evilnc-comment-or-uncomment-lines)
|
||||||
(vmap "gc" 'evilnc-comment-or-uncomment-lines)
|
(vmap "gc" 'evilnc-comment-or-uncomment-lines)
|
||||||
|
@ -134,7 +128,6 @@
|
||||||
(vmap "!" 'rotate-region)
|
(vmap "!" 'rotate-region)
|
||||||
;; (imap (kbd "RET") 'comment-indent-new-line)
|
;; (imap (kbd "RET") 'comment-indent-new-line)
|
||||||
;; Disable return for auto-completion, since tab does the trick
|
;; Disable return for auto-completion, since tab does the trick
|
||||||
(define-key ac-completing-map (kbd "RET") nil)
|
|
||||||
(imap (kbd "<C-return>") 'indent-new-comment-line)
|
(imap (kbd "<C-return>") 'indent-new-comment-line)
|
||||||
|
|
||||||
;; Enable TAB to do matchit
|
;; Enable TAB to do matchit
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
(add-hook 'before-make-frame-hook
|
(add-hook 'before-make-frame-hook
|
||||||
(lambda() (setq x-select-enable-clipboard t)))
|
(lambda() (setq x-select-enable-clipboard t)))
|
||||||
|
|
||||||
|
;; TODO: Make server-friendly
|
||||||
(when window-system
|
(when window-system
|
||||||
;; Curse you Lion-esque fullscreen mode!
|
;; Curse you Lion-esque fullscreen mode!
|
||||||
(setq ns-use-native-fullscreen nil)
|
(setq ns-use-native-fullscreen nil)
|
||||||
|
|
|
@ -48,6 +48,35 @@
|
||||||
ido-enable-tramp-completion t
|
ido-enable-tramp-completion t
|
||||||
ido-enable-last-directory-history t)
|
ido-enable-last-directory-history 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))))
|
||||||
|
|
||||||
;;#projectile
|
;;#projectile
|
||||||
(projectile-global-mode)
|
(projectile-global-mode)
|
||||||
(setq projectile-completion-system 'grizzl
|
(setq projectile-completion-system 'grizzl
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
;; Modeline settings
|
;; Modeline settings
|
||||||
|
|
||||||
|
;; TODO: Customize modeline
|
||||||
|
|
||||||
|
|
||||||
;;;; GUI Settings ;;;;;;;;;;;;;;;;;;;;;
|
;;;; GUI Settings ;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -46,9 +46,9 @@
|
||||||
;; Use system clipboard
|
;; Use system clipboard
|
||||||
(setq ring-bell-function 'ignore)
|
(setq ring-bell-function 'ignore)
|
||||||
|
|
||||||
(if (functionp 'tool-bar-mode) (tool-bar-mode -1))
|
(when (functionp 'tool-bar-mode) (tool-bar-mode -1))
|
||||||
(if (functionp 'scroll-bar-mode) (scroll-bar-mode -1))
|
(when (functionp 'scroll-bar-mode) (scroll-bar-mode -1))
|
||||||
(if (functionp 'menu-bar-mode) (menu-bar-mode -1))
|
(when (functionp 'menu-bar-mode) (menu-bar-mode -1))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(require 'cl)
|
;; (require 'cl)
|
||||||
|
|
||||||
;; Emacs under-the-hood
|
;; Emacs under-the-hood
|
||||||
(setq redisplay-dont-pause t)
|
(setq redisplay-dont-pause t)
|
||||||
|
@ -140,8 +140,8 @@
|
||||||
`(evil-ex-define-cmd ,ex ,function))
|
`(evil-ex-define-cmd ,ex ,function))
|
||||||
|
|
||||||
;; This one's unique for my own special mappings
|
;; This one's unique for my own special mappings
|
||||||
(defmacro map (key command)
|
;; (defmacro map (key command)
|
||||||
`(define-key my-mode-map ,key ,command))
|
;; `(define-key my-mode-map ,key ,command))
|
||||||
|
|
||||||
(defmacro is-osx () '(eq system-type 'darwin))
|
(defmacro is-osx () '(eq system-type 'darwin))
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,32 @@
|
||||||
(require-packages
|
(require-packages
|
||||||
'(auto-complete ; self-explanity
|
'(auto-complete ; self-explanity
|
||||||
auto-complete-config ; its default config
|
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-config-default)
|
||||||
(ac-linum-workaround) ; Fix line number flux bug
|
(ac-linum-workaround) ; Fix line number flux bug
|
||||||
|
(ac-flyspell-workaround) ; Compatibility with flyspell/make
|
||||||
(diminish 'auto-complete-mode) ; Hide mode-line entry
|
(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)
|
(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 ()
|
(defun enable-path-completion ()
|
||||||
(add-to-list 'ac-sources 'ac-source-filename)
|
(add-to-list 'ac-sources 'ac-source-filename)
|
||||||
|
@ -24,34 +35,5 @@
|
||||||
;; Tell ido not to care about case
|
;; Tell ido not to care about case
|
||||||
(setq completion-ignore-case t)
|
(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)
|
(provide 'mod-ac)
|
||||||
|
|
|
@ -3,18 +3,20 @@
|
||||||
flyspell ; spell checker
|
flyspell ; spell checker
|
||||||
))
|
))
|
||||||
|
|
||||||
|
;;;#flyspell
|
||||||
(diminish 'flyspell-mode " ?")
|
(diminish 'flyspell-mode " ?")
|
||||||
|
|
||||||
(setq ispell-program-name "aspell")
|
(setq ispell-program-name "aspell")
|
||||||
(setq ispell-list-command "--list")
|
(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))
|
(dolist (hook '(markdown-mode-hook git-commit-mode-hook org-mode-hook))
|
||||||
(add-hook hook (lambda() (flyspell-mode 1))))
|
(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)
|
(provide 'mod-fly)
|
||||||
|
|
|
@ -15,9 +15,13 @@
|
||||||
(require-package 'yasnippet)
|
(require-package 'yasnippet)
|
||||||
|
|
||||||
;;;#yasnippet
|
;;;#yasnippet
|
||||||
(yas-global-mode t)
|
;; (yas-global-mode t)
|
||||||
(associate-mode 'snippet-mode '("emacs.+/snippets/") 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)
|
(provide 'mod-snippets)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue