Rewrote core initfiles: add mod-ac, mod-fly & mod-git
* mod-ac: fuzzy and unintrusive auto-complete * mod-fly: on-the-fly syntax and spell checking * mod-git: git-gutter and git-related modes
This commit is contained in:
parent
b53dfd6369
commit
30845199b5
12 changed files with 224 additions and 191 deletions
34
init.el
34
init.el
|
@ -1,5 +1,4 @@
|
||||||
;;
|
;;; Emacs for the jaded vimmer
|
||||||
;; [Emacs for the jaded vimmer]
|
|
||||||
;;
|
;;
|
||||||
;; Author: Henrik Lissner <henrik@lissner>
|
;; Author: Henrik Lissner <henrik@lissner>
|
||||||
;; URL: https://github.com/hlissner/emacs.d
|
;; URL: https://github.com/hlissner/emacs.d
|
||||||
|
@ -7,9 +6,13 @@
|
||||||
;; These settings set up a very vim-like experience, with some of emacs goodness
|
;; These settings set up a very vim-like experience, with some of emacs goodness
|
||||||
;; squeezed in between the cracks.
|
;; squeezed in between the cracks.
|
||||||
;;
|
;;
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
(cd "~") ; Default directory, instead of /
|
(cd "~") ; Default directory, instead of /
|
||||||
(setq load-prefer-newer t) ; Always load newest byte code
|
;; (setq debug-on-error t)
|
||||||
|
|
||||||
|
;; Append homebrew's bin to emac's PATH
|
||||||
|
(setq exec-path (append exec-path '("/usr/local/bin")))
|
||||||
|
|
||||||
;; Global vars
|
;; Global vars
|
||||||
(defvar my-dir (file-name-directory load-file-name))
|
(defvar my-dir (file-name-directory load-file-name))
|
||||||
|
@ -35,18 +38,22 @@
|
||||||
|
|
||||||
(dolist (module '(
|
(dolist (module '(
|
||||||
core ; Emacs core settings
|
core ; Emacs core settings
|
||||||
core-packages ; package init & management
|
core-packages ; Package init & management
|
||||||
core-ui ; Look and behavior of the emacs UI
|
core-ui ; Look and behavior of the emacs UI
|
||||||
core-editor ; Text/code editor settings and behavior
|
core-editor ; Text/code editor settings and behavior
|
||||||
core-osx ; OSX-specific settings & functions
|
core-osx ; OSX-specific settings & functions
|
||||||
core-project ; Project navigation settings & packages
|
core-project ; Project navigation settings & packages
|
||||||
core-keymaps ; Global & local keybindings for all modes
|
|
||||||
|
|
||||||
;; Editor essentials
|
;; Editor essentials
|
||||||
|
mod-ac ; Auto-complete engine & settings
|
||||||
mod-git ; GIT tools/settings
|
mod-git ; GIT tools/settings
|
||||||
; mod-shell ; Goodies for running shell in emacs
|
mod-fly ; Syntax and spell checkers
|
||||||
; mod-webdev ; Webdev tools (sass, js, etc)
|
; mod-webdev ; Webdev tools (sass, js, etc)
|
||||||
; mod-gamedev ; Gamedev tools (C++, love2D, html5)
|
; mod-gamedev ; Gamedev tools (C++, love2D, html5)
|
||||||
|
; mod-shell ; Goodies for ansi-term
|
||||||
|
|
||||||
|
;; Must be last!
|
||||||
|
core-keymaps ; Global & local keybindings for all modes
|
||||||
))
|
))
|
||||||
(require module))
|
(require module))
|
||||||
|
|
||||||
|
@ -54,10 +61,11 @@
|
||||||
;;;; Modes ;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;; Modes ;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(associate-mode 'ruby-mode '(".rb" "RakeFile"))
|
(associate-mode 'ruby-mode '(".rb" "RakeFile"))
|
||||||
(associate-mode 'markdown-mode '(".md" ".markdown"))
|
(associate-mode 'markdown-mode '(".md" ".markdown" "README"))
|
||||||
(associate-mode 'scss-mode ".scss")
|
(associate-mode 'scss-mode '(".scss"))
|
||||||
;; (associate-mode 'lua-mode ".lua")
|
(associate-mode 'org-mode '(".org" ".gtd") t)
|
||||||
|
(associate-mode 'js2-mode '(".js" ".json"))
|
||||||
|
(associate-mode 'web-mode '(".html" ".htm" ".phtml" ".tpl" ".tpl.php" ".erb"))
|
||||||
|
; (associate-mode 'lua-mode ".lua")
|
||||||
;; (associate-mode 'yaml-mode ".yml")
|
;; (associate-mode 'yaml-mode ".yml")
|
||||||
;; (associate-mode 'js2-mode '(".js" ".json"))
|
|
||||||
;; (associate-mode 'python-mode ".py")
|
;; (associate-mode 'python-mode ".py")
|
||||||
;; (associate-mode 'web-mode '(".html" ".htm" ".phtml" ".tpl" ".tpl.php" ".erb"))
|
|
||||||
|
|
0
init/README.md
Normal file
0
init/README.md
Normal file
|
@ -11,21 +11,16 @@
|
||||||
evil-space ; mimics ; and , for f, F, t, T w/ space
|
evil-space ; mimics ; and , for f, F, t, T w/ space
|
||||||
evil-visualstar ; visual-based * and #
|
evil-visualstar ; visual-based * and #
|
||||||
evil-ex-registers ; paste from registers in ex commands
|
evil-ex-registers ; paste from registers in ex commands
|
||||||
auto-complete ; self-explanity
|
|
||||||
auto-complete-config ; its default config
|
|
||||||
fuzzy ; fuzzy search engine for auto-complete
|
|
||||||
autopair ; delimiter auto-closing
|
autopair ; delimiter auto-closing
|
||||||
yasnippet ; snippets: expand with tab
|
yasnippet ; snippets: expand with tab
|
||||||
rainbow-delimiters ; colored matching parenthesis
|
rainbow-delimiters ; colored matching parenthesis
|
||||||
rainbow-mode ; highlight color codes
|
rainbow-mode ; highlight color codes
|
||||||
highlight-indentation ; visual indentation guides
|
highlight-indentation ; visual indentation guides
|
||||||
diminish ; shrinks/removes modeline elements
|
|
||||||
saveplace ; restore cursor position on buffer load
|
saveplace ; restore cursor position on buffer load
|
||||||
volatile-highlights ; temporarily highlight changes on undo/yank
|
volatile-highlights ; temporarily highlight changes on undo/yank
|
||||||
anzu ; display current + total matches searching
|
anzu ; display current + total matches searching
|
||||||
smex ; less M-x cruft
|
smex ; less M-x cruft
|
||||||
rotate-text ; like vim-switch
|
rotate-text ; like vim-switch
|
||||||
uniquify ; unique buffer names for identical filenames
|
|
||||||
recentf ; access to list of recent files
|
recentf ; access to list of recent files
|
||||||
key-chord ; for mapping key chords in insert mode
|
key-chord ; for mapping key chords in insert mode
|
||||||
ediff
|
ediff
|
||||||
|
@ -34,10 +29,6 @@
|
||||||
|
|
||||||
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;;;#key-chord
|
|
||||||
(key-chord-mode 1)
|
|
||||||
(setq key-chord-two-keys-delay 0.5)
|
|
||||||
|
|
||||||
(electric-indent-mode +1)
|
(electric-indent-mode +1)
|
||||||
(global-hl-line-mode +1) ; highlight the line
|
(global-hl-line-mode +1) ; highlight the line
|
||||||
(setq blink-matching-paren nil) ; disable blink-matching-paren
|
(setq blink-matching-paren nil) ; disable blink-matching-paren
|
||||||
|
@ -51,13 +42,19 @@
|
||||||
(setq truncate-partial-width-windows nil)
|
(setq truncate-partial-width-windows nil)
|
||||||
|
|
||||||
;; Prettify code-related major modes
|
;; Prettify code-related major modes
|
||||||
(add-hook 'prog-mode-hook 'linum-on)
|
|
||||||
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
|
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
|
||||||
(add-hook 'prog-mode-hook #'highlight-indentation-mode)
|
(add-hook 'prog-mode-hook #'highlight-indentation-mode)
|
||||||
|
|
||||||
;; Remove trailing whitespace
|
;; Remove trailing whitespace
|
||||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||||
|
|
||||||
|
|
||||||
|
;;;; Init plugins ;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;#key-chord
|
||||||
|
(key-chord-mode 1)
|
||||||
|
(setq key-chord-two-keys-delay 0.5)
|
||||||
|
|
||||||
;;;#smex
|
;;;#smex
|
||||||
(smex-initialize)
|
(smex-initialize)
|
||||||
;; Hook up smex to auto-update, rather than update on every run
|
;; Hook up smex to auto-update, rather than update on every run
|
||||||
|
@ -65,12 +62,10 @@
|
||||||
(when (boundp 'smex-cache) (smex-update)))
|
(when (boundp 'smex-cache) (smex-update)))
|
||||||
(add-hook 'after-load-functions 'smex-update-after-load)
|
(add-hook 'after-load-functions 'smex-update-after-load)
|
||||||
|
|
||||||
|
|
||||||
;;;; Init plugins ;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
;;;#evil
|
;;;#evil
|
||||||
(setq evil-want-C-i-jump t)
|
(setq evil-want-C-i-jump t)
|
||||||
(setq evil-want-C-u-scroll t)
|
(setq evil-want-C-u-scroll t)
|
||||||
|
(setq evil-leader/in-all-states t)
|
||||||
|
|
||||||
(global-evil-leader-mode)
|
(global-evil-leader-mode)
|
||||||
(global-evil-matchit-mode 1)
|
(global-evil-matchit-mode 1)
|
||||||
|
@ -88,31 +83,27 @@
|
||||||
;; Enable registers in ex-mode
|
;; Enable registers in ex-mode
|
||||||
(define-key evil-ex-completion-map (kbd "C-r") #'evil-ex-paste-from-register)
|
(define-key evil-ex-completion-map (kbd "C-r") #'evil-ex-paste-from-register)
|
||||||
|
|
||||||
|
|
||||||
;;;#autopair
|
;;;#autopair
|
||||||
(autopair-global-mode)
|
(autopair-global-mode)
|
||||||
(diminish 'autopair-mode)
|
(setq autopair-blink nil)
|
||||||
|
|
||||||
|
;;;#smartparens
|
||||||
|
; (require 'smartparens-config)
|
||||||
|
; (smartparens-global-mode t)
|
||||||
|
|
||||||
;;;#anzu
|
;;;#anzu
|
||||||
(global-anzu-mode)
|
(global-anzu-mode)
|
||||||
(diminish 'anzu-mode)
|
|
||||||
|
|
||||||
|
|
||||||
;;;#ediff
|
;;;#ediff
|
||||||
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
|
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
|
||||||
|
|
||||||
|
|
||||||
;;;#volatile-highlights
|
;;;#volatile-highlights
|
||||||
(volatile-highlights-mode t)
|
(volatile-highlights-mode t)
|
||||||
(diminish 'volatile-highlights-mode)
|
|
||||||
|
|
||||||
|
|
||||||
;;;#saveplace
|
;;;#saveplace
|
||||||
(setq-default save-place t)
|
(setq-default save-place t)
|
||||||
(setq save-place-file (expand-file-name "saveplace" my-tmp-dir))
|
(setq save-place-file (expand-file-name "saveplace" my-tmp-dir))
|
||||||
|
|
||||||
|
|
||||||
;;;#savehist
|
;;;#savehist
|
||||||
(setq savehist-additional-variables
|
(setq savehist-additional-variables
|
||||||
;; search entries
|
;; search entries
|
||||||
|
@ -123,77 +114,13 @@
|
||||||
savehist-file (expand-file-name "savehist" my-tmp-dir))
|
savehist-file (expand-file-name "savehist" my-tmp-dir))
|
||||||
(savehist-mode 1)
|
(savehist-mode 1)
|
||||||
|
|
||||||
|
|
||||||
;;;#diminish
|
|
||||||
(diminish 'undo-tree-mode)
|
|
||||||
(diminish 'highlight-indentation-mode)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;#uniquify
|
|
||||||
(setq uniquify-buffer-name-style 'forward)
|
|
||||||
(setq uniquify-separator "/")
|
|
||||||
(setq uniquify-after-kill-buffer-p t) ; rename after killing uniquified
|
|
||||||
(setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
|
|
||||||
|
|
||||||
|
|
||||||
;;;#recentf
|
;;;#recentf
|
||||||
(recentf-mode 1)
|
(recentf-mode 1)
|
||||||
(setq recentf-max-menu-items 25)
|
(setq recentf-max-menu-items 25)
|
||||||
|
|
||||||
|
|
||||||
;;;#yasnippet
|
;;;#yasnippet
|
||||||
(yas-global-mode -1)
|
(yas-global-mode -1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Auto-completion ;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
(ac-config-default)
|
|
||||||
(ac-linum-workaround) ; Fix line number flux bug
|
|
||||||
(diminish 'auto-complete-mode)
|
|
||||||
|
|
||||||
(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)
|
|
||||||
|
|
||||||
(defun enable-path-completion ()
|
|
||||||
(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 'core-editor)
|
(provide 'core-editor)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
;; Global keymaps ;;;;;;;;;;;;;;;
|
;; Global keymaps ;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(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-x C-p") 'package-list-packages)
|
(gmap (kbd "C-x C-p") 'package-list-packages)
|
||||||
|
@ -45,8 +46,6 @@
|
||||||
";" 'helm-imenu
|
";" 'helm-imenu
|
||||||
"," 'ido-switch-buffer
|
"," 'ido-switch-buffer
|
||||||
"=" 'align-regexp
|
"=" 'align-regexp
|
||||||
"x" 'kill-this-buffer
|
|
||||||
"X" 'kill-buffer-and-window
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(nmap
|
(nmap
|
||||||
|
@ -57,9 +56,13 @@
|
||||||
"k" 'evil-previous-visual-line
|
"k" 'evil-previous-visual-line
|
||||||
|
|
||||||
"X" 'evil-destroy ; Delete without yanking
|
"X" 'evil-destroy ; Delete without yanking
|
||||||
"Y" 'copy-to-end-of-line ; nnoremap Y y$
|
|
||||||
"zz" 'kill-this-buffer ; Close buffer
|
|
||||||
|
|
||||||
|
; copy to end of line
|
||||||
|
"Y" (lambda()
|
||||||
|
(interactive)
|
||||||
|
(evil-yank (point) (point-at-eol)))
|
||||||
|
|
||||||
|
"zz" 'kill-this-buffer ; Close buffer
|
||||||
"]b" 'previous-buffer
|
"]b" 'previous-buffer
|
||||||
"[b" 'next-buffer
|
"[b" 'next-buffer
|
||||||
|
|
||||||
|
@ -106,6 +109,10 @@
|
||||||
;; Rotate-text (see elisp/rotate-text.el)
|
;; Rotate-text (see elisp/rotate-text.el)
|
||||||
(nmap (kbd "RET") 'rotate-word-at-point)
|
(nmap (kbd "RET") 'rotate-word-at-point)
|
||||||
(vmap (kbd "RET") 'rotate-region)
|
(vmap (kbd "RET") 'rotate-region)
|
||||||
|
;; (imap (kbd "RET") 'comment-indent-new-line)
|
||||||
|
;; 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)
|
||||||
|
|
||||||
;; Enable TAB to do matchit
|
;; Enable TAB to do matchit
|
||||||
(evil-define-key 'normal evil-matchit-mode-map (kbd "TAB") 'evilmi-jump-items)
|
(evil-define-key 'normal evil-matchit-mode-map (kbd "TAB") 'evilmi-jump-items)
|
||||||
|
@ -113,7 +120,6 @@
|
||||||
;; Easy escape from insert mode
|
;; Easy escape from insert mode
|
||||||
(ichmap "jj" 'evil-normal-state)
|
(ichmap "jj" 'evil-normal-state)
|
||||||
|
|
||||||
|
|
||||||
;;;; Org-Mode ;;;;;;;;;;;;;;;;;;;
|
;;;; Org-Mode ;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(evil-define-key 'normal evil-org-mode-map
|
(evil-define-key 'normal evil-org-mode-map
|
||||||
|
@ -142,33 +148,33 @@
|
||||||
|
|
||||||
;; normal & insert state shortcuts.
|
;; normal & insert state shortcuts.
|
||||||
(mapc (lambda (state)
|
(mapc (lambda (state)
|
||||||
(evil-define-key state evil-org-mode-map
|
(evil-define-key state evil-org-mode-map
|
||||||
(kbd "M-l") 'org-metaright
|
(kbd "M-l") 'org-metaright
|
||||||
(kbd "M-h") 'org-metaleft
|
(kbd "M-h") 'org-metaleft
|
||||||
(kbd "M-k") 'org-metaup
|
(kbd "M-k") 'org-metaup
|
||||||
(kbd "M-j") 'org-metadown
|
(kbd "M-j") 'org-metadown
|
||||||
(kbd "M-L") 'org-shiftmetaright
|
(kbd "M-L") 'org-shiftmetaright
|
||||||
(kbd "M-H") 'org-shiftmetaleft
|
(kbd "M-H") 'org-shiftmetaleft
|
||||||
(kbd "M-K") 'org-shiftmetaup
|
(kbd "M-K") 'org-shiftmetaup
|
||||||
(kbd "M-J") 'org-shiftmetadown
|
(kbd "M-J") 'org-shiftmetadown
|
||||||
(kbd "M-o") '(lambda () (interactive)
|
(kbd "M-o") '(lambda () (interactive)
|
||||||
(evil-org-eol-call
|
(evil-org-eol-call
|
||||||
'(lambda()
|
'(lambda()
|
||||||
(org-insert-heading)
|
(org-insert-heading)
|
||||||
(org-metaright))))
|
(org-metaright))))
|
||||||
(kbd "M-t") '(lambda () (interactive)
|
(kbd "M-t") '(lambda () (interactive)
|
||||||
(evil-org-eol-call
|
(evil-org-eol-call
|
||||||
'(lambda()
|
'(lambda()
|
||||||
(org-insert-todo-heading nil)
|
(org-insert-todo-heading nil)
|
||||||
(org-metaright))))
|
(org-metaright))))
|
||||||
))
|
))
|
||||||
'(normal insert))
|
'(normal insert))
|
||||||
|
|
||||||
|
|
||||||
;;;; Ex Commands ;;;;;;;;;;;;;;;;
|
;;;; Ex Commands ;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
; (cmap "e[dit]" 'find-file)
|
;; (cmap "e[dit]" 'find-file)
|
||||||
(cmap "git" 'magit-status)
|
;; (cmap "n[ew]" ')
|
||||||
|
|
||||||
|
|
||||||
;;;; Keymap fixes ;;;;;;;;;;;;;;;
|
;;;; Keymap fixes ;;;;;;;;;;;;;;;
|
||||||
|
@ -187,16 +193,18 @@
|
||||||
(global-set-key [escape] 'evil-exit-emacs-state)
|
(global-set-key [escape] 'evil-exit-emacs-state)
|
||||||
;; Close help window with escape
|
;; Close help window with escape
|
||||||
(define-key global-map [escape] 'quit-window)
|
(define-key global-map [escape] 'quit-window)
|
||||||
(define-key ag-mode-map [escape] 'quit-window)
|
|
||||||
|
|
||||||
;; Restore bash-esque C-w/C-a/C-e in insert mode and the minibuffer
|
;; Restore bash-esque C-w/C-a/C-e in insert mode and the minibuffer
|
||||||
(mapc (lambda (map)
|
(mapc (lambda (map)
|
||||||
(define-key map (kbd "C-w") 'backward-kill-word)
|
;; (define-key map (kbd "C-w") 'evil-delete-backward-word)
|
||||||
(define-key map (kbd "C-a") 'move-beginning-of-line)
|
(define-key map (kbd "C-a") 'move-beginning-of-line)
|
||||||
(define-key map (kbd "C-e") 'move-end-of-line)
|
(define-key map (kbd "C-e") 'move-end-of-line)
|
||||||
(define-key map (kbd "C-u") 'backward-kill-line))
|
(define-key map (kbd "C-u") 'backward-kill-line))
|
||||||
(list minibuffer-local-map evil-insert-state-map))
|
(list minibuffer-local-map evil-insert-state-map))
|
||||||
|
|
||||||
|
(define-key evil-insert-state-map (kbd "C-w") 'backward-kill-word)
|
||||||
|
(define-key minibuffer-local-map (kbd "C-w") 'ido-delete-backward-word-updir)
|
||||||
|
|
||||||
(add-hook 'ido-setup-hook '(lambda ()
|
(add-hook 'ido-setup-hook '(lambda ()
|
||||||
;; take that "Text is read-only" and stick it where emacs don't shine!
|
;; take that "Text is read-only" and stick it where emacs don't shine!
|
||||||
(define-key ido-completion-map (kbd "<backspace>") 'ido-delete-backward-updir)
|
(define-key ido-completion-map (kbd "<backspace>") 'ido-delete-backward-updir)
|
||||||
|
@ -207,8 +215,7 @@
|
||||||
|
|
||||||
;; Auto-complete on tab/space (why is it called ido-exit-minibuffer?)
|
;; Auto-complete on tab/space (why is it called ido-exit-minibuffer?)
|
||||||
(define-key ido-completion-map " " 'ido-exit-minibuffer)
|
(define-key ido-completion-map " " 'ido-exit-minibuffer)
|
||||||
;; TAB, by default, inserts a literal \t ಠ_ಠ
|
))
|
||||||
(define-key ido-completion-map (kbd "TAB") 'ido-exit-minibuffer)))
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(provide 'core-keymaps)
|
(provide 'core-keymaps)
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
(if (is-osx) (progn
|
(if (is-osx) (progn
|
||||||
|
|
||||||
;; Ignore .DS_Store files with ido mode
|
;; Ignore .DS_Store files with ido mode
|
||||||
(add-to-list 'completion-ignored-extensions ".DS_Store")
|
(add-to-list 'ido-ignore-files ".DS_Store")
|
||||||
|
|
||||||
(if window-system (progn
|
(if window-system (progn
|
||||||
(setq ns-use-native-fullscreen nil)
|
(setq ns-use-native-fullscreen nil)
|
||||||
(global-set-key (kbd "s-<f12>") 'toggle-frame-fullscreen)
|
(global-set-key (kbd "s-<f12>") 'toggle-frame-fullscreen)
|
||||||
|
|
||||||
(x-focus-frame nil)
|
(x-focus-frame nil)
|
||||||
|
|
||||||
;; Don't open files from the workspace in a new frame
|
;; Don't open files from the workspace in a new frame
|
||||||
(setq ns-pop-up-frames nil)
|
(setq ns-pop-up-frames nil)
|
||||||
))
|
))
|
||||||
|
@ -23,22 +24,23 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
(open-file-with (buffer-file-name) appName))
|
(open-file-with (buffer-file-name) appName))
|
||||||
|
|
||||||
(defun send-to-transmit () (open-with "Transmit"))
|
(defun send-to-transmit () (open-with "Transmit"))
|
||||||
(defun send-to-launchbar () (open-with "LaunchBar"))
|
(defun send-to-launchbar () (open-with "LaunchBar"))
|
||||||
(defun send-dir-to-launchbar () (open-file-with default-directory "LaunchBar"))
|
(defun send-dir-to-launchbar () (open-file-with default-directory "LaunchBar"))
|
||||||
(defun send-dir-to-finder () (open-file-with default-directory "Finder"))
|
(defun send-dir-to-finder () (open-file-with default-directory "Finder"))
|
||||||
(defun open-in-terminal () (ansi-term "/bin/zsh"))
|
;; (defun open-in-terminal () (ansi-term "/bin/zsh"))
|
||||||
|
|
||||||
(after 'evil
|
(after 'evil
|
||||||
(gmap (kbd "s-/") 'evilnc-comment-or-uncomment-lines)
|
(gmap (kbd "s-/") 'evilnc-comment-or-uncomment-lines)
|
||||||
(gmap (kbd "s-w") 'evil-window-delete)
|
(gmap (kbd "s-w") 'kill-buffer)
|
||||||
|
(gmap (kbd "s-w") 'kill-buffer-and-window)
|
||||||
|
|
||||||
;; Fast scrolling
|
;; Fast scrolling
|
||||||
(nmap (kbd "s-j") "jjjjj")
|
(nmap (kbd "s-j") "5j")
|
||||||
(nmap (kbd "s-k") "kkkkk")
|
(nmap (kbd "s-k") "5k")
|
||||||
|
|
||||||
;; Newlines from insert mode
|
;; Newlines from insert mode
|
||||||
(imap (kbd "<s-return>") 'evil-open-below)
|
;; (imap (kbd "<s-return>") 'evil-open-below)
|
||||||
(imap (kbd "<S-s-return>") 'evil-open-above)
|
(imap (kbd "<S-s-return>") 'evil-open-above)
|
||||||
|
|
||||||
;; Fix OSX text navigation shortcuts
|
;; Fix OSX text navigation shortcuts
|
||||||
|
|
|
@ -40,21 +40,16 @@
|
||||||
(if (not dont_load) (require package)))
|
(if (not dont_load) (require package)))
|
||||||
|
|
||||||
;; Associate an extension with a mode, and install the necessary
|
;; Associate an extension with a mode, and install the necessary
|
||||||
;; package for it.
|
;; package(s) for it. Also look for a modules/env-*.el modefile for
|
||||||
;;
|
;; extra configuration.
|
||||||
;; TODO: Rewrite this
|
(defun associate-mode (mode ext &optional only-load-env)
|
||||||
(defun associate-mode (mode ext &optional env-pkg)
|
|
||||||
(let* ((mode_name (symbol-name mode))
|
(let* ((mode_name (symbol-name mode))
|
||||||
(env_mode_name (major-mode-module-name))
|
(env_mode_name (concat "env-" mode_name))
|
||||||
(mode_path (major-mode-module-path)))
|
(mode_path (expand-file-name (concat env_mode_name ".el") my-modules-dir)))
|
||||||
|
|
||||||
(condition-case nil (init-package mode t) (error nil))
|
(unless only-load-env (require-package mode))
|
||||||
|
(if (file-exists-p mode_path)
|
||||||
(autoload mode mode_name)
|
(require-package (intern env_mode_name))))
|
||||||
(if env-pkg
|
|
||||||
(require-package env-pkg)
|
|
||||||
(if (file-exists-p mode_path) (require-package (intern env_mode_name)))
|
|
||||||
))
|
|
||||||
|
|
||||||
(if (typep ext 'list)
|
(if (typep ext 'list)
|
||||||
(dolist (e ext)
|
(dolist (e ext)
|
||||||
|
|
|
@ -44,15 +44,6 @@
|
||||||
ido-enable-tramp-completion t
|
ido-enable-tramp-completion t
|
||||||
ido-enable-last-directory-history t)
|
ido-enable-last-directory-history t)
|
||||||
|
|
||||||
(defadvice completion--file-name-table (after ignoring-backups-f-n-completion activate)
|
|
||||||
"Filter out results when they match `completion-ignored-extensions'."
|
|
||||||
(let ((res ad-return-value))
|
|
||||||
(if (and (listp res)
|
|
||||||
(stringp (car res))
|
|
||||||
(cdr res)) ; length > 1, don't ignore sole match
|
|
||||||
(setq ad-return-value
|
|
||||||
(completion-pcm--filename-try-filter res)))))
|
|
||||||
|
|
||||||
;;#projectile
|
;;#projectile
|
||||||
(setq projectile-completion-system 'grizzl
|
(setq projectile-completion-system 'grizzl
|
||||||
projectile-enable-caching t)
|
projectile-enable-caching t)
|
||||||
|
@ -60,5 +51,8 @@
|
||||||
;;#sr-speedbar
|
;;#sr-speedbar
|
||||||
(setq speedbar-use-images nil)
|
(setq speedbar-use-images nil)
|
||||||
|
|
||||||
|
(add-to-list 'ido-ignore-buffers "\\`\\*[^s].*\\*")
|
||||||
|
(add-to-list 'ido-ignore-files "\\`.DS_Store\\'")
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(provide 'core-project)
|
(provide 'core-project)
|
||||||
|
|
|
@ -1,48 +1,62 @@
|
||||||
|
(require-packages
|
||||||
|
'(uniquify ; unique buffer names for identical filenames
|
||||||
|
diminish ; shrinks/removes modeline elements
|
||||||
|
))
|
||||||
|
|
||||||
;;;; UI Behavior ;;;;;;;;;;;;;;;;;;;;;;
|
(setq inhibit-startup-screen t) ; don't show EMACs start screen
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||||
|
(global-linum-mode t) ; line numbers for everybody!
|
||||||
|
|
||||||
(setq inhibit-startup-screen t)
|
;; Shrink mode-line
|
||||||
|
(add-hook 'emacs-startup-hook
|
||||||
|
(lambda()
|
||||||
|
(diminish 'autopair-mode)
|
||||||
|
(diminish 'anzu-mode)
|
||||||
|
(diminish 'volatile-highlights-mode)
|
||||||
|
(diminish 'undo-tree-mode)
|
||||||
|
(diminish 'auto-complete-mode)
|
||||||
|
(diminish 'highlight-indentation-mode)
|
||||||
|
(diminish 'flyspell-mode " ?")
|
||||||
|
))
|
||||||
|
|
||||||
|
;; Sane scroll settings
|
||||||
(setq scroll-margin 3
|
(setq scroll-margin 3
|
||||||
scroll-conservatively 100000
|
scroll-conservatively 100000
|
||||||
scroll-preserve-screen-position 1)
|
scroll-preserve-screen-position 1)
|
||||||
|
|
||||||
;; mode line settings
|
;; Show line/col-no in mode-line
|
||||||
(line-number-mode t)
|
(line-number-mode t)
|
||||||
(column-number-mode t)
|
(column-number-mode t)
|
||||||
(size-indication-mode t)
|
|
||||||
|
|
||||||
;; y/n instead of yes/no
|
;; make the fringe unintrusive
|
||||||
(fset 'yes-or-no-p 'y-or-n-p)
|
(if (fboundp 'fringe-mode) (fringe-mode 8))
|
||||||
|
|
||||||
;; make the fringe (gutter) smaller
|
;; Line numbers with +1 left-padding
|
||||||
;; the argument is a width in pixels (the default is 8)
|
|
||||||
(if (fboundp 'fringe-mode)
|
|
||||||
(fringe-mode 4))
|
|
||||||
|
|
||||||
;; Dynamic linum with +1 padding
|
|
||||||
(defadvice linum-update-window (around linum-dynamic activate)
|
(defadvice linum-update-window (around linum-dynamic activate)
|
||||||
(let* ((w (length (number-to-string (count-lines (point-min) (point-max)))))
|
(let* ((w (length (number-to-string (count-lines (point-min) (point-max)))))
|
||||||
(linum-format (concat "%" (number-to-string (+ w 1)) "d "))) ad-do-it))
|
(linum-format (concat "%" (number-to-string (+ w 1)) "d" (if window-system "" " ")))) ad-do-it))
|
||||||
|
|
||||||
|
;;;#uniquify
|
||||||
|
(setq uniquify-buffer-name-style 'forward)
|
||||||
|
(setq uniquify-separator "/")
|
||||||
|
(setq uniquify-after-kill-buffer-p t) ; rename after killing uniquified
|
||||||
|
(setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
|
||||||
|
|
||||||
|
|
||||||
;;;; GUI Settings ;;;;;;;;;;;;;;;;;;;;;
|
;;;; GUI Settings ;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
; (set-face-attribute 'default t :font 'my-font )
|
|
||||||
(add-to-list 'default-frame-alist `(font . ,my-font))
|
(add-to-list 'default-frame-alist `(font . ,my-font))
|
||||||
(add-to-list 'default-frame-alist '(width . 100))
|
(add-to-list 'default-frame-alist '(width . 100))
|
||||||
(add-to-list 'default-frame-alist '(height . 75))
|
(add-to-list 'default-frame-alist '(height . 75))
|
||||||
(add-to-list 'default-frame-alist '(alpha 98 95)) ; *slightly* transparent window
|
(add-to-list 'default-frame-alist '(alpha 98 95)) ; *slightly* transparent window
|
||||||
|
|
||||||
; (set-face-attribute 'mode-line nil :box '(:line-width 4 :color "#1f2g2a" ))
|
|
||||||
|
|
||||||
(if window-system (progn
|
(if window-system (progn
|
||||||
(tool-bar-mode -1)
|
(tool-bar-mode -1)
|
||||||
(scroll-bar-mode -1)
|
(scroll-bar-mode -1)
|
||||||
|
|
||||||
; Use system clipboard
|
; Use system clipboard
|
||||||
(setq x-select-enable-clipboard t)
|
(setq x-select-enable-clipboard t)
|
||||||
(setq-default line-spacing 1)
|
; (setq-default line-spacing 1)
|
||||||
(setq ring-bell-function 'ignore)
|
(setq ring-bell-function 'ignore)
|
||||||
) (menu-bar-mode -1))
|
) (menu-bar-mode -1))
|
||||||
|
|
||||||
|
|
23
init/core.el
23
init/core.el
|
@ -17,11 +17,13 @@
|
||||||
|
|
||||||
; window layout undo/redo, keymaps in init-evil.el
|
; window layout undo/redo, keymaps in init-evil.el
|
||||||
(when (fboundp 'winner-mode) (winner-mode 1))
|
(when (fboundp 'winner-mode) (winner-mode 1))
|
||||||
(setq linum-delay t)
|
|
||||||
|
|
||||||
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
|
;; Prevent prompts when trying to close window. If I'm closing the window,
|
||||||
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
;; I likely want it to close!
|
||||||
(flet ((process-list ())) ad-do-it))
|
(defadvice save-buffers-kill-emacs (around no-y-or-n activate)
|
||||||
|
(flet ((yes-or-no-p (&rest args) t)
|
||||||
|
(y-or-n-p (&rest args) t))
|
||||||
|
ad-do-it))
|
||||||
|
|
||||||
|
|
||||||
;;;; My personal minor mode ;;;;;;;;
|
;;;; My personal minor mode ;;;;;;;;
|
||||||
|
@ -51,6 +53,12 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
(projectile-find-file-in-directory my-dir))
|
(projectile-find-file-in-directory my-dir))
|
||||||
|
|
||||||
|
(defun open-scratch-buffer ()
|
||||||
|
(interactive)
|
||||||
|
(switch-to-buffer (get-buffer-create "*scratch*"))
|
||||||
|
(text-mode))
|
||||||
|
|
||||||
|
|
||||||
;; Open the modules/env-{major-mode-name}.el file
|
;; Open the modules/env-{major-mode-name}.el file
|
||||||
(defun open-major-mode-conf ()
|
(defun open-major-mode-conf ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
@ -62,10 +70,6 @@
|
||||||
(message (concat "Mode (" (major-mode-name) ") doesn't have a module! Creating it..."))))))
|
(message (concat "Mode (" (major-mode-name) ") doesn't have a module! Creating it..."))))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(defun copy-to-end-of-line ()
|
|
||||||
(interactive)
|
|
||||||
(evil-yank (point) (point-at-eol)))
|
|
||||||
|
|
||||||
(defun backward-kill-line ()
|
(defun backward-kill-line ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(evil-delete (point-at-bol) (point)))
|
(evil-delete (point-at-bol) (point)))
|
||||||
|
@ -112,8 +116,7 @@
|
||||||
|
|
||||||
;;;; Defuns ;;;;;;;;;;;;;;;;;;;;;;;
|
;;;; Defuns ;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun linum-on () (linum-mode 0))
|
(defun no-linum () (linum-mode 0))
|
||||||
(defun linum-off () (linum-mode 0))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
55
modules/mod-ac.el
Normal file
55
modules/mod-ac.el
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
(require-packages
|
||||||
|
'(auto-complete ; self-explanity
|
||||||
|
auto-complete-config ; its default config
|
||||||
|
fuzzy ; fuzzy search engine for auto-complete
|
||||||
|
))
|
||||||
|
|
||||||
|
;;;; Auto-completion ;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(ac-config-default)
|
||||||
|
(ac-linum-workaround) ; Fix line number flux bug
|
||||||
|
|
||||||
|
(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))
|
||||||
|
|
||||||
|
;; 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)
|
17
modules/mod-fly.el
Normal file
17
modules/mod-fly.el
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
(require-packages
|
||||||
|
'(flycheck ; syntax checker
|
||||||
|
flyspell ; spell checker
|
||||||
|
))
|
||||||
|
|
||||||
|
(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 'prog-mode-hook #'global-flycheck-mode)
|
||||||
|
(add-hook 'text-mode-hook (lambda () (flyspell-mode 1)))
|
||||||
|
(add-hook 'conf-mode-hook (lambda () (flyspell-mode 1)))
|
||||||
|
|
||||||
|
;;
|
||||||
|
(provide 'mod-fly)
|
|
@ -6,9 +6,20 @@
|
||||||
git-gutter-fringe
|
git-gutter-fringe
|
||||||
))
|
))
|
||||||
|
|
||||||
(global-git-gutter-mode t)
|
(custom-set-variables '(git-gutter:lighter " !"))
|
||||||
(setq git-gutter-fr:side 'right-fringe)
|
(custom-set-variables '(git-gutter:verbosity 0))
|
||||||
;; (diminish 'git-gutter-mode)
|
|
||||||
|
|
||||||
|
(set-face-foreground 'git-gutter-fr:modified "#555555")
|
||||||
|
(set-face-background 'git-gutter-fr:modified "#444444")
|
||||||
|
(set-face-foreground 'git-gutter-fr:deleted "#995555")
|
||||||
|
(set-face-background 'git-gutter-fr:deleted "#884444")
|
||||||
|
(set-face-foreground 'git-gutter-fr:added "#559955")
|
||||||
|
(set-face-background 'git-gutter-fr:added "#448844")
|
||||||
|
|
||||||
|
; (setq git-gutter-fr:side 'right-fringe)
|
||||||
|
(global-git-gutter-mode t)
|
||||||
|
|
||||||
|
(add-hook 'git-gutter-mode-on-hook
|
||||||
|
(lambda() (fringe-mode '(4 . 8))))
|
||||||
;;
|
;;
|
||||||
(provide 'mod-git)
|
(provide 'mod-git)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue