Refactor initfiles
This commit is contained in:
parent
f66f741804
commit
8c9c7f3bde
13 changed files with 72 additions and 59 deletions
1
ac-dict/global
Normal file
1
ac-dict/global
Normal file
|
@ -0,0 +1 @@
|
|||
henrik@lissner.net
|
2
ac-dict/js-mode
Normal file
2
ac-dict/js-mode
Normal file
|
@ -0,0 +1,2 @@
|
|||
JSON.stringify
|
||||
JSON.parse
|
7
ac-dict/js2-mode
Normal file
7
ac-dict/js2-mode
Normal file
|
@ -0,0 +1,7 @@
|
|||
JSON
|
||||
JSON.stringify
|
||||
JSON.parse
|
||||
LaunchBar
|
||||
include
|
||||
HTTP
|
||||
File
|
2
init.el
2
init.el
|
@ -30,7 +30,7 @@
|
|||
|
||||
;; Font & color scheme
|
||||
(load-theme 'brin t)
|
||||
(defvar my-font "Ubuntu Mono-15")
|
||||
(defvar my-font "Inconsolata-14")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Bootstrap
|
||||
|
|
|
@ -35,13 +35,12 @@
|
|||
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
||||
|
||||
(setq initial-scratch-buffer nil) ; empty scratch buffer
|
||||
(associate-mode 'text-mode '("\\`\\*Messages\\*\\'") t)
|
||||
|
||||
(electric-indent-mode +1) ; auto-indent on RET
|
||||
(global-hl-line-mode +1) ; highlight the line
|
||||
(setq-default
|
||||
tab-width 4 ; set tab width to 4 for all buffers
|
||||
indent-tabs-mode t ; use tabs, not spaces
|
||||
indent-tabs-mode nil ; use tabs, not spaces
|
||||
tab-always-indent nil)
|
||||
|
||||
;; do not soft-wrap lines
|
||||
|
@ -129,6 +128,5 @@
|
|||
(add-to-list 'recentf-exclude "\\.revive\\'")
|
||||
(setq recentf-auto-cleanup 'never)
|
||||
|
||||
|
||||
;;
|
||||
(provide 'core-editor)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
(when window-system
|
||||
(gmap (kbd "s-+") 'text-scale-increase)
|
||||
(gmap (kbd "s--") 'text-scale-decrease)
|
||||
(gmap (kbd "s-<f12>") 'toggle-frame-fullscreen)
|
||||
|
||||
(gmap (kbd "s-/") 'evilnc-comment-or-uncomment-lines)
|
||||
(gmap (kbd "s-w") 'kill-buffer-and-window)
|
||||
|
@ -119,6 +120,12 @@
|
|||
(evil-visual-restore))
|
||||
)
|
||||
|
||||
(imap
|
||||
(kbd "s-j") 'evil-join
|
||||
(kbd "M-SPC") 'expand-space
|
||||
(kbd "<C-return>") 'indent-new-comment-line
|
||||
)
|
||||
|
||||
;; Commenting lines
|
||||
(nmap "gcc" 'evilnc-comment-or-uncomment-lines)
|
||||
(vmap "gc" 'evilnc-comment-or-uncomment-lines)
|
||||
|
@ -126,9 +133,6 @@
|
|||
;; Rotate-text (see elisp/rotate-text.el)
|
||||
(nmap "!" 'rotate-word-at-point)
|
||||
(vmap "!" 'rotate-region)
|
||||
;; (imap (kbd "RET") 'comment-indent-new-line)
|
||||
;; Disable return for auto-completion, since tab does the trick
|
||||
(imap (kbd "<C-return>") 'indent-new-comment-line)
|
||||
|
||||
;; Enable TAB to do matchit
|
||||
(evil-define-key 'normal evil-matchit-mode-map (kbd "TAB") 'evilmi-jump-items)
|
||||
|
@ -189,15 +193,12 @@
|
|||
|
||||
;;;; Ex Commands ;;;;;;;;;;;;;;;;
|
||||
|
||||
;; (cmap "e[dit]" 'find-file)
|
||||
;; (cmap "n[ew]" ')
|
||||
(cmap "retab" 'indent-region)
|
||||
(cmap "retab" 'indent-region) ; TODO: Implement proper retab defun
|
||||
(cmap "msg" 'view-echo-area-messages)
|
||||
|
||||
|
||||
;;;; Keymap fixes ;;;;;;;;;;;;;;;
|
||||
|
||||
(imap (kbd "s-j") '(lambda() (interactive) (evil-join-line) (evil-indent-line)))
|
||||
|
||||
;; Make ESC quit all the things
|
||||
(nmap [escape] 'keyboard-quit)
|
||||
(vmap [escape] 'keyboard-quit)
|
||||
|
@ -213,13 +214,12 @@
|
|||
;; Close help window with escape
|
||||
(define-key global-map [escape] 'quit-window)
|
||||
|
||||
;; Restore bash-esque C-w/C-a/C-e in insert mode and the minibuffer
|
||||
;; Restore bash-esque keymaps in insert mode and the minibuffer
|
||||
(mapc (lambda (map)
|
||||
;; (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-e") 'move-end-of-line)
|
||||
(define-key map (kbd "C-u") 'backward-kill-line))
|
||||
(list minibuffer-local-map evil-insert-state-map))
|
||||
(list minibuffer-local-map minibuffer-local-ns-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)
|
||||
|
|
|
@ -14,15 +14,10 @@
|
|||
(add-hook 'before-make-frame-hook
|
||||
(lambda() (setq x-select-enable-clipboard t)))
|
||||
|
||||
;; TODO: Make server-friendly
|
||||
(when window-system
|
||||
;; Curse you Lion-esque fullscreen mode!
|
||||
(setq ns-use-native-fullscreen nil)
|
||||
(gmap (kbd "s-<f12>") 'toggle-frame-fullscreen)
|
||||
|
||||
;; Don't open files from the workspace in a new frame
|
||||
(setq ns-pop-up-frames nil)
|
||||
)
|
||||
|
||||
;; Send current file to OSX apps
|
||||
(defun open-file-with (path &optional appName)
|
||||
|
|
|
@ -22,38 +22,35 @@
|
|||
|
||||
;; Check if a package is installed; if load is t, load it too.
|
||||
;; Works for packages bundled with emacs too!
|
||||
(defun require-package (package &optional dont_load)
|
||||
(defun require-package (package)
|
||||
(message "=> require-package(%s)" package)
|
||||
(unless (require package nil 'noerror)
|
||||
(init-package package dont_load)))
|
||||
|
||||
;; List version of require-package
|
||||
(defun require-packages (packages &optional dont_load)
|
||||
(dolist (pkg packages) (require-package pkg dont_load)))
|
||||
|
||||
;; Install the package if it isn't already, and require it, unless
|
||||
;; told others.
|
||||
(defun init-package (package &optional dont_load)
|
||||
(unless (package-installed-p package)
|
||||
(unless (assoc package package-archive-contents)
|
||||
(package-refresh-contents))
|
||||
(package-install package))
|
||||
(if (not dont_load) (require package)))
|
||||
(package-install package)))
|
||||
(require package))
|
||||
|
||||
;; List version of require-package
|
||||
(defun require-packages (packages)
|
||||
(mapc 'require-package packages))
|
||||
|
||||
;; Associate an extension with a mode, and install the necessary
|
||||
;; package(s) for it. Also look for a modules/env-*.el modefile for
|
||||
;; extra configuration.
|
||||
(defun associate-mode (mode ext &optional only-load-env)
|
||||
(let* ((mode_name (symbol-name mode))
|
||||
(env_mode_name (concat "env-" mode_name))
|
||||
(mode_path (expand-file-name (concat env_mode_name ".el") my-modules-dir)))
|
||||
(let* ((mode-name (symbol-name mode))
|
||||
(env-mode-name (concat "env-" mode-name))
|
||||
(mode-path (expand-file-name (concat env-mode-name ".el") my-modules-dir)))
|
||||
|
||||
(unless only-load-env (autoload mode mode_name))
|
||||
(if (file-exists-p mode_path)
|
||||
(eval-after-load mode
|
||||
`(require (intern ,env_mode_name)))
|
||||
;; (autoload mode env_mode_name)
|
||||
;; (require-package (intern env_mode_name))
|
||||
))
|
||||
(message "=> Init %s" mode-name)
|
||||
;; (unless only-load-env (autoload mode mode-name))
|
||||
(unless only-load-env (require-package mode))
|
||||
(when (file-exists-p mode-path)
|
||||
(message "=> Loaded %s" env-mode-name)
|
||||
(require (intern env-mode-name))
|
||||
)
|
||||
)
|
||||
|
||||
(if (typep ext 'list)
|
||||
(dolist (e ext)
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
ido-enable-tramp-completion t
|
||||
ido-enable-last-directory-history t)
|
||||
|
||||
;; (add-to-list 'ido-ubiquitous-default-function-overrides '(disable exact "evil-ex"))
|
||||
|
||||
;;; 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)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
(require-packages
|
||||
'(uniquify ; unique buffer names for identical filenames
|
||||
'(
|
||||
;; uniquify ; unique buffer names for identical filenames
|
||||
diminish ; shrinks/removes modeline elements
|
||||
))
|
||||
|
||||
|
@ -24,23 +25,24 @@
|
|||
(let* ((w (length (number-to-string (count-lines (point-min) (point-max)))))
|
||||
(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
|
||||
;; Show full path in window title
|
||||
(setq frame-title-format
|
||||
'(:eval (if (buffer-file-name) (abbreviate-file-name (buffer-file-name)) "%b")))
|
||||
|
||||
;;;#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
|
||||
|
||||
;; Modeline settings
|
||||
|
||||
;; TODO: Customize modeline
|
||||
;; TODO: Customize modeline!
|
||||
|
||||
|
||||
;;;; GUI Settings ;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(add-to-list 'default-frame-alist `(font . ,my-font))
|
||||
(add-to-list 'default-frame-alist '(width . 100))
|
||||
(add-to-list 'default-frame-alist '(height . 75))
|
||||
(add-to-list 'default-frame-alist '(alpha 98 95)) ; *slightly* transparent window
|
||||
|
||||
;; Use system clipboard
|
||||
|
|
|
@ -103,6 +103,14 @@
|
|||
(interactive)
|
||||
(evil-delete (point-at-bol) (point)))
|
||||
|
||||
(defun expand-space ()
|
||||
(interactive)
|
||||
(save-excursion (insert " ")))
|
||||
(defun expand-backspace ()
|
||||
(interactive)
|
||||
(save-excursion (delete-char 1))
|
||||
(delete-backward-char 1))
|
||||
|
||||
(defun toggle-sidebar ()
|
||||
(interactive)
|
||||
(project-explorer-open))
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(require-packages
|
||||
'(auto-complete ; self-explanity
|
||||
auto-complete-config ; its default config
|
||||
;; fuzzy ; fuzzy search engine for auto-complete
|
||||
))
|
||||
|
||||
;; (setq ac-auto-show-menu nil ; Suggestions box must be invoked manually (see core-keymaps.el)
|
||||
|
@ -17,9 +16,12 @@
|
|||
(ac-flyspell-workaround) ; Compatibility with flyspell/make
|
||||
(diminish 'auto-complete-mode) ; Hide mode-line entry
|
||||
|
||||
(add-to-list 'ac-dictionary-files "~/.emacs.d/ac-dict/global")
|
||||
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
|
||||
|
||||
;; 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)
|
||||
(evil-define-key 'insert ac-mode-map (kbd "C-S-SPC") 'ac-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)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
(require-package 'yasnippet)
|
||||
|
||||
;;;#yasnippet
|
||||
;; (yas-global-mode t)
|
||||
(associate-mode 'snippet-mode '("emacs.+/snippets/") t)
|
||||
(add-hook 'prog-mode-hook
|
||||
'(lambda ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue