My name is Henrik and I'm an emacs addict. (Hello Henrik)
This commit is contained in:
parent
eafb74110f
commit
7d44ea4db4
50 changed files with 1154 additions and 2571 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
eshell/
|
eshell/
|
||||||
core/autoloads.el
|
init/autoloads.el
|
||||||
auto-save-list
|
auto-save-list
|
||||||
recentf
|
recentf
|
||||||
savehist
|
savehist
|
||||||
|
|
6
Cask
6
Cask
|
@ -12,9 +12,9 @@
|
||||||
(depends-on "fuzzy")
|
(depends-on "fuzzy")
|
||||||
(depends-on "use-package")
|
(depends-on "use-package")
|
||||||
(depends-on "smex")
|
(depends-on "smex")
|
||||||
(depends-on "floobits")
|
|
||||||
(depends-on "pos-tip")
|
(depends-on "pos-tip")
|
||||||
(depends-on "vim-empty-lines-mode")
|
;;(depends-on "vim-empty-lines-mode")
|
||||||
|
(depends-on "hlinum" :git "https://github.com/tom-tan/hlinum-mode")
|
||||||
|
|
||||||
;; OSX
|
;; OSX
|
||||||
(depends-on "exec-path-from-shell")
|
(depends-on "exec-path-from-shell")
|
||||||
|
@ -63,9 +63,7 @@
|
||||||
(depends-on "evil-indent-textobject")
|
(depends-on "evil-indent-textobject")
|
||||||
(depends-on "evil-jumper")
|
(depends-on "evil-jumper")
|
||||||
(depends-on "evil-god-state")
|
(depends-on "evil-god-state")
|
||||||
;;(depends-on "evil-nerd-commenter")
|
|
||||||
(depends-on "evil-snipe")
|
(depends-on "evil-snipe")
|
||||||
;; evil-nerd-commenter chokes if it's installed via cask for some reason...
|
|
||||||
|
|
||||||
;; Project management
|
;; Project management
|
||||||
(depends-on "projectile")
|
(depends-on "projectile")
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -6,9 +6,9 @@ update:
|
||||||
cask update
|
cask update
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -rf init.elc init/*.elc contrib/*.elc core/*.elc
|
@rm -rf init.elc init/*.elc contrib/*.elc
|
||||||
@rm -rf auto-save-list recentf places ido.last async-bytecomp.log elpa projectile-bookmarks.eld projectile.cache company-statistics-cache.el tramp smex-items
|
@rm -rf auto-save-list recentf places ido.last async-bytecomp.log elpa projectile-bookmarks.eld projectile.cache company-statistics-cache.el tramp smex-items
|
||||||
|
|
||||||
autoloads:
|
autoloads:
|
||||||
@rm -rf core/autoloads.el
|
@rm -rf init/autoloads.el
|
||||||
@cask exec ${EMACS} -Q --batch --eval '(progn (setq generated-autoload-file "~/.emacs.d/core/autoloads.el") (update-directory-autoloads "~/.emacs.d/init" "~/.emacs.d/core" "~/.emacs.d/contrib"))'
|
@cask exec ${EMACS} -Q --batch --eval '(progn (setq generated-autoload-file "~/.emacs.d/init/autoloads.el") (update-directory-autoloads "~/.emacs.d/init" "~/.emacs.d/contrib"))'
|
||||||
|
|
|
@ -1,389 +0,0 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;;;
|
|
||||||
;;; Copyright 1988-92, 1994-95, 1999, 2000, 2003, 2007, 2008
|
|
||||||
;;; Free Software Foundation, Inc.
|
|
||||||
;;; Written by Steve Byrne.
|
|
||||||
;;;
|
|
||||||
;;; This file is part of GNU Smalltalk.
|
|
||||||
;;;
|
|
||||||
;;; GNU Smalltalk is free software; you can redistribute it and/or modify it
|
|
||||||
;;; under the terms of the GNU General Public License as published by the Free
|
|
||||||
;;; Software Foundation; either version 2, or (at your option) any later
|
|
||||||
;;; version.
|
|
||||||
;;;
|
|
||||||
;;; GNU Smalltalk is distributed in the hope that it will be useful, but
|
|
||||||
;;; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
;;; for more details.
|
|
||||||
;;;
|
|
||||||
;;; You should have received a copy of the GNU General Public License along
|
|
||||||
;;; with GNU Smalltalk; see the file COPYING. If not, write to the Free
|
|
||||||
;;; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
;;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
;;; Incorporates Frank Caggiano's changes for Emacs 19.
|
|
||||||
;;; Updates and changes for Emacs 20 and 21 by David Forster
|
|
||||||
|
|
||||||
(require 'comint)
|
|
||||||
|
|
||||||
(defvar smalltalk-prompt-pattern "^st> *"
|
|
||||||
"Regexp to match prompts in smalltalk buffer.")
|
|
||||||
|
|
||||||
(defvar *gst-process* nil
|
|
||||||
"Holds the GNU Smalltalk process")
|
|
||||||
(defvar gst-program-name "/usr/local/Cellar/gnu-smalltalk/3.2.5_1/bin/gst -V"
|
|
||||||
"GNU Smalltalk command to run. Do not use the -a, -f or -- options.")
|
|
||||||
|
|
||||||
(defvar smalltalk-command-string nil
|
|
||||||
"Non nil means that we're accumulating output from Smalltalk")
|
|
||||||
|
|
||||||
(defvar smalltalk-eval-data nil
|
|
||||||
"?")
|
|
||||||
|
|
||||||
(defvar smalltalk-ctl-t-map
|
|
||||||
(let ((keymap (make-sparse-keymap)))
|
|
||||||
(define-key keymap "\C-d" 'smalltalk-toggle-decl-tracing)
|
|
||||||
(define-key keymap "\C-e" 'smalltalk-toggle-exec-tracing)
|
|
||||||
(define-key keymap "\C-v" 'smalltalk-toggle-verbose-exec-tracing)
|
|
||||||
keymap)
|
|
||||||
"Keymap of subcommands of C-c C-t, tracing related commands")
|
|
||||||
|
|
||||||
(defvar gst-mode-map
|
|
||||||
(let ((keymap (copy-keymap comint-mode-map)))
|
|
||||||
(define-key keymap "\C-c\C-t" smalltalk-ctl-t-map)
|
|
||||||
|
|
||||||
(define-key keymap "\C-\M-f" 'smalltalk-forward-sexp)
|
|
||||||
(define-key keymap "\C-\M-b" 'smalltalk-backward-sexp)
|
|
||||||
(define-key keymap "\C-cd" 'smalltalk-doit)
|
|
||||||
(define-key keymap "\C-cf" 'smalltalk-filein)
|
|
||||||
(define-key keymap "\C-cp" 'smalltalk-print)
|
|
||||||
(define-key keymap "\C-cq" 'smalltalk-quit)
|
|
||||||
(define-key keymap "\C-cs" 'smalltalk-snapshot)
|
|
||||||
keymap)
|
|
||||||
"Keymap used in Smalltalk interactor mode.")
|
|
||||||
|
|
||||||
(defun gst (command-line)
|
|
||||||
"Invoke GNU Smalltalk"
|
|
||||||
(interactive (list (if (null current-prefix-arg)
|
|
||||||
gst-program-name
|
|
||||||
(read-smalltalk-command))))
|
|
||||||
(setq gst-program-name command-line)
|
|
||||||
(funcall (if (not (eq major-mode 'gst-mode))
|
|
||||||
#'switch-to-buffer-other-window
|
|
||||||
;; invoked from a Smalltalk interactor window, so stay
|
|
||||||
;; there
|
|
||||||
#'identity)
|
|
||||||
(apply 'make-gst "gst" (parse-smalltalk-command gst-program-name)))
|
|
||||||
(setq *smalltalk-process* (get-buffer-process (current-buffer))))
|
|
||||||
|
|
||||||
(defun read-smalltalk-command (&optional command-line)
|
|
||||||
"Reads the program name and arguments to pass to Smalltalk,
|
|
||||||
providing COMMAND-LINE as a default (which itself defaults to
|
|
||||||
`gst-program-name'), answering the string."
|
|
||||||
(read-string "Invoke Smalltalk: " (or command-line gst-program-name)))
|
|
||||||
|
|
||||||
(defun smalltalk-file-name (str)
|
|
||||||
(if (file-name-directory str) (expand-file-name str) str))
|
|
||||||
|
|
||||||
(defun parse-smalltalk-command (&optional str)
|
|
||||||
"Parse a list of command-line arguments from STR (default
|
|
||||||
`gst-program-name'), adding --emacs-mode and answering the list."
|
|
||||||
(unless str (setq str gst-program-name))
|
|
||||||
(let (start end result-args)
|
|
||||||
(while (setq start (string-match "[^ \t]" str))
|
|
||||||
(setq end (or (string-match " " str start) (length str)))
|
|
||||||
(push (smalltalk-file-name (substring str start end)) result-args)
|
|
||||||
(if (null (cdr result-args)) (push "--emacs-mode" result-args))
|
|
||||||
(setq str (substring str end)))
|
|
||||||
(nreverse result-args)))
|
|
||||||
|
|
||||||
(defun make-gst (name &rest switches)
|
|
||||||
(let ((buffer (get-buffer-create (concat "*" name "*")))
|
|
||||||
proc status size)
|
|
||||||
(setq proc (get-buffer-process buffer))
|
|
||||||
(if proc (setq status (process-status proc)))
|
|
||||||
(save-excursion
|
|
||||||
(set-buffer buffer)
|
|
||||||
;; (setq size (buffer-size))
|
|
||||||
(if (memq status '(run stop))
|
|
||||||
nil
|
|
||||||
(if proc (delete-process proc))
|
|
||||||
(setq proc (apply 'start-process
|
|
||||||
name buffer
|
|
||||||
"env"
|
|
||||||
;; I'm choosing to leave these here
|
|
||||||
;;"-"
|
|
||||||
(format "TERMCAP=emacs:co#%d:tc=unknown:"
|
|
||||||
(frame-width))
|
|
||||||
"TERM=emacs"
|
|
||||||
"EMACS=t"
|
|
||||||
switches))
|
|
||||||
(setq name (process-name proc)))
|
|
||||||
(goto-char (point-max))
|
|
||||||
(set-marker (process-mark proc) (point))
|
|
||||||
(set-process-filter proc 'gst-filter)
|
|
||||||
(gst-mode))
|
|
||||||
buffer))
|
|
||||||
|
|
||||||
(defun gst-filter (process string)
|
|
||||||
"Make sure that the window continues to show the most recently output
|
|
||||||
text."
|
|
||||||
(let (where ch command-str)
|
|
||||||
(setq where 0) ;fake to get through the gate
|
|
||||||
(while (and string where)
|
|
||||||
(if smalltalk-command-string
|
|
||||||
(setq string (smalltalk-accum-command string)))
|
|
||||||
(if (and string
|
|
||||||
(setq where (string-match "\C-a\\|\C-b" string)))
|
|
||||||
(progn
|
|
||||||
(setq ch (aref string where))
|
|
||||||
(cond ((= ch ?\C-a) ;strip these out
|
|
||||||
(setq string (concat (substring string 0 where)
|
|
||||||
(substring string (1+ where)))))
|
|
||||||
((= ch ?\C-b) ;start of command
|
|
||||||
(setq smalltalk-command-string "") ;start this off
|
|
||||||
(setq string (substring string (1+ where))))))))
|
|
||||||
(save-excursion
|
|
||||||
(set-buffer (process-buffer process))
|
|
||||||
(goto-char (point-max))
|
|
||||||
(and string
|
|
||||||
(setq mode-status "idle")
|
|
||||||
(insert string))
|
|
||||||
(if (process-mark process)
|
|
||||||
(set-marker (process-mark process) (point-max)))))
|
|
||||||
;; (if (eq (process-buffer process)
|
|
||||||
;; (current-buffer))
|
|
||||||
;; (goto-char (point-max)))
|
|
||||||
; (save-excursion
|
|
||||||
; (set-buffer (process-buffer process))
|
|
||||||
; (goto-char (point-max))
|
|
||||||
;; (set-window-point (get-buffer-window (current-buffer)) (point-max))
|
|
||||||
; (sit-for 0))
|
|
||||||
(let ((buf (current-buffer)))
|
|
||||||
(set-buffer (process-buffer process))
|
|
||||||
(goto-char (point-max)) (sit-for 0)
|
|
||||||
(set-window-point (get-buffer-window (current-buffer)) (point-max))
|
|
||||||
(set-buffer buf)))
|
|
||||||
|
|
||||||
(defun smalltalk-accum-command (string)
|
|
||||||
(let (where)
|
|
||||||
(setq where (string-match "\C-a" string))
|
|
||||||
(setq smalltalk-command-string
|
|
||||||
(concat smalltalk-command-string (substring string 0 where)))
|
|
||||||
(if where
|
|
||||||
(progn
|
|
||||||
(unwind-protect ;found the delimiter...do it
|
|
||||||
(smalltalk-handle-command smalltalk-command-string)
|
|
||||||
(setq smalltalk-command-string nil))
|
|
||||||
;; return the remainder
|
|
||||||
(substring string where))
|
|
||||||
;; we ate it all and didn't do anything with it
|
|
||||||
nil)))
|
|
||||||
|
|
||||||
(defun smalltalk-handle-command (str)
|
|
||||||
(eval (read str)))
|
|
||||||
|
|
||||||
(defun gst-mode ()
|
|
||||||
"Major mode for interacting Smalltalk subprocesses.
|
|
||||||
|
|
||||||
Entry to this mode calls the value of gst-mode-hook with no arguments,
|
|
||||||
if that value is non-nil; likewise with the value of comint-mode-hook.
|
|
||||||
gst-mode-hook is called after comint-mode-hook."
|
|
||||||
(interactive)
|
|
||||||
(kill-all-local-variables)
|
|
||||||
(setq major-mode 'gst-mode)
|
|
||||||
(setq mode-name "GST")
|
|
||||||
(require 'comint)
|
|
||||||
(comint-mode)
|
|
||||||
(setq mode-line-format
|
|
||||||
'("" mode-line-modified mode-line-buffer-identification " "
|
|
||||||
global-mode-string " %[(" mode-name ": " mode-status
|
|
||||||
"%n" mode-line-process ")%]----" (-3 . "%p") "-%-"))
|
|
||||||
|
|
||||||
(setq comint-prompt-regexp smalltalk-prompt-pattern)
|
|
||||||
(setq comint-use-prompt-regexp t)
|
|
||||||
(use-local-map gst-mode-map)
|
|
||||||
(make-local-variable 'mode-status)
|
|
||||||
(make-local-variable 'smalltalk-command-string)
|
|
||||||
(setq smalltalk-command-string nil)
|
|
||||||
(setq mode-status "starting-up")
|
|
||||||
(run-hooks 'comint-mode-hook 'gst-mode-hook))
|
|
||||||
|
|
||||||
|
|
||||||
(defun smalltalk-print-region (start end &optional label)
|
|
||||||
(let (str filename line pos extra)
|
|
||||||
(save-excursion
|
|
||||||
(save-restriction
|
|
||||||
(goto-char (max start end))
|
|
||||||
(smalltalk-backward-whitespace)
|
|
||||||
(setq pos (point))
|
|
||||||
;canonicalize
|
|
||||||
(while (progn (smalltalk-backward-whitespace)
|
|
||||||
(or (= (preceding-char) ?!)
|
|
||||||
(= (preceding-char) ?.)))
|
|
||||||
(backward-char 1))
|
|
||||||
|
|
||||||
(setq str (buffer-substring (min start end) (point)))
|
|
||||||
(setq extra (buffer-substring (point) pos))
|
|
||||||
|
|
||||||
;; unrelated, but reusing save-excursion
|
|
||||||
(goto-char (min start end))
|
|
||||||
(setq pos (1- (point)))
|
|
||||||
(setq filename (buffer-file-name))
|
|
||||||
(widen)
|
|
||||||
(setq line (1+ (count-lines 1 (point))))))
|
|
||||||
(send-to-smalltalk (format "(%s) printNl%s\n" str extra)
|
|
||||||
(or label "eval")
|
|
||||||
(smalltalk-pos line pos))))
|
|
||||||
|
|
||||||
(defun smalltalk-eval-region (start end &optional label)
|
|
||||||
"Evaluate START to END as a Smalltalk expression in Smalltalk window.
|
|
||||||
If the expression does not end with an exclamation point, one will be
|
|
||||||
added (at no charge)."
|
|
||||||
(let (str filename line pos)
|
|
||||||
(setq str (buffer-substring start end))
|
|
||||||
(save-excursion
|
|
||||||
(save-restriction
|
|
||||||
(goto-char (min start end))
|
|
||||||
(setq pos (point))
|
|
||||||
(setq filename (buffer-file-name))
|
|
||||||
(widen)
|
|
||||||
(setq line (1+ (count-lines 1 (point))))))
|
|
||||||
(send-to-smalltalk (concat str "\n")
|
|
||||||
(or label "eval")
|
|
||||||
(smalltalk-pos line pos))))
|
|
||||||
|
|
||||||
(defun smalltalk-doit (use-line)
|
|
||||||
(interactive "P")
|
|
||||||
(let* ((start (or (mark) (point)))
|
|
||||||
(end (point))
|
|
||||||
(rgn (if (or use-line
|
|
||||||
(= start end))
|
|
||||||
(smalltalk-bound-expr)
|
|
||||||
(cons start end))))
|
|
||||||
(smalltalk-eval-region (car rgn) (cdr rgn) "doIt")))
|
|
||||||
|
|
||||||
(defun smalltalk-print (use-line)
|
|
||||||
(interactive "P")
|
|
||||||
(let* ((start (or (mark) (point)))
|
|
||||||
(end (point))
|
|
||||||
(rgn (if (or use-line
|
|
||||||
(= start end))
|
|
||||||
(smalltalk-bound-expr)
|
|
||||||
(cons start end))))
|
|
||||||
(smalltalk-print-region (car rgn) (cdr rgn) "printIt")))
|
|
||||||
|
|
||||||
(defun smalltalk-bound-expr ()
|
|
||||||
"Returns a cons of the region of the buffer that contains a smalltalk expression."
|
|
||||||
(save-excursion
|
|
||||||
(beginning-of-line)
|
|
||||||
(cons
|
|
||||||
(point)
|
|
||||||
(progn (next-line)
|
|
||||||
(smalltalk-backward-whitespace)
|
|
||||||
(point)))))
|
|
||||||
|
|
||||||
(defun smalltalk-pos (line pos)
|
|
||||||
(let ((filename (buffer-file-name)))
|
|
||||||
(if filename (list line filename pos) nil)))
|
|
||||||
|
|
||||||
(defun smalltalk-compile (start end)
|
|
||||||
(interactive "r")
|
|
||||||
(let ((str (buffer-substring start end))
|
|
||||||
(filename (buffer-file-name))
|
|
||||||
(pos start)
|
|
||||||
(line (save-excursion
|
|
||||||
(save-restriction
|
|
||||||
(widen)
|
|
||||||
(setq line (1+ (line-number-at-pos start)))))))
|
|
||||||
(send-to-smalltalk str "compile"
|
|
||||||
(smalltalk-pos line pos))))
|
|
||||||
|
|
||||||
(defun smalltalk-quote-strings (str)
|
|
||||||
(let (new-str)
|
|
||||||
(save-excursion
|
|
||||||
(set-buffer (get-buffer-create " st-dummy "))
|
|
||||||
(erase-buffer)
|
|
||||||
(insert str)
|
|
||||||
(goto-char 1)
|
|
||||||
(while (and (not (eobp))
|
|
||||||
(search-forward "'" nil 'to-end))
|
|
||||||
(insert "'"))
|
|
||||||
(buffer-string))))
|
|
||||||
|
|
||||||
(defun smalltalk-snapshot (&optional snapshot-name)
|
|
||||||
(interactive (if current-prefix-arg
|
|
||||||
(list (setq snapshot-name
|
|
||||||
(expand-file-name
|
|
||||||
(read-file-name "Snapshot to: "))))))
|
|
||||||
(if snapshot-name
|
|
||||||
(send-to-smalltalk (format "ObjectMemory snapshot: '%s'\n" "Snapshot"))
|
|
||||||
(send-to-smalltalk "ObjectMemory snapshot\n" "Snapshot")))
|
|
||||||
|
|
||||||
(defun smalltalk-quit ()
|
|
||||||
"Terminate the Smalltalk session and associated process. Emacs remains
|
|
||||||
running."
|
|
||||||
(interactive)
|
|
||||||
(send-to-smalltalk "! ! ObjectMemory quit!" "Quitting"))
|
|
||||||
|
|
||||||
(defun smalltalk-filein (filename)
|
|
||||||
"Do a FileStream>>fileIn: on FILENAME."
|
|
||||||
(interactive "fSmalltalk file to load: ")
|
|
||||||
(send-to-smalltalk (format "FileStream fileIn: '%s'\n"
|
|
||||||
(expand-file-name filename))
|
|
||||||
"fileIn"))
|
|
||||||
|
|
||||||
(defun smalltalk-filein-buffer ()
|
|
||||||
(interactive)
|
|
||||||
(send-to-smalltalk (buffer-string) "fileIn" (smalltalk-pos 1 1)))
|
|
||||||
|
|
||||||
(defun smalltalk-toggle-decl-tracing ()
|
|
||||||
(interactive)
|
|
||||||
(send-to-smalltalk
|
|
||||||
"Smalltalk declarationTrace: Smalltalk declarationTrace not\n"))
|
|
||||||
|
|
||||||
(defun smalltalk-toggle-exec-tracing ()
|
|
||||||
(interactive)
|
|
||||||
(send-to-smalltalk
|
|
||||||
"Smalltalk executionTrace: Smalltalk executionTrace not\n"))
|
|
||||||
|
|
||||||
|
|
||||||
(defun smalltalk-toggle-verbose-exec-tracing ()
|
|
||||||
(interactive)
|
|
||||||
(send-to-smalltalk
|
|
||||||
"Smalltalk verboseTrace: Smalltalk verboseTrace not\n"))
|
|
||||||
|
|
||||||
(defun send-to-smalltalk (str &optional mode fileinfo)
|
|
||||||
(save-window-excursion
|
|
||||||
(gst gst-program-name)
|
|
||||||
(save-excursion
|
|
||||||
(goto-char (point-max))
|
|
||||||
(beginning-of-line)
|
|
||||||
(if (looking-at smalltalk-prompt-pattern)
|
|
||||||
(progn (end-of-line)
|
|
||||||
(insert "\n"))))
|
|
||||||
|
|
||||||
(if mode (setq mode-status mode))
|
|
||||||
|
|
||||||
(if fileinfo
|
|
||||||
(let (temp-file buf switch-back old-buf)
|
|
||||||
(setq temp-file (concat "/tmp/" (make-temp-name "gst")))
|
|
||||||
(save-excursion
|
|
||||||
(setq buf (get-buffer-create " zap-buffer "))
|
|
||||||
(set-buffer buf)
|
|
||||||
(erase-buffer)
|
|
||||||
(princ str buf)
|
|
||||||
(write-region (point-min) (point-max) temp-file nil 'no-message)
|
|
||||||
)
|
|
||||||
(kill-buffer buf)
|
|
||||||
(process-send-string
|
|
||||||
*smalltalk-process*
|
|
||||||
(format
|
|
||||||
"FileStream fileIn: '%s' line: %d from: '%s' at: %d\n"
|
|
||||||
temp-file (nth 0 fileinfo) (nth 1 fileinfo) (nth 2 fileinfo))))
|
|
||||||
(comint-send-string *smalltalk-process* str))
|
|
||||||
(switch-to-buffer-other-window (process-buffer *smalltalk-process*))))
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'gst-mode)
|
|
File diff suppressed because it is too large
Load diff
0
contrib/unityjs-mode.el
Executable file → Normal file
0
contrib/unityjs-mode.el
Executable file → Normal file
Binary file not shown.
|
@ -1,39 +0,0 @@
|
||||||
|
|
||||||
(defconst yt-stopwatch-script-path (file-name-directory load-file-name))
|
|
||||||
|
|
||||||
(defun yt-stopwatch-record-time ()
|
|
||||||
(interactive)
|
|
||||||
(beginning-of-line)
|
|
||||||
(insert (format "* %ss - " (yt-stopwatch--reformat-time (cdr (yt-stopwatch--probe))))))
|
|
||||||
|
|
||||||
(defun yt-stopwatch--reformat-time (seconds)
|
|
||||||
(format-time-string "%H:%M:%S" (encode-time (string-to-number (car seconds)) 0 0 0 0 0)))
|
|
||||||
|
|
||||||
(defun yt-stopwatch-video-name ()
|
|
||||||
(interactive)
|
|
||||||
(beginning-of-line)
|
|
||||||
(insert (format "%s\n" (car (yt-stopwatch--probe)))))
|
|
||||||
|
|
||||||
(defun yt-stopwatch--probe ()
|
|
||||||
(let ((out (shell-command-to-string (format "osascript %s/probe.scpt" yt-stopwatch-script-path))))
|
|
||||||
(if (string-equal out "---\n")
|
|
||||||
(user-error "VLC isn't running or no video playing")
|
|
||||||
(split-string out " || " t "[\n \t]+"))))
|
|
||||||
|
|
||||||
(defun yt-stopwatch-test ()
|
|
||||||
(interactive)
|
|
||||||
(let ((data (yt-stopwatch--probe)))
|
|
||||||
(message "Video: %s \n Time: %ss" (car data) (cdr data))))
|
|
||||||
|
|
||||||
(defvar yt-stopwatch-mode-map
|
|
||||||
(let ((map (make-sparse-keymap)))
|
|
||||||
(define-key map (kbd "C-c y") 'yt-stopwatch-record-time)
|
|
||||||
(define-key map (kbd "C-c C-y") 'yt-stopwatch-video-name)
|
|
||||||
map))
|
|
||||||
|
|
||||||
(define-minor-mode yt-stopwatch-mode
|
|
||||||
:keymap yt-stopwatch-mode-map
|
|
||||||
:group yt-stopwatch-mode)
|
|
||||||
|
|
||||||
(provide 'yt-stopwatch)
|
|
||||||
;;; yt-stopwatch.el ends here
|
|
|
@ -1,48 +0,0 @@
|
||||||
;; Global editor behavior
|
|
||||||
(use-package expand-region
|
|
||||||
:commands (er/expand-region er/contract-region))
|
|
||||||
|
|
||||||
(use-package rotate-text
|
|
||||||
:commands (rotate-word-at-point rotate-region))
|
|
||||||
|
|
||||||
(use-package smartparens
|
|
||||||
:config
|
|
||||||
(progn
|
|
||||||
(require 'smartparens-config)
|
|
||||||
|
|
||||||
(smartparens-global-mode 1)
|
|
||||||
|
|
||||||
(setq blink-matching-paren t)
|
|
||||||
(setq sp-autowrap-region nil ; let evil-surround handle this
|
|
||||||
sp-highlight-pair-overlay nil
|
|
||||||
sp-show-pair-delay 0
|
|
||||||
sp-autoescape-string-quote nil)
|
|
||||||
|
|
||||||
;; Handle newlines + spaces
|
|
||||||
(sp-pair "{" "}" :post-handlers '(("||\n[i]" "RET") ("| " " ")) :unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
(sp-pair "(" ")" :post-handlers '(("||\n[i]" "RET") ("| " " ")) :unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
|
|
||||||
;; Auto-close more conservatively
|
|
||||||
(sp-pair "[" nil :unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
(sp-pair "'" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
(sp-pair "\"" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
|
|
||||||
(sp-with-modes '(json-mode js2-mode ruby-mode enh-ruby-mode python-mode)
|
|
||||||
(sp-local-pair "[" nil :post-handlers '(("||\n[i]" "RET"))))
|
|
||||||
|
|
||||||
(sp-with-modes '(c-mode c++-mode objc-mode java-mode scss-mode css-mode php-mode)
|
|
||||||
(sp-local-pair "/* " " */" :post-handlers '(("||\n[i]" "RET")))
|
|
||||||
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET"))))
|
|
||||||
|
|
||||||
(sp-with-modes '(objc-mode scss-mode css-mode)
|
|
||||||
(sp-local-pair "/*\n" "\n */" :post-handlers '(("||[i]" "RET"))))
|
|
||||||
|
|
||||||
(sp-with-modes '(c-mode c++-mode php-mode java-mode)
|
|
||||||
(sp-local-pair "/*" "" :post-handlers '((" ||\n[i]*/" "RET"))))
|
|
||||||
|
|
||||||
(after "yasnippet"
|
|
||||||
(defadvice yas-expand (before advice-for-yas-expand activate)
|
|
||||||
(sp-remove-active-pair-overlay)))))
|
|
||||||
|
|
||||||
(provide 'core-editor)
|
|
||||||
;;; core-editor.el ends here
|
|
|
@ -1,3 +0,0 @@
|
||||||
(provide 'core-linux)
|
|
||||||
|
|
||||||
;; Nothing here yet
|
|
326
core/core.el
326
core/core.el
|
@ -1,326 +0,0 @@
|
||||||
(defconst is-mac (eq system-type 'darwin))
|
|
||||||
(defconst is-linux (eq system-type 'gnu/linux))
|
|
||||||
(defconst is-windows (eq system-type 'windows-nt))
|
|
||||||
|
|
||||||
(when is-linux (add-to-list 'load-path "~/.cask"))
|
|
||||||
(setq use-package-verbose DEBUG-MODE)
|
|
||||||
|
|
||||||
(cd "~") ; instead of /
|
|
||||||
|
|
||||||
;; Make sure undo/backup folders exist
|
|
||||||
(defconst my-tmp-dir-undo (expand-file-name "undo" my-tmp-dir))
|
|
||||||
(defconst my-tmp-dir-backup (expand-file-name "backup" my-tmp-dir))
|
|
||||||
(defconst my-tmp-dir-autosave (expand-file-name "autosave" my-tmp-dir))
|
|
||||||
(unless (file-directory-p my-tmp-dir)
|
|
||||||
(make-directory my-tmp-dir-undo t)
|
|
||||||
(make-directory my-tmp-dir-backup t)
|
|
||||||
(make-directory my-tmp-dir-autosave t))
|
|
||||||
|
|
||||||
;; (setq load-prefer-newer t)
|
|
||||||
(setq debug-on-quit DEBUG-MODE)
|
|
||||||
|
|
||||||
(require 'shut-up)
|
|
||||||
(setq shut-up-ignore DEBUG-MODE)
|
|
||||||
(when noninteractive (shut-up-silence-emacs)) ; http://youtu.be/Z6woIRLnbmE
|
|
||||||
|
|
||||||
(shut-up
|
|
||||||
;;;; Sane defaults ;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
(line-number-mode 1) ; hide line no in modeline
|
|
||||||
(column-number-mode 1) ; hide col no in modeline
|
|
||||||
(auto-compression-mode t) ; Transparently open compressed files
|
|
||||||
(global-font-lock-mode t) ; Enable syntax highlighting for older emacs
|
|
||||||
(global-auto-revert-mode 1) ; revert buffers for changed files
|
|
||||||
(electric-indent-mode 1)
|
|
||||||
(setq electric-indent-chars '(? ?: ?{))
|
|
||||||
|
|
||||||
;;; window layout undo/redo
|
|
||||||
(setq winner-boring-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
|
|
||||||
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
|
|
||||||
"*Buffer List*" "*Ibuffer*" "*esh command on file*"))
|
|
||||||
(winner-mode 1)
|
|
||||||
|
|
||||||
(setq semanticdb-default-save-directory (expand-file-name "semanticdb" my-tmp-dir))
|
|
||||||
(semantic-mode 1)
|
|
||||||
|
|
||||||
;;; UTF-8 please
|
|
||||||
(setq locale-coding-system 'utf-8) ; pretty
|
|
||||||
(set-terminal-coding-system 'utf-8) ; pretty
|
|
||||||
(set-keyboard-coding-system 'utf-8) ; pretty
|
|
||||||
(set-selection-coding-system 'utf-8) ; please
|
|
||||||
(prefer-coding-system 'utf-8) ; with sugar on top
|
|
||||||
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
|
||||||
|
|
||||||
;;; Show tab characters
|
|
||||||
;; (global-whitespace-mode 1)
|
|
||||||
(setq whitespace-style '(trailing face tabs tab-mark) ; needs to be re-set in every buffer
|
|
||||||
whitespace-display-mappings
|
|
||||||
'((tab-mark ?\t [?| ?\t] [?\\ ?\t])
|
|
||||||
(newline-mark 10 [36 10]))) ; for whitespace-newline-mode
|
|
||||||
|
|
||||||
;; avoid garbage collection (default is 400k)
|
|
||||||
(setq-default gc-cons-threshold 20000000)
|
|
||||||
(setq-default confirm-kill-emacs nil)
|
|
||||||
|
|
||||||
(setq-default fill-column 80)
|
|
||||||
|
|
||||||
;; minibufferception? Yay!
|
|
||||||
(setq-default enable-recursive-minibuffers t)
|
|
||||||
|
|
||||||
;; Sane scroll settings
|
|
||||||
(setq scroll-margin 5)
|
|
||||||
(setq scroll-conservatively 9999)
|
|
||||||
(setq scroll-preserve-screen-position 1)
|
|
||||||
|
|
||||||
;; Show me those keystrokes
|
|
||||||
(setq echo-keystrokes 0.02)
|
|
||||||
|
|
||||||
;; I'll use visual mode, kthxbai
|
|
||||||
(setq shift-select-mode nil)
|
|
||||||
|
|
||||||
(setq ring-bell-function 'ignore)
|
|
||||||
|
|
||||||
(setq inhibit-startup-screen t) ; don't show EMACs start screen
|
|
||||||
(setq inhibit-splash-screen t)
|
|
||||||
(setq inhibit-startup-buffer-menu t)
|
|
||||||
|
|
||||||
(setq initial-major-mode 'text-mode) ; initial scratch buffer mode
|
|
||||||
(setq initial-scratch-message nil)
|
|
||||||
(setq initial-scratch-buffer nil) ; empty scratch buffer
|
|
||||||
|
|
||||||
(setq compilation-always-kill t)
|
|
||||||
(setq compilation-ask-about-save nil)
|
|
||||||
(setq compilation-scroll-output t)
|
|
||||||
|
|
||||||
(setq sentence-end-double-space nil) ; sentences end with periods. Period.
|
|
||||||
|
|
||||||
(setq show-paren-delay 0)
|
|
||||||
|
|
||||||
(setq ediff-diff-options "-w")
|
|
||||||
(setq ediff-split-window-function 'split-window-horizontally) ; side-by-side diffs
|
|
||||||
(setq ediff-window-setup-function 'ediff-setup-windows-plain) ; no extra frames
|
|
||||||
|
|
||||||
;; Fixes C-i's synonymity with TAB
|
|
||||||
(keyboard-translate ?\C-i ?\H-i)
|
|
||||||
|
|
||||||
;; Don't save clipboard contents into kill-ring before replacing them
|
|
||||||
(setq save-interprogram-paste-before-kill nil)
|
|
||||||
|
|
||||||
;; don't let the cursor go into minibuffer prompt
|
|
||||||
;; Tip taken from Xah Lee: http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
|
||||||
(setq minibuffer-prompt-properties
|
|
||||||
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt))
|
|
||||||
|
|
||||||
;; remove annoying ellipsis when printing sexp in message buffer
|
|
||||||
(setq eval-expression-print-length nil
|
|
||||||
eval-expression-print-level nil)
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Backup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; Disable all backups (that's what git/dropbox are for)
|
|
||||||
(setq bookmark-save-flag t)
|
|
||||||
(setq bookmark-default-file (expand-file-name "bookmarks" my-tmp-dir))
|
|
||||||
(setq auto-save-default nil)
|
|
||||||
(setq auto-save-list-file-name (expand-file-name ".auto-save" my-tmp-dir-autosave))
|
|
||||||
(setq auto-save-file-name-transforms `((".*" ,my-tmp-dir-autosave t)))
|
|
||||||
;; In case I want to reactivate backup files
|
|
||||||
(setq make-backup-files nil)
|
|
||||||
(setq create-lockfiles nil)
|
|
||||||
(setq backup-directory-alist `((".*" . ,my-tmp-dir-backup)))
|
|
||||||
;; Remember undo history
|
|
||||||
(setq-default undo-tree-auto-save-history t)
|
|
||||||
(setq-default undo-tree-history-directory-alist `(("." . ,my-tmp-dir-undo)))
|
|
||||||
|
|
||||||
;; Save history across sessions
|
|
||||||
(require 'savehist)
|
|
||||||
(setq savehist-file (concat my-tmp-dir "savehist") ; keep the home clean
|
|
||||||
history-length 1000
|
|
||||||
savehist-additional-variables '(kill-ring
|
|
||||||
global-mark-ring
|
|
||||||
search-ring
|
|
||||||
regexp-search-ring
|
|
||||||
extended-command-history))
|
|
||||||
(savehist-mode 1)
|
|
||||||
|
|
||||||
;; Save cursor location across sessions
|
|
||||||
(require 'saveplace)
|
|
||||||
(setq-default save-place-file (concat my-tmp-dir "saveplace"))
|
|
||||||
;; activate save-place only for files that exist
|
|
||||||
(add-hook 'find-file-hook (lambda() (if (file-exists-p buffer-file-name) (setq save-place t))))
|
|
||||||
|
|
||||||
(require 'recentf)
|
|
||||||
(setq recentf-save-file (concat my-tmp-dir "recentf"))
|
|
||||||
(setq recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last\\'" "\\.revive\\'", "/TAGS\\'"))
|
|
||||||
(setq recentf-max-menu-items 0)
|
|
||||||
(setq recentf-max-saved-items 1000)
|
|
||||||
(setq recentf-auto-cleanup 'never)
|
|
||||||
(add-hook 'kill-emacs-hook 'recentf-cleanup)
|
|
||||||
(recentf-mode 1)
|
|
||||||
|
|
||||||
;; What we do every night, Pinkie...
|
|
||||||
(defun display-startup-echo-area-message ()
|
|
||||||
(message "What're we gonna do tonight, Brain? (Loaded in %s)" (emacs-init-time)))
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
|
||||||
;; spaces instead of tabs
|
|
||||||
(setq-default indent-tabs-mode nil) ; spaces instead of tabs
|
|
||||||
(setq-default tab-always-indent t)
|
|
||||||
(setq-default tab-width 4)
|
|
||||||
|
|
||||||
(setq require-final-newline t)
|
|
||||||
(setq delete-trailing-lines nil)
|
|
||||||
(add-hook 'makefile-mode-hook (lambda () (setq indent-tabs-mode t))) ; Use normal tabs in makefiles
|
|
||||||
|
|
||||||
;; Project defuns ;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
(require 'f)
|
|
||||||
|
|
||||||
(defvar project-root-files '(".git" ".hg" ".svn" ".project" "local.properties" "project.properties")
|
|
||||||
"A list of files that count as 'project files', which determine whether a
|
|
||||||
folder is the root of a project or not.")
|
|
||||||
(defun project-root (&optional strict-p)
|
|
||||||
"Get the path to the root of your project. Uses `project-root-files' to
|
|
||||||
determine if a directory is a project."
|
|
||||||
(catch 'found
|
|
||||||
(f-traverse-upwards
|
|
||||||
(lambda (path)
|
|
||||||
(let ((path (file-truename path))
|
|
||||||
(home (file-truename "~")))
|
|
||||||
(if (f-equal? home path)
|
|
||||||
(throw 'found (if strict-p nil default-directory))
|
|
||||||
(dolist (file project-root-files)
|
|
||||||
(when (f-exists? (expand-file-name file path))
|
|
||||||
(throw 'found path)))))) default-directory)
|
|
||||||
default-directory))
|
|
||||||
|
|
||||||
(defun project-has-files (files &optional root)
|
|
||||||
"Return non-nil if `file' exists in the project root."
|
|
||||||
(let ((root (or root (project-root)))
|
|
||||||
(files (if (listp files) files (list files)))
|
|
||||||
found-p file)
|
|
||||||
(while (and files (not found-p))
|
|
||||||
(setq file (pop files))
|
|
||||||
(setq found-p (f-exists? (project-path-to file root))))
|
|
||||||
found-p))
|
|
||||||
|
|
||||||
(defun project-path-to (file &optional root)
|
|
||||||
(let ((root (or root (project-root))))
|
|
||||||
(expand-file-name file root)))
|
|
||||||
|
|
||||||
(defun project-name ()
|
|
||||||
(file-name-nondirectory (directory-file-name (project-root))))
|
|
||||||
|
|
||||||
(defun project-p ()
|
|
||||||
(not (null (project-root t))))
|
|
||||||
|
|
||||||
;; Make sure scratch buffer is always "in a project"
|
|
||||||
(defvar project-scratch-buffer nil)
|
|
||||||
(defun project-create-scratch-buffer ()
|
|
||||||
(let* ((scratch-buffer (get-buffer-create "*scratch*"))
|
|
||||||
(project-name (project-name))
|
|
||||||
(root (project-root)))
|
|
||||||
(mapc (lambda (b)
|
|
||||||
(if (string-match-p "\\*scratch\\* (.+)" (buffer-name b))
|
|
||||||
(kill-buffer b)))
|
|
||||||
(buffer-list))
|
|
||||||
(save-window-excursion
|
|
||||||
(switch-to-buffer scratch-buffer)
|
|
||||||
(setq project-scratch-buffer scratch-buffer)
|
|
||||||
(erase-buffer)
|
|
||||||
(cd root)
|
|
||||||
(rename-buffer (format "*scratch* (%s)" project-name)))))
|
|
||||||
(add-hook 'find-file-hook 'project-create-scratch-buffer)
|
|
||||||
|
|
||||||
|
|
||||||
;; Automatic minor modes ;;;;;;;;;;;
|
|
||||||
(defvar auto-minor-mode-alist ()
|
|
||||||
"Alist of filename patterns vs correpsonding minor mode functions,
|
|
||||||
see `auto-mode-alist' All elements of this alist are checked, meaning
|
|
||||||
you can enable multiple minor modes for the same regexp.")
|
|
||||||
(defun enable-minor-mode-based-on-path ()
|
|
||||||
"check file name against auto-minor-mode-alist to enable minor modes
|
|
||||||
the checking happens for all pairs in auto-minor-mode-alist"
|
|
||||||
(when buffer-file-name
|
|
||||||
(let ((name buffer-file-name)
|
|
||||||
(remote-id (file-remote-p buffer-file-name))
|
|
||||||
(alist auto-minor-mode-alist))
|
|
||||||
;; Remove backup-suffixes from file name.
|
|
||||||
(setq name (file-name-sans-versions name))
|
|
||||||
;; Remove remote file name identification.
|
|
||||||
(when (and (stringp remote-id)
|
|
||||||
(string-match-p (regexp-quote remote-id) name))
|
|
||||||
(setq name (substring name (match-end 0))))
|
|
||||||
(while (and alist (caar alist) (cdar alist))
|
|
||||||
(if (string-match (caar alist) name)
|
|
||||||
(funcall (cdar alist) 1))
|
|
||||||
(setq alist (cdr alist))))))
|
|
||||||
(add-hook 'find-file-hook 'enable-minor-mode-based-on-path)
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Utility plugins ;;;;;;;;;;;;;;;;;;
|
|
||||||
(require 'defuns)
|
|
||||||
(require 'autoloads) ; use make autoloads to generate autoloads file
|
|
||||||
|
|
||||||
(use-package smex
|
|
||||||
:commands (smex smex-major-mode-commands)
|
|
||||||
:config
|
|
||||||
(progn
|
|
||||||
(smex-initialize)
|
|
||||||
;; Hook up smex to auto-update, rather than update on every run
|
|
||||||
(defun smex-update-after-load (unused)
|
|
||||||
(when (boundp 'smex-cache) (smex-update)))
|
|
||||||
(add-hook 'after-load-functions 'smex-update-after-load)))
|
|
||||||
|
|
||||||
(use-package popwin
|
|
||||||
:config
|
|
||||||
(progn ; popwin config
|
|
||||||
(popwin-mode 1)
|
|
||||||
(setq popwin:popup-window-height 0.45)
|
|
||||||
;; (setq display-buffer-function 'popwin:display-buffer)
|
|
||||||
|
|
||||||
(push '("\\`\\*helm.*?\\*\\'" :regexp t :position bottom :height 15) popwin:special-display-config)
|
|
||||||
|
|
||||||
(push '("^\\*Flycheck.*\\*$" :regexp t :position bottom :height 0.25 :noselect t) popwin:special-display-config)
|
|
||||||
(push '(inf-enh-ruby-mode :position bottom :stick t) popwin:special-display-config)
|
|
||||||
(push '(snippet-mode :position bottom :stick t) popwin:special-display-config)
|
|
||||||
(push '("^\\*eclim.*\\*" :regexp t :position bottom :height 0.25) popwin:special-display-config)
|
|
||||||
|
|
||||||
(push '("*ansi-term*" :position bottom :height 0.45 :stick t) popwin:special-display-config)
|
|
||||||
(push '("*terminal*" :position bottom :height 0.45 :stick t) popwin:special-display-config)
|
|
||||||
(push '("*Async Shell Command*" :position bottom) popwin:special-display-config)
|
|
||||||
(push '("*Shell Command Output*" :position bottom :stick t :height 15) popwin:special-display-config)
|
|
||||||
|
|
||||||
(push '("* Regexp Explain *" :position top :height 0.35) popwin:special-display-config)
|
|
||||||
|
|
||||||
(push '("*anaconda-doc*" :position bottom :height 15 :noselect t) popwin:special-display-config)
|
|
||||||
(push '("*anaconda-nav*" :position bottom :height 15 :stick t) popwin:special-display-config)
|
|
||||||
(push '("^\\*Python.+\\*$" :regexp t :position bottom :height 20 :noselect t) popwin:special-display-config)
|
|
||||||
|
|
||||||
(push '(help-mode :height 0.5 :position bottom :stick t) popwin:special-display-config)
|
|
||||||
(push '(compilation-mode :height 0.5 :position bottom :noselect t) popwin:special-display-config)
|
|
||||||
(push '(diff-mode :position bottom :stick t) popwin:special-display-config)
|
|
||||||
(push '("*Backtrace*") popwin:special-display-config)
|
|
||||||
(push '("*Warnings*") popwin:special-display-config)
|
|
||||||
(push '("*Process List*") popwin:special-display-config)
|
|
||||||
(push '("*Compile-Log*" :height 0.3 :position bottom :noselect t) popwin:special-display-config)
|
|
||||||
(push '(" *undo-tree*" :width 0.3 :position right) popwin:special-display-config)
|
|
||||||
(push '("^\\*scratch\\*.*" :regexp t :stick t) popwin:special-display-config)
|
|
||||||
(push '(image-mode) popwin:special-display-config)
|
|
||||||
|
|
||||||
(defun popwin:toggle-popup-window ()
|
|
||||||
(interactive)
|
|
||||||
(if (popwin:popup-window-live-p)
|
|
||||||
(popwin:close-popup-window)
|
|
||||||
(popwin:popup-last-buffer)))))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
(cond (is-mac (require 'core-osx))
|
|
||||||
(is-linux (require 'core-linux))
|
|
||||||
(is-windows (require 'core-windows)))
|
|
||||||
|
|
||||||
(require 'server)
|
|
||||||
(unless (server-running-p) (server-start)))
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'core)
|
|
||||||
;;; core.el ends here
|
|
4
dict/android-mode
Executable file
4
dict/android-mode
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
RelativeLayout
|
||||||
|
LinearLayout
|
||||||
|
ImageView
|
||||||
|
TextView
|
|
@ -45,6 +45,7 @@ java.sql
|
||||||
java.text
|
java.text
|
||||||
java.text.spi
|
java.text.spi
|
||||||
java.util
|
java.util
|
||||||
|
java.util
|
||||||
java.util.concurrent
|
java.util.concurrent
|
||||||
java.util.concurrent.atomic
|
java.util.concurrent.atomic
|
||||||
java.util.concurrent.locks
|
java.util.concurrent.locks
|
||||||
|
@ -4222,4 +4223,4 @@ _ServantLocatorStub
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -27,4 +27,4 @@ mouse
|
||||||
physics
|
physics
|
||||||
sound
|
sound
|
||||||
thread
|
thread
|
||||||
timer
|
timer
|
||||||
|
|
42
init.el
42
init.el
|
@ -16,41 +16,37 @@
|
||||||
;; * *<defun/var-name> ; for altering the visual state
|
;; * *<defun/var-name> ; for altering the visual state
|
||||||
;;
|
;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(defvar DEBUG-MODE nil)
|
(defconst DEBUG-MODE nil)
|
||||||
|
|
||||||
(defvar my-dir user-emacs-directory)
|
(defconst my-dir user-emacs-directory)
|
||||||
(defvar my-core-dir (concat my-dir "core/"))
|
(defconst my-modules-dir (concat my-dir "init/"))
|
||||||
(defvar my-modules-dir (concat my-dir "init/"))
|
(defconst my-contrib-dir (concat my-dir "contrib/"))
|
||||||
(defvar my-contrib-dir (concat my-dir "contrib/"))
|
(defconst my-themes-dir (concat my-dir "themes/"))
|
||||||
(defvar my-themes-dir (concat my-dir "themes/"))
|
(defconst my-snippets-dir (concat my-dir "snippets/"))
|
||||||
(defvar my-snippets-dir (concat my-dir "snippets/"))
|
(defconst my-tmp-dir (concat my-dir ".cache/"))
|
||||||
(defvar my-tmp-dir (concat my-dir ".cache/"))
|
|
||||||
|
|
||||||
(defvar *dark-theme 'v0)
|
(defconst *dark-theme 'v0)
|
||||||
(defvar *light-theme 'github) ; wtb better light theme...
|
(defconst *light-theme 'github) ; wtb better light theme...
|
||||||
(defvar *fonts `(,(font-spec :family "Terminus (TTF)" :size 12 :antialias nil)
|
(defconst *fonts `(,(font-spec :family "Terminus (TTF)" :size 12 :antialias nil)
|
||||||
,(font-spec :family "Inconsolata" :size 14 :antialias t)
|
,(font-spec :family "Inconsolata" :size 14 :antialias t)
|
||||||
,(font-spec :family "Ubuntu Mono" :size 20 :antialias t)
|
,(font-spec :family "Ubuntu Mono" :size 20 :antialias t)
|
||||||
))
|
))
|
||||||
|
|
||||||
(push my-core-dir load-path)
|
|
||||||
(push my-modules-dir load-path)
|
(push my-modules-dir load-path)
|
||||||
(push my-contrib-dir load-path)
|
(push my-contrib-dir load-path)
|
||||||
;; Add elisp and cask dirs to load-path
|
;; Add cask dirs to load-path
|
||||||
(let ((default-directory my-contrib-dir))
|
|
||||||
(normal-top-level-add-subdirs-to-load-path))
|
|
||||||
(let ((default-directory (expand-file-name (concat ".cask/" emacs-version "/elpa/") my-dir)))
|
(let ((default-directory (expand-file-name (concat ".cask/" emacs-version "/elpa/") my-dir)))
|
||||||
(normal-top-level-add-subdirs-to-load-path))
|
(normal-top-level-add-subdirs-to-load-path))
|
||||||
|
|
||||||
|
;;;; Load Packages ;;;;;;;;;;;;;;;;;;;;;
|
||||||
(require 'use-package)
|
(require 'use-package)
|
||||||
(mapc 'require
|
(mapc 'require
|
||||||
;; ls init/{init,my}* | xargs basename | sed -e 's/\..*$//'
|
;; ls init/{init,my}* | xargs basename | sed -e 's/\..*$//'
|
||||||
'(core
|
'(core
|
||||||
core-ui ; aesthetics
|
core-ui ; aesthetics
|
||||||
core-evil ; evil-mode and its plugins
|
core-evil ; evil-mode and its plugins
|
||||||
core-editor ; expand-region, rotate-text, smartparens
|
core-editor ; completing the editor
|
||||||
|
|
||||||
;; init-auto-complete
|
|
||||||
init-auto-insert ; for the lazy typis
|
init-auto-insert ; for the lazy typis
|
||||||
init-company ; see above
|
init-company ; see above
|
||||||
init-fly ; fly(check|spell)
|
init-fly ; fly(check|spell)
|
||||||
|
@ -60,10 +56,8 @@
|
||||||
init-project ; project tools: dired, neotree
|
init-project ; project tools: dired, neotree
|
||||||
|
|
||||||
init-cc ; C/C++/Obj-C madness
|
init-cc ; C/C++/Obj-C madness
|
||||||
;; init-d ; D - It's C, but better!
|
|
||||||
;; init-cscope
|
;; init-cscope
|
||||||
init-csharp
|
init-csharp
|
||||||
;; init-erlang
|
|
||||||
;; init-eshell
|
;; init-eshell
|
||||||
init-go
|
init-go
|
||||||
init-java ; the poster child for carpal tunnel syndome
|
init-java ; the poster child for carpal tunnel syndome
|
||||||
|
@ -75,17 +69,15 @@
|
||||||
init-regex ; /^[^\s](meaning)[^\n]*/
|
init-regex ; /^[^\s](meaning)[^\n]*/
|
||||||
init-ruby ; <3
|
init-ruby ; <3
|
||||||
init-scss ; @include magic;
|
init-scss ; @include magic;
|
||||||
init-smalltalk ; nice weather we're having
|
|
||||||
init-sh ; #!/bin/bash_your_head_in
|
init-sh ; #!/bin/bash_your_head_in
|
||||||
init-swift ; yay, emoji variables!
|
init-swift ; yay, emoji variables!
|
||||||
init-text ; I got nothing...
|
init-text ; I got nothing...
|
||||||
init-tmux
|
init-tmux
|
||||||
;; init-rust
|
;; init-rust
|
||||||
;; init-vala
|
;; init-R
|
||||||
init-web
|
init-web
|
||||||
init-workgroups
|
init-workgroups
|
||||||
init-yasnippet ; type for me
|
init-yasnippet ; type for me
|
||||||
init-youtube ; tools for youtube vids
|
|
||||||
|
|
||||||
my-defuns
|
my-defuns
|
||||||
my-bindings
|
my-bindings
|
||||||
|
|
173
init/core-editor.el
Normal file
173
init/core-editor.el
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
;; Global editor behavior
|
||||||
|
(electric-indent-mode 1)
|
||||||
|
(setq electric-indent-chars '(? ?: ?{))
|
||||||
|
(add-hook! 'org-mode-hook (electric-indent-mode -1))
|
||||||
|
|
||||||
|
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
|
||||||
|
|
||||||
|
(setq-default fill-column 80)
|
||||||
|
;; Sane scroll settings
|
||||||
|
(setq scroll-margin 5)
|
||||||
|
(setq scroll-conservatively 9999)
|
||||||
|
(setq scroll-preserve-screen-position 1)
|
||||||
|
;; I'll use visual mode, kthxbai
|
||||||
|
(setq shift-select-mode nil)
|
||||||
|
|
||||||
|
;;;; Modes 'n hooks ;;;;;;;;;;;;;;;;;
|
||||||
|
(associate-mode "/LICENSE[^/]*$" 'text-mode)
|
||||||
|
(associate-mode "zsh\\(env\\|rc\\)?$" 'sh-mode)
|
||||||
|
(associate-mode "z\\(profile\\|login\\|logout\\)?$" 'sh-mode)
|
||||||
|
(associate-mode "zsh/" 'sh-mode)
|
||||||
|
(associate-mode "\\.applescript$" 'applescript-mode)
|
||||||
|
(associate-mode "Cask$" 'emacs-lisp-mode)
|
||||||
|
(associate-mode "\\.el\\.gz$" 'emacs-lisp-mode)
|
||||||
|
(associate-mode "/Makefile$" 'makefile-gmake-mode)
|
||||||
|
(associate-mode "\\.plist$" 'nxml-mode)
|
||||||
|
|
||||||
|
(add-hook 'help-mode-hook 'visual-line-mode)
|
||||||
|
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||||
|
|
||||||
|
;; (setenv "SHELL" (s-trim (shell-command-to-string "which zsh")))
|
||||||
|
(setenv "SHELL" "/usr/local/bin/zsh")
|
||||||
|
(setenv "EMACS" "1")
|
||||||
|
|
||||||
|
;; show-paren faces
|
||||||
|
(set-face-background 'show-paren-match nil)
|
||||||
|
(set-face-foreground 'show-paren-match "orange")
|
||||||
|
(set-face-attribute 'show-paren-match nil :weight 'extra-bold)
|
||||||
|
(setq show-paren-delay 0)
|
||||||
|
|
||||||
|
(let ((face 'evil-search-highlight-persist-highlight-face))
|
||||||
|
(set-face-attribute face nil :inherit 'isearch-lazy-highlight-face)
|
||||||
|
(set-face-foreground face nil)
|
||||||
|
(set-face-background face nil))
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(use-package smartparens
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(require 'smartparens-config)
|
||||||
|
(smartparens-global-mode 1)
|
||||||
|
|
||||||
|
(setq blink-matching-paren t)
|
||||||
|
(setq sp-autowrap-region nil ; let evil-surround handle this
|
||||||
|
sp-highlight-pair-overlay nil
|
||||||
|
sp-show-pair-delay 0
|
||||||
|
sp-autoescape-string-quote nil)
|
||||||
|
|
||||||
|
;; Handle newlines + spaces
|
||||||
|
(sp-pair "{" "}" :post-handlers '(("||\n[i]" "RET") ("| " " ")) :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
|
(sp-pair "(" ")" :post-handlers '(("||\n[i]" "RET") ("| " " ")) :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
|
|
||||||
|
;; Auto-close more conservatively
|
||||||
|
(sp-pair "[" nil :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
|
(sp-pair "'" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
||||||
|
(sp-pair "\"" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
||||||
|
|
||||||
|
(sp-with-modes '(json-mode js2-mode ruby-mode enh-ruby-mode python-mode)
|
||||||
|
(sp-local-pair "[" nil :post-handlers '(("||\n[i]" "RET"))))
|
||||||
|
|
||||||
|
(sp-with-modes '(c-mode c++-mode objc-mode java-mode scss-mode css-mode php-mode)
|
||||||
|
(sp-local-pair "/* " " */" :post-handlers '(("||\n[i]" "RET")))
|
||||||
|
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET"))))
|
||||||
|
|
||||||
|
(sp-with-modes '(objc-mode scss-mode css-mode)
|
||||||
|
(sp-local-pair "/*\n" "\n */" :post-handlers '(("||[i]" "RET"))))
|
||||||
|
|
||||||
|
(sp-with-modes '(c-mode c++-mode php-mode java-mode)
|
||||||
|
(sp-local-pair "/*" "" :post-handlers '((" ||\n[i]*/" "RET"))))
|
||||||
|
|
||||||
|
(after "yasnippet"
|
||||||
|
(defadvice yas-expand (before advice-for-yas-expand activate)
|
||||||
|
(sp-remove-active-pair-overlay)))))
|
||||||
|
|
||||||
|
(use-package rotate-text
|
||||||
|
:commands (rotate-word-at-point rotate-region))
|
||||||
|
|
||||||
|
(use-package smart-forward
|
||||||
|
:commands (smart-up smart-down smart-left smart-right))
|
||||||
|
|
||||||
|
(use-package expand-region
|
||||||
|
:commands (er/expand-region er/contract-region))
|
||||||
|
|
||||||
|
(use-package hl-todo
|
||||||
|
:commands hl-todo-mode
|
||||||
|
:init (add-hook 'prog-mode-hook 'hl-todo-mode))
|
||||||
|
|
||||||
|
(use-package emr
|
||||||
|
:commands (emr-initialize emr-show-refactor-menu)
|
||||||
|
:config (bind popup-menu-keymap [escape] 'keyboard-quit))
|
||||||
|
|
||||||
|
(use-package dash-at-point
|
||||||
|
:if is-mac
|
||||||
|
:commands (dash-at-point dash-at-point-with-docset)
|
||||||
|
:config
|
||||||
|
(add-to-list 'dash-at-point-mode-alist
|
||||||
|
'(java-mode . "java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc")))
|
||||||
|
|
||||||
|
(use-package rainbow-delimiters
|
||||||
|
:commands rainbow-delimiters-mode
|
||||||
|
:init (add-hooks '(emacs-lisp-mode-hook js2-mode-hook scss-mode-hook)
|
||||||
|
'rainbow-delimiters-mode)
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setq rainbow-delimiters-outermost-only-face-count 1)
|
||||||
|
(set-face-attribute 'rainbow-delimiters-depth-1-face nil
|
||||||
|
:foreground 'unspecified
|
||||||
|
:inherit 'my-outermost-paren-face)))
|
||||||
|
|
||||||
|
(use-package yaml-mode
|
||||||
|
:mode "\\.ya?ml$"
|
||||||
|
:init (add-hook 'yaml-mode-hook 'enable-tab-width-2))
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(progn ; Code building
|
||||||
|
(defvar my-build-command '("make %s" . "Makefile"))
|
||||||
|
(make-variable-buffer-local 'my-build-command)
|
||||||
|
|
||||||
|
(defun set-build-command (command &optional file)
|
||||||
|
(when (or (null file)
|
||||||
|
(project-has-files file))
|
||||||
|
(setq my-build-command `(,command . ,file))))
|
||||||
|
|
||||||
|
(evil-define-command my:build (arg)
|
||||||
|
"Call a build command in the current directory.
|
||||||
|
If ARG is nil this function calls `recompile', otherwise it calls
|
||||||
|
`compile' passing ARG as build command."
|
||||||
|
(interactive "<sh>")
|
||||||
|
(when (null my-build-command)
|
||||||
|
(user-error "No build command was set"))
|
||||||
|
(let ((build-file (cdr my-build-command))
|
||||||
|
(build-cmd (car my-build-command)))
|
||||||
|
(if (project-has-files build-file)
|
||||||
|
(compile (format "cd '%s' && %s" build-file (format build-cmd (or arg ""))))
|
||||||
|
(error "Could not find Makefile")))))
|
||||||
|
|
||||||
|
(progn ; Code running
|
||||||
|
(evil-define-operator my:eval-region (beg end)
|
||||||
|
:move-point nil
|
||||||
|
(interactive "<r>")
|
||||||
|
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||||
|
(eval-region beg end))
|
||||||
|
(t
|
||||||
|
(let ((interp (my--get-interpreter))
|
||||||
|
(max-mini-window-height 1))
|
||||||
|
(when interp (shell-command-on-region beg end interp))))))
|
||||||
|
|
||||||
|
(evil-define-command my:eval-buffer ()
|
||||||
|
(interactive)
|
||||||
|
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||||
|
(eval-buffer))
|
||||||
|
(t
|
||||||
|
(let ((interp (my--get-interpreter))
|
||||||
|
(max-mini-window-height 1))
|
||||||
|
(when interp (shell-command-on-region (point-min) (point-max) interp))))))
|
||||||
|
|
||||||
|
(defun my--get-interpreter ()
|
||||||
|
(car (--first (eq (cdr it) major-mode) interpreter-mode-alist))))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'core-editor)
|
||||||
|
;;; core-editor.el ends here
|
|
@ -1,5 +1,3 @@
|
||||||
(provide 'core-evil)
|
|
||||||
|
|
||||||
;;;; Eeeeeeevil ;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;; Eeeeeeevil ;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(use-package evil
|
(use-package evil
|
||||||
:config
|
:config
|
||||||
|
@ -22,6 +20,7 @@
|
||||||
|
|
||||||
;; Always ensure evil-shift-width is consistent with tab-width
|
;; Always ensure evil-shift-width is consistent with tab-width
|
||||||
(add-hook! 'after-change-major-mode-hook (setq evil-shift-width tab-width))
|
(add-hook! 'after-change-major-mode-hook (setq evil-shift-width tab-width))
|
||||||
|
;; Fix code folding
|
||||||
(add-hook 'prog-mode-hook 'hs-minor-mode)
|
(add-hook 'prog-mode-hook 'hs-minor-mode)
|
||||||
|
|
||||||
;; highlight matching delimiters where it's important
|
;; highlight matching delimiters where it's important
|
||||||
|
@ -46,16 +45,39 @@
|
||||||
(term-mode . emacs)))
|
(term-mode . emacs)))
|
||||||
(evil-set-initial-state `,(car mode-map) `,(cdr mode-map)))
|
(evil-set-initial-state `,(car mode-map) `,(cdr mode-map)))
|
||||||
|
|
||||||
|
;; predicate for visual line mode
|
||||||
|
(defun evil-visual-line-state-p ()
|
||||||
|
"Returns non-nil if in visual-line mode, nil otherwise."
|
||||||
|
(and (evil-visual-state-p)
|
||||||
|
(eq (evil-visual-type) 'line)))
|
||||||
|
|
||||||
|
|
||||||
(progn ; evil plugins
|
(progn ; evil plugins
|
||||||
(use-package evil-ex-registers)
|
|
||||||
(use-package evil-indent-textobject) ; vii/vai/vaI
|
(use-package evil-indent-textobject) ; vii/vai/vaI
|
||||||
(use-package evil-numbers)
|
|
||||||
(use-package evil-matchit :config (global-evil-matchit-mode 1))
|
;; (use-package evil-ex-registers)
|
||||||
(use-package evil-surround :config (global-evil-surround-mode 1))
|
(use-package evil-surround
|
||||||
(use-package evil-commentary :config (evil-commentary-mode 1))
|
:commands (evil-surround-edit
|
||||||
|
evil-Surround-edit
|
||||||
|
evil-surround-region)
|
||||||
|
:config (global-evil-surround-mode 1))
|
||||||
|
|
||||||
|
(use-package evil-numbers
|
||||||
|
:commands (evil-numbers/inc-at-pt
|
||||||
|
evil-numbers/dec-at-pt))
|
||||||
|
|
||||||
|
(use-package evil-matchit
|
||||||
|
:commands (evilmi-jump-items)
|
||||||
|
:config (global-evil-matchit-mode 1))
|
||||||
|
|
||||||
(use-package evil-search-highlight-persist
|
(use-package evil-search-highlight-persist
|
||||||
:config
|
:config (global-evil-search-highlight-persist t))
|
||||||
(global-evil-search-highlight-persist t))
|
|
||||||
|
(use-package evil-commentary
|
||||||
|
:commands (evil-commentary
|
||||||
|
evil-commentary-yank
|
||||||
|
evil-commentary-line)
|
||||||
|
:config (evil-commentary-mode 1))
|
||||||
|
|
||||||
(use-package evil-jumper
|
(use-package evil-jumper
|
||||||
:init (setq evil-jumper-file (expand-file-name "jumplist" my-tmp-dir))
|
:init (setq evil-jumper-file (expand-file-name "jumplist" my-tmp-dir))
|
||||||
|
@ -66,12 +88,16 @@
|
||||||
(define-key evil-motion-state-map (kbd "H-i") 'evil-jumper/forward)))
|
(define-key evil-motion-state-map (kbd "H-i") 'evil-jumper/forward)))
|
||||||
|
|
||||||
(use-package evil-exchange
|
(use-package evil-exchange
|
||||||
|
:commands (evil-exchange)
|
||||||
:config
|
:config
|
||||||
(defadvice evil-force-normal-state (before evil-esc-quit-exchange activate)
|
(defadvice evil-force-normal-state (before evil-esc-quit-exchange activate)
|
||||||
(when evil-exchange--overlays
|
(when evil-exchange--overlays
|
||||||
(evil-exchange-cancel))))
|
(evil-exchange-cancel))))
|
||||||
|
|
||||||
(use-package evil-visualstar
|
(use-package evil-visualstar
|
||||||
|
:commands (evil-visualstar/begin-search
|
||||||
|
evil-visualstar/begin-search-forward
|
||||||
|
evil-visualstar/begin-search-backward)
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
;; I cut this down because the original visualstar wouldn't remember
|
;; I cut this down because the original visualstar wouldn't remember
|
||||||
|
@ -88,22 +114,17 @@
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(global-evil-snipe-mode +1)
|
(global-evil-snipe-mode +1)
|
||||||
(setq evil-snipe-smart-case t)
|
(setq evil-snipe-smart-case t
|
||||||
(setq evil-snipe-override-evil t)
|
evil-snipe-override-evil t
|
||||||
(setq evil-snipe-scope 'line)
|
evil-snipe-scope 'line
|
||||||
(setq evil-snipe-repeat-scope 'buffer)
|
evil-snipe-repeat-scope 'buffer
|
||||||
(setq evil-snipe-override-evil-repeat-keys nil)
|
evil-snipe-override-evil-repeat-keys nil)
|
||||||
(setq-default evil-snipe-symbol-groups
|
(setq-default evil-snipe-symbol-groups
|
||||||
'((?\[ "[[{(]")
|
'((?\[ "[[{(]")
|
||||||
(?\] "[]})]")))
|
(?\] "[]})]")))
|
||||||
|
|
||||||
(bind 'motion
|
(bind 'motion
|
||||||
"C-;" 'evil-snipe-repeat
|
"C-;" 'evil-snipe-repeat
|
||||||
"C-," 'evil-snipe-repeat-reverse
|
"C-," 'evil-snipe-repeat-reverse))))
|
||||||
|
|
||||||
'visual
|
|
||||||
"z" 'evil-snipe-s
|
|
||||||
"Z" 'evil-snipe-S))))
|
|
||||||
|
|
||||||
(bind evil-ex-completion-map
|
(bind evil-ex-completion-map
|
||||||
"C-r" #'evil-ex-paste-from-register ; registers in ex-mode
|
"C-r" #'evil-ex-paste-from-register ; registers in ex-mode
|
||||||
|
@ -128,67 +149,7 @@
|
||||||
(defadvice evil-window-split (after evil-window-split-jump activate)
|
(defadvice evil-window-split (after evil-window-split-jump activate)
|
||||||
(evil-window-down 1))
|
(evil-window-down 1))
|
||||||
(defadvice evil-window-vsplit (after evil-window-vsplit-jump activate)
|
(defadvice evil-window-vsplit (after evil-window-vsplit-jump activate)
|
||||||
(evil-window-right 1))
|
(evil-window-right 1)))
|
||||||
|
|
||||||
;; Shut up undo-tree's constant complaining
|
|
||||||
(defadvice undo-tree-load-history-hook (around undo-tree-load-history-shut-up activate)
|
|
||||||
(shut-up ad-do-it))
|
|
||||||
(defadvice undo-tree-save-history-hook (around undo-tree-save-history-shut-up activate)
|
|
||||||
(shut-up ad-do-it)))
|
|
||||||
|
|
||||||
(progn ; extensions
|
|
||||||
(defun evil-visual-line-state-p ()
|
|
||||||
"Returns non-nil if in visual-line mode, nil otherwise."
|
|
||||||
(and (evil-visual-state-p)
|
|
||||||
(eq (evil-visual-type) 'line)))
|
|
||||||
|
|
||||||
(defun evil-ex-replace-special-filenames (file-name)
|
|
||||||
"Replace special symbols in FILE-NAME.
|
|
||||||
|
|
||||||
% => full path to file (/project/src/thing.c)
|
|
||||||
# => alternative file path (/project/include/thing.h)
|
|
||||||
%:p => path to project root (/project/)
|
|
||||||
%:d => path to current directory (/project/src/)
|
|
||||||
%:e => the file's extension (c)
|
|
||||||
%:r => the full path without its extension (/project/src/thing)
|
|
||||||
%:t => the file's basename (thing.c)"
|
|
||||||
(let ((current-fname (buffer-file-name))
|
|
||||||
(alternate-fname (and (other-buffer)
|
|
||||||
(buffer-file-name (other-buffer)))))
|
|
||||||
(setq file-name
|
|
||||||
;; %:p:h => the project root (or current directory otherwise)
|
|
||||||
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:p\\)"
|
|
||||||
(project-root) file-name t t 2))
|
|
||||||
(setq file-name
|
|
||||||
;; %:p => the project root (or current directory otherwise)
|
|
||||||
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:d\\)"
|
|
||||||
default-directory file-name t t 2))
|
|
||||||
(when current-fname
|
|
||||||
(setq file-name
|
|
||||||
;; %:e => ext
|
|
||||||
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:e\\)"
|
|
||||||
(f-ext current-fname) file-name t t 2))
|
|
||||||
(setq file-name
|
|
||||||
;; %:r => filename
|
|
||||||
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:r\\)"
|
|
||||||
(f-no-ext current-fname) file-name t t 2))
|
|
||||||
(setq file-name
|
|
||||||
;; %:t => filename.ext
|
|
||||||
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:t\\)"
|
|
||||||
(f-base current-fname) file-name t t 2))
|
|
||||||
(setq file-name
|
|
||||||
;; % => file path for current frame
|
|
||||||
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%\\)"
|
|
||||||
current-fname file-name t t 2)))
|
|
||||||
(when alternate-fname
|
|
||||||
(setq file-name
|
|
||||||
;; # => file path for alternative frame
|
|
||||||
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(#\\)"
|
|
||||||
alternate-fname file-name t t 2)))
|
|
||||||
(setq file-name
|
|
||||||
(replace-regexp-in-string "\\\\\\([#%]\\)"
|
|
||||||
"\\1" file-name t)))
|
|
||||||
file-name))
|
|
||||||
|
|
||||||
(progn ; ex-commands
|
(progn ; ex-commands
|
||||||
(evil-define-command my:kill-buffers (&optional bang)
|
(evil-define-command my:kill-buffers (&optional bang)
|
||||||
|
@ -221,9 +182,11 @@
|
||||||
(evil-define-command my:byte-compile (&optional bang)
|
(evil-define-command my:byte-compile (&optional bang)
|
||||||
:repeat nil
|
:repeat nil
|
||||||
(interactive "<!>")
|
(interactive "<!>")
|
||||||
(if bang
|
(byte-recompile-file (expand-file-name "init.el" my-dir) bang 0)
|
||||||
(byte-recompile-directory (concat my-dir ".cask") 0 t)
|
(dolist (file (append (f-glob "core*.el" my-modules-dir)
|
||||||
(byte-recompile-directory my-dir 0 t)))
|
(f-glob "defuns*.el" my-modules-dir)
|
||||||
|
(f-glob "my*.el" my-modules-dir)))
|
||||||
|
(byte-recompile-file file bang 0)))
|
||||||
|
|
||||||
(evil-define-command my:cd (dir)
|
(evil-define-command my:cd (dir)
|
||||||
:repeat nil
|
:repeat nil
|
||||||
|
@ -326,3 +289,6 @@ provided."
|
||||||
(interactive "<r>")
|
(interactive "<r>")
|
||||||
(evil-normal-state)
|
(evil-normal-state)
|
||||||
(my-narrow-to-region-indirect beg end)))))
|
(my-narrow-to-region-indirect beg end)))))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'core-evil)
|
5
init/core-linux.el
Normal file
5
init/core-linux.el
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
(when is-linux (add-to-list 'load-path "~/.cask"))
|
||||||
|
|
||||||
|
(provide 'core-linux)
|
||||||
|
|
||||||
|
;; Nothing here yet
|
|
@ -12,9 +12,8 @@
|
||||||
(setq mac-option-modifier 'alt)
|
(setq mac-option-modifier 'alt)
|
||||||
|
|
||||||
;; fix emacs PATH on OSX (GUI only)
|
;; fix emacs PATH on OSX (GUI only)
|
||||||
(use-package exec-path-from-shell
|
(require 'exec-path-from-shell)
|
||||||
:if (memq window-system '(mac ns))
|
(exec-path-from-shell-initialize)
|
||||||
:init (exec-path-from-shell-initialize))
|
|
||||||
|
|
||||||
(after "evil"
|
(after "evil"
|
||||||
;; On OSX, stop copying each visual state move to the clipboard:
|
;; On OSX, stop copying each visual state move to the clipboard:
|
|
@ -10,11 +10,26 @@
|
||||||
|
|
||||||
|
|
||||||
;;;; GUI Settings ;;;;;;;;;;;;;;;;;;;;;;
|
;;;; GUI Settings ;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(tooltip-mode -1)
|
(when window-system
|
||||||
(blink-cursor-mode -1) ; blink cursor
|
(scroll-bar-mode -1) ; no scrollbar
|
||||||
(global-hl-line-mode 1) ; highlight line
|
(tool-bar-mode -1) ; no toolbar
|
||||||
|
(menu-bar-mode -1)) ; no menubar
|
||||||
|
|
||||||
(setq linum-format " %3d")
|
(tooltip-mode -1)
|
||||||
|
(blink-cursor-mode 1) ; blink cursor
|
||||||
|
(global-hl-line-mode -1) ; highlight line
|
||||||
|
|
||||||
|
;; Highlight curent line number
|
||||||
|
(use-package hlinum
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(hlinum-activate)
|
||||||
|
;; A little excessive
|
||||||
|
(remove-hook 'pre-command-hook 'hlinum-unhighlight-current-line)))
|
||||||
|
|
||||||
|
;; Line numbers
|
||||||
|
(setq linum-format " %4d ")
|
||||||
|
(add-hooks '(text-mode-hook prog-mode-hook) 'linum-mode)
|
||||||
|
|
||||||
;; Multiple cursors across buffers cause a strange redraw delay for
|
;; Multiple cursors across buffers cause a strange redraw delay for
|
||||||
;; some things, like auto-complete or evil-mode's cursor color
|
;; some things, like auto-complete or evil-mode's cursor color
|
||||||
|
@ -24,7 +39,6 @@
|
||||||
(setq-default visible-bell nil) ; silence of the bells
|
(setq-default visible-bell nil) ; silence of the bells
|
||||||
(setq-default use-dialog-box nil) ; avoid GUI
|
(setq-default use-dialog-box nil) ; avoid GUI
|
||||||
(setq-default redisplay-dont-pause t)
|
(setq-default redisplay-dont-pause t)
|
||||||
;; (setq window-combination-resize nil)
|
|
||||||
|
|
||||||
;; do not soft-wrap lines
|
;; do not soft-wrap lines
|
||||||
(setq-default truncate-lines t)
|
(setq-default truncate-lines t)
|
||||||
|
@ -32,11 +46,6 @@
|
||||||
(setq-default indicate-buffer-boundaries nil)
|
(setq-default indicate-buffer-boundaries nil)
|
||||||
(setq-default indicate-empty-lines nil)
|
(setq-default indicate-empty-lines nil)
|
||||||
|
|
||||||
(when (functionp 'scroll-bar-mode) (scroll-bar-mode -1)) ; no scrollbar
|
|
||||||
(when (functionp 'tool-bar-mode) (tool-bar-mode -1)) ; no toolbar
|
|
||||||
(when (functionp 'menu-bar-mode) (menu-bar-mode -1)) ; no menubar
|
|
||||||
(when (fboundp 'fringe-mode) (fringe-mode '(5 . 10))) ; no nonsense
|
|
||||||
|
|
||||||
(when window-system
|
(when window-system
|
||||||
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
|
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
|
||||||
(if (string-equal (system-name) "io")
|
(if (string-equal (system-name) "io")
|
||||||
|
@ -46,10 +55,13 @@
|
||||||
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
||||||
(flet ((process-list ())) ad-do-it))
|
(flet ((process-list ())) ad-do-it))
|
||||||
|
|
||||||
|
;; [pedantry intensifies]
|
||||||
|
(rename-mode-name emacs-lisp-mode "Elisp")
|
||||||
|
|
||||||
|
|
||||||
;;;; Modeline ;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;; Modeline ;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(use-package vim-empty-lines-mode
|
;; (use-package vim-empty-lines-mode
|
||||||
:config (global-vim-empty-lines-mode +1))
|
;; :config (global-vim-empty-lines-mode +1))
|
||||||
|
|
||||||
(use-package uniquify
|
(use-package uniquify
|
||||||
:config
|
:config
|
||||||
|
@ -58,30 +70,29 @@
|
||||||
uniquify-ignore-buffers-re "^\\*"))
|
uniquify-ignore-buffers-re "^\\*"))
|
||||||
|
|
||||||
(use-package smart-mode-line
|
(use-package smart-mode-line
|
||||||
:config
|
|
||||||
(setq rm-blacklist
|
|
||||||
(mapconcat 'identity
|
|
||||||
'(" SP"
|
|
||||||
" Fill"
|
|
||||||
" EvilOrg"
|
|
||||||
" Abbrev"
|
|
||||||
" snipe"
|
|
||||||
" company"
|
|
||||||
" Anaconda"
|
|
||||||
" WS"
|
|
||||||
" GitGutter"
|
|
||||||
" Undo-Tree"
|
|
||||||
" Projectile\\[.+\\]"
|
|
||||||
" hs"
|
|
||||||
" ElDoc"
|
|
||||||
" wg"
|
|
||||||
" ~"
|
|
||||||
" s-/"
|
|
||||||
;; " yas"
|
|
||||||
" emr"
|
|
||||||
" Refactor"
|
|
||||||
) "\\|"))
|
|
||||||
:init
|
:init
|
||||||
|
(defvar rm-blacklist
|
||||||
|
(mapconcat 'identity
|
||||||
|
'(" SP"
|
||||||
|
" Fill"
|
||||||
|
" EvilOrg"
|
||||||
|
" Abbrev"
|
||||||
|
" snipe"
|
||||||
|
" company"
|
||||||
|
" Anaconda"
|
||||||
|
" WS"
|
||||||
|
" GitGutter"
|
||||||
|
" Undo-Tree"
|
||||||
|
" Projectile\\[.+\\]"
|
||||||
|
" hs"
|
||||||
|
" ElDoc"
|
||||||
|
" wg"
|
||||||
|
" ~"
|
||||||
|
" s-/"
|
||||||
|
" emr"
|
||||||
|
" Refactor"
|
||||||
|
) "\\|"))
|
||||||
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq sml/no-confirm-load-theme t
|
(setq sml/no-confirm-load-theme t
|
||||||
sml/mode-width 'full
|
sml/mode-width 'full
|
381
init/core.el
Normal file
381
init/core.el
Normal file
|
@ -0,0 +1,381 @@
|
||||||
|
(when (functionp 'scroll-bar-mode) (scroll-bar-mode -1)) ; no scrollbar
|
||||||
|
(when (functionp 'tool-bar-mode) (tool-bar-mode -1)) ; no toolbar
|
||||||
|
(when (functionp 'menu-bar-mode) (menu-bar-mode -1)) ; no menubar
|
||||||
|
(when (fboundp 'fringe-mode) (fringe-mode '(4 . 10))) ; no nonsense
|
||||||
|
|
||||||
|
(defconst is-mac (eq system-type 'darwin))
|
||||||
|
(defconst is-linux (eq system-type 'gnu/linux))
|
||||||
|
(defconst is-windows (eq system-type 'windows-nt))
|
||||||
|
|
||||||
|
(setq use-package-verbose DEBUG-MODE)
|
||||||
|
|
||||||
|
(cd "~") ; instead of /
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(require 'defuns)
|
||||||
|
(require 'autoloads) ; use make autoloads to generate autoloads file
|
||||||
|
(use-package shut-up
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setq shut-up-ignore DEBUG-MODE)
|
||||||
|
(when noninteractive (shut-up-silence-emacs)))) ; http://youtu.be/Z6woIRLnbmE
|
||||||
|
|
||||||
|
;; Make sure undo/backup folders exist
|
||||||
|
(defconst my-tmp-dir-undo (expand-file-name "undo" my-tmp-dir))
|
||||||
|
(defconst my-tmp-dir-backup (expand-file-name "backup" my-tmp-dir))
|
||||||
|
(defconst my-tmp-dir-autosave (expand-file-name "autosave" my-tmp-dir))
|
||||||
|
(unless (file-directory-p my-tmp-dir)
|
||||||
|
(make-directory my-tmp-dir-undo t)
|
||||||
|
(make-directory my-tmp-dir-backup t)
|
||||||
|
(make-directory my-tmp-dir-autosave t))
|
||||||
|
|
||||||
|
;; (setq load-prefer-newer t)
|
||||||
|
(setq debug-on-quit DEBUG-MODE)
|
||||||
|
|
||||||
|
;;;; Sane defaults ;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(line-number-mode 1) ; hide line no in modeline
|
||||||
|
(column-number-mode 1) ; hide col no in modeline
|
||||||
|
(auto-compression-mode t) ; Transparently open compressed files
|
||||||
|
(global-font-lock-mode t) ; Enable syntax highlighting for older emacs
|
||||||
|
(global-auto-revert-mode 1) ; revert buffers for changed files
|
||||||
|
|
||||||
|
;;; window layout undo/redo
|
||||||
|
(setq winner-boring-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
|
||||||
|
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
|
||||||
|
"*Buffer List*" "*Ibuffer*" "*esh command on file*"))
|
||||||
|
(winner-mode 1)
|
||||||
|
|
||||||
|
(use-package semantic
|
||||||
|
:commands semantic-mode
|
||||||
|
:init (add-hook 'prog-mode-hook 'semantic-mode)
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(semantic-mode 1)
|
||||||
|
(setq semanticdb-default-save-directory (expand-file-name "semanticdb" my-tmp-dir))))
|
||||||
|
|
||||||
|
;;; UTF-8 please
|
||||||
|
(setq locale-coding-system 'utf-8) ; pretty
|
||||||
|
(set-terminal-coding-system 'utf-8) ; pretty
|
||||||
|
(set-keyboard-coding-system 'utf-8) ; pretty
|
||||||
|
(set-selection-coding-system 'utf-8) ; please
|
||||||
|
(prefer-coding-system 'utf-8) ; with sugar on top
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||||
|
|
||||||
|
;;; Show tab characters
|
||||||
|
;; (global-whitespace-mode 1)
|
||||||
|
(setq whitespace-style '(trailing face tabs tab-mark) ; needs to be re-set in every buffer
|
||||||
|
whitespace-display-mappings
|
||||||
|
'((tab-mark ?\t [?| ?\t] [?\\ ?\t])
|
||||||
|
(newline-mark 10 [36 10]))) ; for whitespace-newline-mode
|
||||||
|
|
||||||
|
;; avoid garbage collection (default is 400k)
|
||||||
|
(setq-default gc-cons-threshold 20000000)
|
||||||
|
(setq-default confirm-kill-emacs nil)
|
||||||
|
|
||||||
|
;; minibufferception? Yay!
|
||||||
|
(setq-default enable-recursive-minibuffers t)
|
||||||
|
|
||||||
|
;; Show me those keystrokes
|
||||||
|
(setq echo-keystrokes 0.02)
|
||||||
|
|
||||||
|
(setq ring-bell-function 'ignore)
|
||||||
|
|
||||||
|
(setq inhibit-startup-screen t) ; don't show EMACs start screen
|
||||||
|
(setq inhibit-splash-screen t)
|
||||||
|
(setq inhibit-startup-buffer-menu t)
|
||||||
|
|
||||||
|
(setq initial-major-mode 'text-mode) ; initial scratch buffer mode
|
||||||
|
(setq initial-scratch-message nil)
|
||||||
|
(setq initial-scratch-buffer nil) ; empty scratch buffer
|
||||||
|
|
||||||
|
(setq compilation-always-kill t)
|
||||||
|
(setq compilation-ask-about-save nil)
|
||||||
|
(setq compilation-scroll-output t)
|
||||||
|
|
||||||
|
(setq sentence-end-double-space nil) ; sentences end with periods. Period.
|
||||||
|
|
||||||
|
(setq ediff-diff-options "-w")
|
||||||
|
(setq ediff-split-window-function 'split-window-horizontally) ; side-by-side diffs
|
||||||
|
(setq ediff-window-setup-function 'ediff-setup-windows-plain) ; no extra frames
|
||||||
|
|
||||||
|
;; Fixes C-i's synonymity with TAB
|
||||||
|
(keyboard-translate ?\C-i ?\H-i)
|
||||||
|
|
||||||
|
;; Don't save clipboard contents into kill-ring before replacing them
|
||||||
|
(setq save-interprogram-paste-before-kill nil)
|
||||||
|
|
||||||
|
;; don't let the cursor go into minibuffer prompt
|
||||||
|
;; Tip taken from Xah Lee: http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
||||||
|
(setq minibuffer-prompt-properties
|
||||||
|
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt))
|
||||||
|
|
||||||
|
;; remove annoying ellipsis when printing sexp in message buffer
|
||||||
|
(setq eval-expression-print-length nil
|
||||||
|
eval-expression-print-level nil)
|
||||||
|
|
||||||
|
;; Save history across sessions
|
||||||
|
(use-package savehist
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setq savehist-file (concat my-tmp-dir "savehist") ; keep the home clean
|
||||||
|
history-length 1000
|
||||||
|
savehist-additional-variables '(kill-ring
|
||||||
|
global-mark-ring
|
||||||
|
search-ring
|
||||||
|
regexp-search-ring
|
||||||
|
extended-command-history))
|
||||||
|
(savehist-mode 1)))
|
||||||
|
|
||||||
|
;; Save cursor location across sessions
|
||||||
|
(use-package saveplace
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setq-default save-place-file (concat my-tmp-dir "saveplace"))
|
||||||
|
;; activate save-place only for files that exist
|
||||||
|
(add-hook! 'find-file-hook (if (file-exists-p buffer-file-name) (setq save-place t)))))
|
||||||
|
|
||||||
|
(use-package recentf
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(add-hook 'kill-emacs-hook 'recentf-cleanup)
|
||||||
|
(setq recentf-save-file (concat my-tmp-dir "recentf")
|
||||||
|
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$" "/\\.cache/.+" "emacs\\.d/workgroups/.+$" ".emacs.workgroup")
|
||||||
|
recentf-max-menu-items 0
|
||||||
|
recentf-max-saved-items 1000
|
||||||
|
recentf-auto-cleanup 'never)
|
||||||
|
(recentf-mode 1)))
|
||||||
|
|
||||||
|
|
||||||
|
;;;; Backup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Disable all backups (that's what git/dropbox are for)
|
||||||
|
(setq bookmark-save-flag t)
|
||||||
|
(setq bookmark-default-file (expand-file-name "bookmarks" my-tmp-dir))
|
||||||
|
(setq auto-save-default nil)
|
||||||
|
(setq auto-save-list-file-name (expand-file-name ".auto-save" my-tmp-dir-autosave))
|
||||||
|
(setq auto-save-file-name-transforms `((".*" ,my-tmp-dir-autosave t)))
|
||||||
|
;; In case I want to reactivate backup files
|
||||||
|
(setq make-backup-files nil)
|
||||||
|
(setq create-lockfiles nil)
|
||||||
|
(setq backup-directory-alist `((".*" . ,my-tmp-dir-backup)))
|
||||||
|
;; Remember undo history
|
||||||
|
(setq-default undo-tree-auto-save-history t)
|
||||||
|
(setq-default undo-tree-history-directory-alist `(("." . ,my-tmp-dir-undo)))
|
||||||
|
;; Keep region when undoing in region
|
||||||
|
(defadvice undo-tree-undo (around keep-region activate)
|
||||||
|
(if (use-region-p)
|
||||||
|
(let ((m (set-marker (make-marker) (mark)))
|
||||||
|
(p (set-marker (make-marker) (point))))
|
||||||
|
ad-do-it
|
||||||
|
(goto-char p)
|
||||||
|
(set-mark m)
|
||||||
|
(set-marker p nil)
|
||||||
|
(set-marker m nil))
|
||||||
|
ad-do-it))
|
||||||
|
|
||||||
|
;; Keep region when undoing in region
|
||||||
|
(defadvice undo-tree-undo (around keep-region activate)
|
||||||
|
(if (use-region-p)
|
||||||
|
(let ((m (set-marker (make-marker) (mark)))
|
||||||
|
(p (set-marker (make-marker) (point))))
|
||||||
|
ad-do-it
|
||||||
|
(goto-char p)
|
||||||
|
(set-mark m)
|
||||||
|
(set-marker p nil)
|
||||||
|
(set-marker m nil))
|
||||||
|
ad-do-it))
|
||||||
|
|
||||||
|
;; Shut up undo-tree's constant complaining
|
||||||
|
(defadvice undo-tree-load-history-hook (around undo-tree-load-history-shut-up activate)
|
||||||
|
(shut-up ad-do-it))
|
||||||
|
;; (defadvice undo-tree-save-history-hook (around undo-tree-save-history-shut-up activate)
|
||||||
|
;; (shut-up ad-do-it))
|
||||||
|
|
||||||
|
;; Silences an annoying error:
|
||||||
|
;; undo-tree-mapc: Wrong type argument: listp, \.\.\.
|
||||||
|
(defun undo-tree-position (node list)
|
||||||
|
(when (listp list)
|
||||||
|
(let ((i 0))
|
||||||
|
(catch 'found
|
||||||
|
(while (progn
|
||||||
|
(when (eq node (car list)) (throw 'found i))
|
||||||
|
(incf i)
|
||||||
|
(setq list (cdr list))))
|
||||||
|
nil))))
|
||||||
|
|
||||||
|
;; What we do every night, Pinkie...
|
||||||
|
(defun display-startup-echo-area-message ()
|
||||||
|
(message "What're we gonna do tonight, Brain? (Loaded in %s)" (emacs-init-time)))
|
||||||
|
|
||||||
|
|
||||||
|
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
||||||
|
;; spaces instead of tabs
|
||||||
|
(setq-default indent-tabs-mode nil ; spaces instead of tabs
|
||||||
|
tab-always-indent t
|
||||||
|
tab-width 4)
|
||||||
|
|
||||||
|
(setq require-final-newline t)
|
||||||
|
(setq delete-trailing-lines nil)
|
||||||
|
(add-hook! 'makefile-mode-hook (setq indent-tabs-mode t)) ; Use normal tabs in makefiles
|
||||||
|
|
||||||
|
;; Project defuns ;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(require 'f)
|
||||||
|
|
||||||
|
(defvar project-root-files '(".git" ".hg" ".svn" ".project" "local.properties" "project.properties" "rebar.config" "project.clj" "SConstruct" "pom.xml" "build.sbt" "build.gradle" "Gemfile" "requirements.txt" "tox.ini" "package.json" "gulpfile.js" "Gruntfile.js" "bower.json" "composer.json" "Cargo.toml" "mix.exs")
|
||||||
|
"A list of files that count as 'project files', which determine whether a
|
||||||
|
folder is the root of a project or not.")
|
||||||
|
(defun project-root (&optional strict-p)
|
||||||
|
"Get the path to the root of your project. Uses `project-root-files' to
|
||||||
|
determine if a directory is a project."
|
||||||
|
(catch 'found
|
||||||
|
(f-traverse-upwards
|
||||||
|
(lambda (path)
|
||||||
|
(let ((path (file-truename path))
|
||||||
|
(home (file-truename "~")))
|
||||||
|
(if (f-equal? home path)
|
||||||
|
(throw 'found (if strict-p nil default-directory))
|
||||||
|
(dolist (file project-root-files)
|
||||||
|
(when (f-exists? (expand-file-name file path))
|
||||||
|
(throw 'found path)))))) default-directory)
|
||||||
|
default-directory))
|
||||||
|
|
||||||
|
(defun project-has-files (files &optional root)
|
||||||
|
"Return non-nil if `file' exists in the project root."
|
||||||
|
(let ((root (or root (project-root)))
|
||||||
|
(files (if (listp files) files (list files)))
|
||||||
|
found-p file)
|
||||||
|
(while (and files (not found-p))
|
||||||
|
(setq file (pop files))
|
||||||
|
(setq found-p (f-exists? (project-path-to file root))))
|
||||||
|
found-p))
|
||||||
|
|
||||||
|
(defun project-path-to (file &optional root)
|
||||||
|
(let ((root (or root (project-root))))
|
||||||
|
(expand-file-name file root)))
|
||||||
|
|
||||||
|
(defun project-name ()
|
||||||
|
(file-name-nondirectory (directory-file-name (project-root))))
|
||||||
|
|
||||||
|
(defun project-p ()
|
||||||
|
(not (null (project-root t))))
|
||||||
|
|
||||||
|
;; Make sure scratch buffer is always "in a project"
|
||||||
|
(defvar project-scratch-buffer nil)
|
||||||
|
(defun project-create-scratch-buffer ()
|
||||||
|
(let* ((scratch-buffer (get-buffer-create "*scratch*"))
|
||||||
|
(project-name (project-name))
|
||||||
|
(root (project-root)))
|
||||||
|
(mapc (lambda (b)
|
||||||
|
(if (string-match-p "\\*scratch\\* (.+)" (buffer-name b))
|
||||||
|
(kill-buffer b)))
|
||||||
|
(buffer-list))
|
||||||
|
(save-window-excursion
|
||||||
|
(switch-to-buffer scratch-buffer)
|
||||||
|
(setq project-scratch-buffer scratch-buffer)
|
||||||
|
(erase-buffer)
|
||||||
|
(cd root)
|
||||||
|
(rename-buffer (format "*scratch* (%s)" project-name)))))
|
||||||
|
(add-hook 'find-file-hook 'project-create-scratch-buffer)
|
||||||
|
|
||||||
|
|
||||||
|
;; Automatic minor modes ;;;;;;;;;;;
|
||||||
|
(defvar auto-minor-mode-alist ()
|
||||||
|
"Alist of filename patterns vs correpsonding minor mode functions,
|
||||||
|
see `auto-mode-alist' All elements of this alist are checked, meaning
|
||||||
|
you can enable multiple minor modes for the same regexp.")
|
||||||
|
(defun enable-minor-mode-based-on-path ()
|
||||||
|
"check file name against auto-minor-mode-alist to enable minor modes
|
||||||
|
the checking happens for all pairs in auto-minor-mode-alist"
|
||||||
|
(when buffer-file-name
|
||||||
|
(let ((name buffer-file-name)
|
||||||
|
(remote-id (file-remote-p buffer-file-name))
|
||||||
|
(alist auto-minor-mode-alist))
|
||||||
|
;; Remove backup-suffixes from file name.
|
||||||
|
(setq name (file-name-sans-versions name))
|
||||||
|
;; Remove remote file name identification.
|
||||||
|
(when (and (stringp remote-id)
|
||||||
|
(string-match-p (regexp-quote remote-id) name))
|
||||||
|
(setq name (substring name (match-end 0))))
|
||||||
|
(while (and alist (caar alist) (cdar alist))
|
||||||
|
(if (string-match (caar alist) name)
|
||||||
|
(funcall (cdar alist) 1))
|
||||||
|
(setq alist (cdr alist))))))
|
||||||
|
(add-hook 'find-file-hook 'enable-minor-mode-based-on-path)
|
||||||
|
|
||||||
|
|
||||||
|
;;;; Utility plugins ;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(use-package smex
|
||||||
|
:commands (smex smex-major-mode-commands)
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(smex-initialize)
|
||||||
|
;; Hook up smex to auto-update, rather than update on every run
|
||||||
|
(defun smex-update-after-load (unused)
|
||||||
|
(when (boundp 'smex-cache) (smex-update)))
|
||||||
|
(add-hook 'after-load-functions 'smex-update-after-load)))
|
||||||
|
|
||||||
|
(use-package popwin
|
||||||
|
:config
|
||||||
|
(progn ; popwin config
|
||||||
|
(popwin-mode 1)
|
||||||
|
(setq popwin:popup-window-height 0.45)
|
||||||
|
;; (setq display-buffer-function 'popwin:display-buffer)
|
||||||
|
|
||||||
|
(push '("\\`\\*helm.*?\\*\\'" :regexp t :position bottom :height 15) popwin:special-display-config)
|
||||||
|
|
||||||
|
(push '("^\\*Flycheck.*\\*$" :regexp t :position bottom :height 0.25 :noselect t) popwin:special-display-config)
|
||||||
|
(push '(inf-enh-ruby-mode :position bottom :stick t) popwin:special-display-config)
|
||||||
|
(push '(snippet-mode :position bottom :stick t) popwin:special-display-config)
|
||||||
|
(push '("^\\*eclim.*\\*" :regexp t :position bottom :height 0.25) popwin:special-display-config)
|
||||||
|
|
||||||
|
(push '("*ansi-term*" :position bottom :height 0.45 :stick t) popwin:special-display-config)
|
||||||
|
(push '("*terminal*" :position bottom :height 0.45 :stick t) popwin:special-display-config)
|
||||||
|
(push '("*Async Shell Command*" :position bottom) popwin:special-display-config)
|
||||||
|
(push '("*Shell Command Output*" :position bottom :stick t :height 15) popwin:special-display-config)
|
||||||
|
|
||||||
|
(push '("* Regexp Explain *" :position top :height 0.35) popwin:special-display-config)
|
||||||
|
|
||||||
|
(push '("*anaconda-doc*" :position bottom :height 15 :noselect t) popwin:special-display-config)
|
||||||
|
(push '("*anaconda-nav*" :position bottom :height 15 :stick t) popwin:special-display-config)
|
||||||
|
(push '("^\\*Python.+\\*$" :regexp t :position bottom :height 20 :noselect t) popwin:special-display-config)
|
||||||
|
|
||||||
|
(push '(help-mode :height 0.5 :position bottom :stick t) popwin:special-display-config)
|
||||||
|
(push '(compilation-mode :height 0.5 :position bottom :noselect t) popwin:special-display-config)
|
||||||
|
(push '(diff-mode :position bottom :stick t) popwin:special-display-config)
|
||||||
|
(push '("*Backtrace*") popwin:special-display-config)
|
||||||
|
(push '("*Warnings*") popwin:special-display-config)
|
||||||
|
(push '("*Process List*") popwin:special-display-config)
|
||||||
|
(push '("*Compile-Log*" :height 0.3 :position bottom :noselect t) popwin:special-display-config)
|
||||||
|
(push '(" *undo-tree*" :width 0.3 :position right) popwin:special-display-config)
|
||||||
|
(push '("^\\*scratch\\*.*" :regexp t :stick t) popwin:special-display-config)
|
||||||
|
(push '(image-mode) popwin:special-display-config)
|
||||||
|
|
||||||
|
(push '("*NeoTree*" :position left :width 22 :stick t) popwin:special-display-config)
|
||||||
|
|
||||||
|
(defun popwin:toggle-popup-window ()
|
||||||
|
(interactive)
|
||||||
|
(if (popwin:popup-window-live-p)
|
||||||
|
(popwin:close-popup-window)
|
||||||
|
(popwin:popup-last-buffer)))))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(cond (is-mac (require 'core-osx))
|
||||||
|
(is-linux (require 'core-linux))
|
||||||
|
(is-windows (require 'core-windows)))
|
||||||
|
|
||||||
|
;; Performance checks
|
||||||
|
(add-hook! 'find-file-hook
|
||||||
|
;; If file is oversized...
|
||||||
|
(when (> (buffer-size) (* 1024 1024))
|
||||||
|
(setq buffer-read-only t)
|
||||||
|
(buffer-disable-undo)
|
||||||
|
(fundamental-mode)
|
||||||
|
(visual-line-mode)))
|
||||||
|
|
||||||
|
(use-package server
|
||||||
|
:config (unless (server-running-p) (server-start)))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'core)
|
||||||
|
;;; core.el ends here
|
|
@ -40,6 +40,10 @@
|
||||||
'with-no-warnings)
|
'with-no-warnings)
|
||||||
(with-eval-after-load ',feature ,@forms)))
|
(with-eval-after-load ',feature ,@forms)))
|
||||||
|
|
||||||
|
(defmacro rename-mode-name (mode new-name)
|
||||||
|
`(defadvice ,mode (after rename-modeline activate)
|
||||||
|
(setq mode-name ,new-name)))
|
||||||
|
|
||||||
|
|
||||||
;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(defun bind (&rest keys)
|
(defun bind (&rest keys)
|
|
@ -64,10 +64,8 @@
|
||||||
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
|
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
|
||||||
(c-set-offset 'access-label '-)
|
(c-set-offset 'access-label '-)
|
||||||
(c-set-offset 'inclass 'my-c-lineup-inclass)
|
(c-set-offset 'inclass 'my-c-lineup-inclass)
|
||||||
|
|
||||||
;; DEL mapping interferes with smartparens and my.deflate-maybe
|
;; DEL mapping interferes with smartparens and my.deflate-maybe
|
||||||
(define-key c-mode-map (kbd "DEL") nil))
|
(define-key c-mode-map (kbd "DEL") nil))
|
||||||
|
|
||||||
(add-hook 'c-mode-hook 'my-c/c++-settings)
|
(add-hook 'c-mode-hook 'my-c/c++-settings)
|
||||||
(add-hook 'c++-mode-hook 'my-c/c++-settings)
|
(add-hook 'c++-mode-hook 'my-c/c++-settings)
|
||||||
(after "flycheck"
|
(after "flycheck"
|
||||||
|
|
|
@ -25,21 +25,18 @@
|
||||||
|
|
||||||
;; Sort candidates by
|
;; Sort candidates by
|
||||||
(add-to-list 'company-transformers 'company-sort-by-occurrence)
|
(add-to-list 'company-transformers 'company-sort-by-occurrence)
|
||||||
;; (add-to-list 'company-transformers 'company-sort-by-backend-importance)
|
|
||||||
(use-package company-statistics
|
(use-package company-statistics
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq company-statistics-file (expand-file-name "company-statistics-cache.el" my-tmp-dir))
|
(setq company-statistics-file (expand-file-name "company-statistics-cache.el" my-tmp-dir))
|
||||||
(company-statistics-mode)))
|
(company-statistics-mode)))
|
||||||
|
|
||||||
(progn ; frontends
|
;; frontends
|
||||||
(setq-default company-frontends '(company-pseudo-tooltip-unless-just-one-frontend
|
(setq-default company-frontends '(company-pseudo-tooltip-unless-just-one-frontend
|
||||||
company-echo-metadata-frontend
|
company-echo-metadata-frontend
|
||||||
company-preview-if-just-one-frontend)))
|
company-preview-if-just-one-frontend))
|
||||||
|
|
||||||
(progn ; backends
|
(progn ; backends
|
||||||
(setq-default company-backends '((company-capf company-yasnippet) (company-dictionary company-keywords)))
|
|
||||||
|
|
||||||
(defun company--backend-on (hook &rest backends)
|
(defun company--backend-on (hook &rest backends)
|
||||||
(add-hook hook
|
(add-hook hook
|
||||||
`(lambda()
|
`(lambda()
|
||||||
|
@ -70,7 +67,7 @@
|
||||||
(defvar company-dictionary-alist '())
|
(defvar company-dictionary-alist '())
|
||||||
(defvar company-dictionary-major-minor-modes '())
|
(defvar company-dictionary-major-minor-modes '())
|
||||||
(defun company-dictionary-active-minor-modes ()
|
(defun company-dictionary-active-minor-modes ()
|
||||||
(-filter (lambda (mode) (symbol-value mode)) company-dictionary-major-minor-modes))
|
(-filter (lambda (mode) (when (boundp mode) (symbol-value mode))) company-dictionary-major-minor-modes))
|
||||||
(defun company-dictionary-assemble ()
|
(defun company-dictionary-assemble ()
|
||||||
(let ((minor-modes (company-dictionary-active-minor-modes))
|
(let ((minor-modes (company-dictionary-active-minor-modes))
|
||||||
(dicts (cdr (assq major-mode company-dictionary-alist))))
|
(dicts (cdr (assq major-mode company-dictionary-alist))))
|
||||||
|
@ -94,20 +91,9 @@
|
||||||
(all-completions arg symbols)))
|
(all-completions arg symbols)))
|
||||||
(sorted t))))
|
(sorted t))))
|
||||||
|
|
||||||
(progn ; keybinds
|
(setq-default company-backends '((company-capf company-yasnippet) (company-dictionary company-keywords)))
|
||||||
(bind 'insert company-mode-map
|
|
||||||
"C-SPC" 'company-complete-common
|
|
||||||
"C-x C-k" 'company-dictionary
|
|
||||||
"C-x C-f" 'company-files
|
|
||||||
"C-x C-]" 'company-etags
|
|
||||||
"C-x s" 'company-ispell
|
|
||||||
"C-x C-s" 'company-yasnippet
|
|
||||||
"C-x C-o" 'company-semantic
|
|
||||||
"C-x C-n" 'company-dabbrev-code
|
|
||||||
"C-x C-p" (λ (let ((company-selection-wrap-around t))
|
|
||||||
(call-interactively 'company-dabbrev-code)
|
|
||||||
(company-select-previous-or-abort))))
|
|
||||||
|
|
||||||
|
(progn ; keybinds
|
||||||
(define-key company-active-map "C-w" nil)
|
(define-key company-active-map "C-w" nil)
|
||||||
(bind company-active-map
|
(bind company-active-map
|
||||||
"C-o" 'company-search-kill-others
|
"C-o" 'company-search-kill-others
|
||||||
|
@ -127,7 +113,6 @@
|
||||||
"C-p" 'company-search-repeat-backward
|
"C-p" 'company-search-repeat-backward
|
||||||
[escape] 'company-abort)
|
[escape] 'company-abort)
|
||||||
|
|
||||||
(bind company-mode-map "<C-return>" 'helm-company)
|
|
||||||
(bind company-active-map "<C-return>" 'helm-company)))))
|
(bind company-active-map "<C-return>" 'helm-company)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
(provide 'init-cscope)
|
|
||||||
|
|
||||||
(use-package xcscope
|
(use-package xcscope
|
||||||
:init (cscope-setup)
|
:init (cscope-setup)
|
||||||
|
@ -7,3 +6,5 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(add-hook 'ruby-mode-hook (function cscope-minor-mode))
|
(add-hook 'ruby-mode-hook (function cscope-minor-mode))
|
||||||
|
|
||||||
|
(provide 'init-cscope)
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
(use-package omnisharp
|
|
||||||
:defer t
|
|
||||||
:config
|
|
||||||
(progn
|
|
||||||
(setq omnisharp-server-executable-path
|
|
||||||
"~/Dropbox/projects/lib/Omnisharp/server/OmniSharp/bin/Debug/OmniSharp.exe")
|
|
||||||
|
|
||||||
(bind 'normal omnisharp-mode-map
|
|
||||||
"gd" 'omnisharp-go-to-definition)
|
|
||||||
|
|
||||||
(after "company"
|
|
||||||
(company--backend-on 'csharp-mode-hook 'company-omnisharp)
|
|
||||||
(add-hook 'csharp-mode-hook 'turn-on-eldoc-mode))))
|
|
||||||
|
|
||||||
(use-package csharp-mode :mode "\\.cs$"
|
(use-package csharp-mode :mode "\\.cs$"
|
||||||
:config
|
:config
|
||||||
(after "flycheck" (add-hook 'csharp-mode-hook 'flycheck-mode)))
|
(progn
|
||||||
|
(after "flycheck" (add-hook 'csharp-mode-hook 'flycheck-mode))
|
||||||
|
(use-package omnisharp
|
||||||
|
:defer t
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setq omnisharp-server-executable-path
|
||||||
|
"~/Dropbox/projects/lib/Omnisharp/server/OmniSharp/bin/Debug/OmniSharp.exe")
|
||||||
|
|
||||||
|
(bind 'normal omnisharp-mode-map
|
||||||
|
"gd" 'omnisharp-go-to-definition)
|
||||||
|
|
||||||
|
(after "company"
|
||||||
|
(company--backend-on 'csharp-mode-hook 'company-omnisharp)
|
||||||
|
(add-hook 'csharp-mode-hook 'turn-on-eldoc-mode))))))
|
||||||
|
|
||||||
;; unity shaders
|
;; unity shaders
|
||||||
(use-package shaderlab-mode :mode "\\.shader$")
|
(use-package shaderlab-mode :mode "\\.shader$")
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
(use-package d-mode
|
|
||||||
:disabled t
|
|
||||||
:mode "\\.d$")
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-d)
|
|
||||||
;;; init-d.el ends here
|
|
|
@ -1,14 +0,0 @@
|
||||||
(use-package erlang-start
|
|
||||||
:mode (("\\.erl?$" . erlang-mode)
|
|
||||||
("\\.hrl?$" . erlang-mode))
|
|
||||||
:config
|
|
||||||
(progn
|
|
||||||
(setq erlang-root-dir "/opt/local/lib/erlang")
|
|
||||||
(setq erlang-man-root-dir "/opt/local/lib/erlang/man")
|
|
||||||
(add-to-list 'exec-path "/opt/local/lib/erlang/bin")))
|
|
||||||
|
|
||||||
;; TODO Install distel
|
|
||||||
;; TODO Esense?
|
|
||||||
|
|
||||||
(provide 'init-erlang)
|
|
||||||
;;; init-erlang.el ends here
|
|
|
@ -1,20 +1,21 @@
|
||||||
(use-package flycheck
|
(use-package flycheck
|
||||||
|
:commands (flycheck-mode flycheck-list-errors)
|
||||||
:init
|
:init
|
||||||
(setq-default flycheck-indication-mode 'right-fringe
|
(add-hooks '(ruby-mode-hook
|
||||||
;; Removed checks on idle/change for snappiness
|
python-mode-hook
|
||||||
flycheck-check-syntax-automatically '(save mode-enabled idle-change)
|
php-mode-hook
|
||||||
flycheck-disabled-checkers '(emacs-lisp-checkdoc make))
|
lua-mode-hook
|
||||||
|
shell-mode-hook
|
||||||
|
scss-mode-hook
|
||||||
|
c++-mode-hook
|
||||||
|
c-mode-hook)
|
||||||
|
'flycheck-mode)
|
||||||
:config
|
:config
|
||||||
(progn ; flycheck settings
|
(progn ; flycheck settings
|
||||||
(add-hooks '(ruby-mode-hook
|
(setq-default flycheck-indication-mode 'right-fringe
|
||||||
python-mode-hook
|
;; Removed checks on idle/change for snappiness
|
||||||
php-mode-hook
|
flycheck-check-syntax-automatically '(save mode-enabled idle-change)
|
||||||
lua-mode-hook
|
flycheck-disabled-checkers '(emacs-lisp-checkdoc make))
|
||||||
shell-mode-hook
|
|
||||||
scss-mode-hook
|
|
||||||
c++-mode-hook
|
|
||||||
c-mode-hook)
|
|
||||||
'flycheck-mode)
|
|
||||||
|
|
||||||
(my--cleanup-buffers-add "^\\*Flycheck.*\\*$")
|
(my--cleanup-buffers-add "^\\*Flycheck.*\\*$")
|
||||||
|
|
||||||
|
|
109
init/init-git.el
109
init/init-git.el
|
@ -21,43 +21,42 @@
|
||||||
(use-package git-gutter-fringe+
|
(use-package git-gutter-fringe+
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(global-git-gutter+-mode +1)
|
(global-git-gutter+-mode 1)
|
||||||
|
|
||||||
;; Fixes "git-gutter+-process-diff: Wrong number of arguments: nil" error
|
;; Fixes "git-gutter+-process-diff: Wrong number of arguments: nil" error
|
||||||
(defadvice git-gutter+-process-diff (before git-gutter+-process-diff-advice activate)
|
(defadvice git-gutter+-process-diff (before git-gutter+-process-diff-advice activate)
|
||||||
(ad-set-arg 0 (file-truename (ad-get-arg 0))))
|
(ad-set-arg 0 (file-truename (ad-get-arg 0))))
|
||||||
|
|
||||||
(fringe-helper-define 'git-gutter-fr+-added nil
|
(fringe-helper-define 'git-gutter-fr+-added nil
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......")
|
".X......")
|
||||||
|
|
||||||
(fringe-helper-define 'git-gutter-fr+-deleted nil
|
(fringe-helper-define 'git-gutter-fr+-deleted nil
|
||||||
"XX......"
|
".X......"
|
||||||
"XXXXXXXX"
|
".XXXXXXX"
|
||||||
"XX......"
|
".X......"
|
||||||
"........"
|
"........"
|
||||||
"........"
|
"........"
|
||||||
"........"
|
"........"
|
||||||
|
@ -82,31 +81,31 @@
|
||||||
"........")
|
"........")
|
||||||
|
|
||||||
(fringe-helper-define 'git-gutter-fr+-modified nil
|
(fringe-helper-define 'git-gutter-fr+-modified nil
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......"
|
".X......"
|
||||||
"XX......")))
|
".X......")))
|
||||||
|
|
||||||
(evil-set-initial-state 'git-commit-mode 'insert)
|
(evil-set-initial-state 'git-commit-mode 'insert)
|
||||||
(evil-set-initial-state 'git-rebase-mode 'insert)
|
(evil-set-initial-state 'git-rebase-mode 'insert)
|
||||||
|
|
|
@ -1,4 +1,62 @@
|
||||||
|
(use-package projectile
|
||||||
|
:commands (projectile-ack
|
||||||
|
projectile-ag
|
||||||
|
projectile-compile-project
|
||||||
|
projectile-dired
|
||||||
|
projectile-grep
|
||||||
|
projectile-find-dir
|
||||||
|
projectile-find-file
|
||||||
|
projectile-find-tag
|
||||||
|
projectile-find-test-file
|
||||||
|
projectile-invalidate-cache
|
||||||
|
projectile-kill-buffers
|
||||||
|
projectile-multi-occur
|
||||||
|
projectile-project-root
|
||||||
|
projectile-recentf
|
||||||
|
projectile-regenerate-tags
|
||||||
|
projectile-replace
|
||||||
|
projectile-run-async-shell-command-in-root
|
||||||
|
projectile-run-shell-command-in-root
|
||||||
|
projectile-switch-project
|
||||||
|
projectile-switch-to-buffer
|
||||||
|
projectile-vc
|
||||||
|
projectile-project-p
|
||||||
|
helm-projectile-find-file
|
||||||
|
helm-projectile-recentf
|
||||||
|
helm-projectile-find-other-file
|
||||||
|
helm-projectile-switch-project)
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setq-default projectile-enable-caching t)
|
||||||
|
(setq projectile-sort-order 'recentf
|
||||||
|
projectile-cache-file (concat my-tmp-dir "projectile.cache")
|
||||||
|
projectile-known-projects-file (concat my-tmp-dir "projectile.projects")
|
||||||
|
projectile-indexing-method 'alien
|
||||||
|
projectile-project-root-files project-root-files)
|
||||||
|
(add-to-list 'projectile-globally-ignored-files "ido.last")
|
||||||
|
(add-to-list 'projectile-globally-ignored-directories "assets")
|
||||||
|
(add-to-list 'projectile-other-file-alist '("scss" "css"))
|
||||||
|
(add-to-list 'projectile-other-file-alist '("css" "scss"))
|
||||||
|
(projectile-global-mode +1)
|
||||||
|
|
||||||
|
(use-package helm-projectile)
|
||||||
|
;; Don't show the project name in the prompts; I already know.
|
||||||
|
(defun projectile-prepend-project-name (string) helm-global-prompt)))
|
||||||
|
|
||||||
(use-package helm
|
(use-package helm
|
||||||
|
:commands (helm
|
||||||
|
helm-M-x
|
||||||
|
helm-buffers-list
|
||||||
|
helm-semantic-or-imenu
|
||||||
|
helm-etags-select
|
||||||
|
helm-apropos
|
||||||
|
helm-recentf
|
||||||
|
helm-show-kill-ring
|
||||||
|
helm-bookmarks
|
||||||
|
helm-wg
|
||||||
|
my:helm-recentf)
|
||||||
|
:init
|
||||||
|
(evil-set-initial-state 'helm-mode 'emacs)
|
||||||
:config
|
:config
|
||||||
(progn ; helm settings
|
(progn ; helm settings
|
||||||
(defvar helm-global-prompt ">>> ")
|
(defvar helm-global-prompt ">>> ")
|
||||||
|
@ -24,89 +82,7 @@
|
||||||
|
|
||||||
(my--cleanup-buffers-add "^\\*[Hh]elm.*\\*$")
|
(my--cleanup-buffers-add "^\\*[Hh]elm.*\\*$")
|
||||||
|
|
||||||
(use-package helm-ag)
|
(require 'helm-files)
|
||||||
(use-package helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
|
|
||||||
:commands (helm-css-scss
|
|
||||||
helm-css-scss-multi
|
|
||||||
helm-css-scss-insert-close-comment))
|
|
||||||
|
|
||||||
(use-package helm-company :commands (helm-company))
|
|
||||||
|
|
||||||
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
|
|
||||||
;; regexp.
|
|
||||||
(evil-define-operator my:helm-ag-search (beg end &optional search hidden-files-p pwd-p regex-p)
|
|
||||||
:type inclusive
|
|
||||||
:repeat nil
|
|
||||||
(interactive "<r><a><!>")
|
|
||||||
(let* ((helm-ag-default-directory (if pwd-p default-directory (project-root)))
|
|
||||||
(helm-ag-command-option (concat (unless regex-p "-Q ")
|
|
||||||
(if hidden-files-p "--hidden ")))
|
|
||||||
(input "")
|
|
||||||
(header-name (format "Search in %s" helm-ag-default-directory)))
|
|
||||||
(if search
|
|
||||||
(progn
|
|
||||||
(helm-attrset 'search-this-file nil helm-ag-source)
|
|
||||||
(setq helm-ag--last-query search))
|
|
||||||
(if (and beg end (/= beg (1- end)))
|
|
||||||
(setq input (buffer-substring-no-properties beg end))))
|
|
||||||
(helm-attrset 'name header-name helm-ag-source)
|
|
||||||
(helm :sources (if search (helm-ag--select-source) '(helm-source-do-ag))
|
|
||||||
:buffer "*helm-ag*"
|
|
||||||
:input input
|
|
||||||
:prompt helm-global-prompt)))
|
|
||||||
|
|
||||||
(evil-define-operator my:helm-ag-regex-search (beg end &optional search bang)
|
|
||||||
:type inclusive :repeat nil
|
|
||||||
(interactive "<r><a><!>")
|
|
||||||
(my:helm-ag-search beg end search bang nil t))
|
|
||||||
(evil-define-operator my:helm-ag-search-cwd (beg end &optional search bang)
|
|
||||||
;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted
|
|
||||||
;; as regexp
|
|
||||||
:type inclusive :repeat nil
|
|
||||||
(interactive "<r><a><!>")
|
|
||||||
(my:helm-ag-search beg end search bang t nil))
|
|
||||||
(evil-define-operator my:helm-ag-regex-search-cwd (beg end &optional search bang)
|
|
||||||
:type inclusive :repeat nil
|
|
||||||
(interactive "<r><a><!>")
|
|
||||||
(my:helm-ag-search beg end search bang t t))
|
|
||||||
|
|
||||||
(use-package helm-swoop ; https://github.com/ShingoFukuyama/helm-swoop
|
|
||||||
:commands (helm-swoop helm-multi-swoop)
|
|
||||||
:config
|
|
||||||
(setq helm-swoop-use-line-number-face t
|
|
||||||
helm-swoop-split-with-multiple-windows t
|
|
||||||
helm-swoop-speed-or-color t
|
|
||||||
;; helm-swoop-split-window-function 'popwin:popup-buffer
|
|
||||||
))
|
|
||||||
|
|
||||||
;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or
|
|
||||||
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is
|
|
||||||
;; `scss-mode'
|
|
||||||
(evil-define-command my:helm-swoop (&optional search bang)
|
|
||||||
:repeat nil
|
|
||||||
(interactive "<a><!>")
|
|
||||||
(if (eq major-mode 'scss-mode)
|
|
||||||
(if bang (helm-css-scss-multi search) (helm-css-scss search))
|
|
||||||
(if bang (helm-multi-swoop-all search) (helm-swoop :$query search))))
|
|
||||||
|
|
||||||
(use-package projectile
|
|
||||||
:init (setq-default projectile-enable-caching t)
|
|
||||||
:config
|
|
||||||
(progn
|
|
||||||
(projectile-global-mode +1)
|
|
||||||
(setq projectile-sort-order 'recentf
|
|
||||||
projectile-cache-file (concat my-tmp-dir "projectile.cache")
|
|
||||||
projectile-known-projects-file (concat my-tmp-dir "projectile.projects")
|
|
||||||
projectile-indexing-method 'alien)
|
|
||||||
(add-to-list 'projectile-globally-ignored-files "ido.last")
|
|
||||||
(add-to-list 'projectile-globally-ignored-directories "assets")
|
|
||||||
(add-to-list 'projectile-other-file-alist '("scss" "css"))
|
|
||||||
(add-to-list 'projectile-other-file-alist '("css" "scss"))
|
|
||||||
|
|
||||||
;; Don't show the project name in the prompts; I already know.
|
|
||||||
(defun projectile-prepend-project-name (string) helm-global-prompt)
|
|
||||||
|
|
||||||
(use-package helm-projectile)))
|
|
||||||
|
|
||||||
(progn ; helm hacks
|
(progn ; helm hacks
|
||||||
;; No persistent header
|
;; No persistent header
|
||||||
|
@ -142,8 +118,6 @@
|
||||||
(when force (force-mode-line-update))))
|
(when force (force-mode-line-update))))
|
||||||
|
|
||||||
(progn ; evil
|
(progn ; evil
|
||||||
(evil-set-initial-state 'helm-mode 'emacs)
|
|
||||||
|
|
||||||
;; Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
|
;; Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
|
||||||
;; `bang', then `search' is interpreted as regexp
|
;; `bang', then `search' is interpreted as regexp
|
||||||
(evil-define-command my:helm-recentf (&optional bang)
|
(evil-define-command my:helm-recentf (&optional bang)
|
||||||
|
@ -157,6 +131,77 @@
|
||||||
"C-r" 'evil-ex-paste-from-register ; Evil registers in helm! Glorious!
|
"C-r" 'evil-ex-paste-from-register ; Evil registers in helm! Glorious!
|
||||||
[escape] 'helm-keyboard-quit)))
|
[escape] 'helm-keyboard-quit)))
|
||||||
|
|
||||||
|
(use-package helm-ag
|
||||||
|
:commands (helm-ag
|
||||||
|
my:helm-ag-search
|
||||||
|
my:helm-ag-regex-search
|
||||||
|
my:helm-ag-search-cwd
|
||||||
|
my:helm-ag-regex-search-cwd)
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
|
||||||
|
;; regexp.
|
||||||
|
(evil-define-operator my:helm-ag-search (beg end &optional search hidden-files-p pwd-p regex-p)
|
||||||
|
:type inclusive
|
||||||
|
:repeat nil
|
||||||
|
(interactive "<r><a><!>")
|
||||||
|
(let* ((helm-ag-default-directory (if pwd-p default-directory (project-root)))
|
||||||
|
(helm-ag-command-option (concat (unless regex-p "-Q ") (if hidden-files-p "--hidden ")))
|
||||||
|
(input "")
|
||||||
|
(header-name (format "Search in %s" helm-ag-default-directory)))
|
||||||
|
(if search
|
||||||
|
(progn
|
||||||
|
(helm-attrset 'search-this-file nil helm-ag-source)
|
||||||
|
(setq helm-ag--last-query search))
|
||||||
|
(if (and beg end (/= beg (1- end)))
|
||||||
|
(setq input (buffer-substring-no-properties beg end))))
|
||||||
|
(helm-attrset 'name header-name helm-ag-source)
|
||||||
|
(helm :sources (if search (helm-ag--select-source) '(helm-source-do-ag))
|
||||||
|
:buffer "*helm-ag*"
|
||||||
|
:input input
|
||||||
|
:prompt helm-global-prompt)))
|
||||||
|
|
||||||
|
(evil-define-operator my:helm-ag-regex-search (beg end &optional search bang)
|
||||||
|
:type inclusive :repeat nil
|
||||||
|
(interactive "<r><a><!>")
|
||||||
|
(my:helm-ag-search beg end search bang nil t))
|
||||||
|
(evil-define-operator my:helm-ag-search-cwd (beg end &optional search bang)
|
||||||
|
;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted
|
||||||
|
;; as regexp
|
||||||
|
:type inclusive :repeat nil
|
||||||
|
(interactive "<r><a><!>")
|
||||||
|
(my:helm-ag-search beg end search bang t nil))
|
||||||
|
(evil-define-operator my:helm-ag-regex-search-cwd (beg end &optional search bang)
|
||||||
|
:type inclusive :repeat nil
|
||||||
|
(interactive "<r><a><!>")
|
||||||
|
(my:helm-ag-search beg end search bang t t))))
|
||||||
|
|
||||||
|
(use-package helm-company :defer t)
|
||||||
|
|
||||||
|
(use-package helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
|
||||||
|
:commands (helm-css-scss
|
||||||
|
helm-css-scss-multi
|
||||||
|
helm-css-scss-insert-close-comment))
|
||||||
|
|
||||||
|
(use-package helm-swoop ; https://github.com/ShingoFukuyama/helm-swoop
|
||||||
|
:commands (helm-swoop helm-multi-swoop my:helm-swoop)
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setq helm-swoop-use-line-number-face t
|
||||||
|
helm-swoop-split-with-multiple-windows t
|
||||||
|
helm-swoop-speed-or-color t
|
||||||
|
;; helm-swoop-split-window-function 'popwin:popup-buffer
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or
|
||||||
|
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is
|
||||||
|
;; `scss-mode'
|
||||||
|
(evil-define-command my:helm-swoop (&optional search bang)
|
||||||
|
:repeat nil
|
||||||
|
(interactive "<a><!>")
|
||||||
|
(if (eq major-mode 'scss-mode)
|
||||||
|
(if bang (helm-css-scss-multi search) (helm-css-scss search))
|
||||||
|
(if bang (helm-multi-swoop-all search) (helm-swoop :$query search))))))
|
||||||
|
|
||||||
(provide 'init-helm)
|
(provide 'init-helm)
|
||||||
;;; init-helm.el ends here
|
;;; init-helm.el ends here
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
(ido-everywhere 1)
|
(ido-everywhere 1)
|
||||||
|
|
||||||
(use-package ido-vertical-mode :config (ido-vertical-mode 1))
|
(use-package ido-vertical-mode :config (ido-vertical-mode 1))
|
||||||
(use-package ido-ubiquitous :config (ido-ubiquitous-mode 1))
|
|
||||||
(use-package flx-ido :config (flx-ido-mode 1))
|
(use-package flx-ido :config (flx-ido-mode 1))
|
||||||
|
(use-package ido-ubiquitous :config (ido-ubiquitous-mode 1))
|
||||||
|
|
||||||
(setq ido-use-faces nil
|
(setq ido-use-faces nil
|
||||||
ido-confirm-unique-completion t
|
ido-confirm-unique-completion t
|
||||||
|
@ -50,6 +50,18 @@
|
||||||
(lambda (x) (and (char-equal (string-to-char x) ?.) x))
|
(lambda (x) (and (char-equal (string-to-char x) ?.) x))
|
||||||
ido-temp-list))))
|
ido-temp-list))))
|
||||||
|
|
||||||
|
;; Press ~ to go to $HOME in ido
|
||||||
|
(add-hook 'ido-setup-hook
|
||||||
|
(lambda ()
|
||||||
|
;; Go straight home
|
||||||
|
(define-key ido-file-completion-map
|
||||||
|
(kbd "~")
|
||||||
|
(lambda ()
|
||||||
|
(interactive)
|
||||||
|
(if (looking-back "/")
|
||||||
|
(insert "~/")
|
||||||
|
(call-interactively 'self-insert-command))))))
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-ido)
|
(provide 'init-ido)
|
||||||
;;; init-ido.el ends here
|
;;; init-ido.el ends here
|
||||||
|
|
|
@ -41,8 +41,25 @@
|
||||||
|
|
||||||
(use-package android-mode
|
(use-package android-mode
|
||||||
:defer t
|
:defer t
|
||||||
|
:commands android-mode
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
|
(defun android-mode-is-layout-file ()
|
||||||
|
(and android-mode
|
||||||
|
(eq major-mode 'nxml-mode)
|
||||||
|
(string-equal (file-name-base (directory-file-name default-directory)) "layout")))
|
||||||
|
(defun android-mode-in-tags (&rest tags)
|
||||||
|
(-contains? tags (android-mode-tag-name)))
|
||||||
|
(defun android-mode-tag-name ()
|
||||||
|
(save-excursion
|
||||||
|
(let (beg end)
|
||||||
|
(nxml-backward-up-element)
|
||||||
|
(evil-forward-word-begin)
|
||||||
|
(setq beg (point))
|
||||||
|
(evil-forward-WORD-end)
|
||||||
|
(setq end (1+ (point)))
|
||||||
|
(buffer-substring-no-properties beg end))))
|
||||||
|
|
||||||
(defun my-android-mode-enable-maybe ()
|
(defun my-android-mode-enable-maybe ()
|
||||||
(let ((root (project-root)))
|
(let ((root (project-root)))
|
||||||
(when (or (project-has-files "local.properties" root)
|
(when (or (project-has-files "local.properties" root)
|
||||||
|
|
|
@ -10,7 +10,10 @@
|
||||||
|
|
||||||
;; TODO Tie into emr
|
;; TODO Tie into emr
|
||||||
(use-package php-refactor-mode
|
(use-package php-refactor-mode
|
||||||
:config (add-hook 'php-mode-hook 'php-refactor-mode))))
|
:config
|
||||||
|
(progn
|
||||||
|
(add-hook 'php-mode-hook 'emr-initialize)
|
||||||
|
(add-hook 'php-mode-hook 'php-refactor-mode)))))
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-php)
|
(provide 'init-php)
|
||||||
|
|
|
@ -1,39 +1,50 @@
|
||||||
;; Project nav+search tools (projectile, helm, ag)
|
;; Project nav+search tools (projectile, helm, ag)
|
||||||
(use-package neotree
|
(use-package neotree
|
||||||
:commands (neotree-show neotree-hide neotree-toggle)
|
:commands (neotree-show neotree-hide neotree-toggle neo-global--window-exists-p neotree-dir neotree-find)
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(defun my-neotree-open (&optional dir)
|
||||||
|
(interactive)
|
||||||
|
(neotree-dir (or dir (project-root))))
|
||||||
|
|
||||||
|
(defun my-neotree-toggle ()
|
||||||
|
(interactive)
|
||||||
|
(if (neo-global--window-exists-p)
|
||||||
|
(neotree-hide)
|
||||||
|
(my-neotree-open)))
|
||||||
|
|
||||||
|
(defun my-neotree-find ()
|
||||||
|
(interactive)
|
||||||
|
(save-excursion (my-neotree-open))
|
||||||
|
(neotree-find)))
|
||||||
:config
|
:config
|
||||||
(progn (setq neo-create-file-auto-open t
|
(progn
|
||||||
neo-smart-open t
|
(setq neo-create-file-auto-open t
|
||||||
neo-persist-show nil)
|
neo-mode-line-type 'neotree
|
||||||
(add-hook! 'neotree-mode-hook
|
neo-persist-show t
|
||||||
(setq mode-line-format nil)
|
neo-window-width 28
|
||||||
(bind evil-motion-state-local-map
|
neo-show-updir-line nil
|
||||||
(kbd "TAB") 'neotree-enter
|
neo-auto-indent-point t)
|
||||||
(kbd "RET") 'neotree-enter))))
|
(add-to-list 'evil-motion-state-modes 'neotree-mode)
|
||||||
|
(defun my-neotree-keymap ()
|
||||||
|
(bind evil-motion-state-local-map
|
||||||
|
"\\\\" 'neotree-hide
|
||||||
|
"RET" 'neotree-enter
|
||||||
|
"J" 'neotree-select-next-sibling-node
|
||||||
|
"K" 'neotree-select-previous-sibling-node
|
||||||
|
"H" 'neotree-select-up-node
|
||||||
|
"L" 'neotree-select-down-node
|
||||||
|
"v" 'neotree-enter-vertical-split
|
||||||
|
"s" 'neotree-enter-horizontal-split
|
||||||
|
"c" 'neotree-create-node
|
||||||
|
"d" 'neotree-delete-node
|
||||||
|
"g" 'neotree-refresh
|
||||||
|
"q" 'neotree-hide
|
||||||
|
"r" 'neotree-rename-node
|
||||||
|
"R" 'neotree-change-root
|
||||||
|
"?" 'neotree-))
|
||||||
|
|
||||||
(defun my-ido-find-project-file ()
|
(add-hook 'neotree-mode-hook 'my-neotree-keymap)))
|
||||||
(interactive)
|
|
||||||
(let ((default-directory (project-root)))
|
|
||||||
(ido-find-file)))
|
|
||||||
|
|
||||||
|
|
||||||
;; (use-package dired
|
|
||||||
;; :disabled t
|
|
||||||
;; :config
|
|
||||||
;; (progn
|
|
||||||
;; (setq dired-recursive-deletes 'always
|
|
||||||
;; dired-recursive-copies 'always
|
|
||||||
;; dired-auto-revert-buffer t
|
|
||||||
|
|
||||||
;; ;; if there is a dired buffer displayed in the next
|
|
||||||
;; ;; window, use its current subdir, instead of the
|
|
||||||
;; ;; current subdir of this dired buffer
|
|
||||||
;; dired-dwim-target t)
|
|
||||||
|
|
||||||
;; (push '(dired-mode :position bottom :height 0.5 :stick t) popwin:special-display-config)
|
|
||||||
|
|
||||||
;; (add-hook! 'dired-mode-hook
|
|
||||||
;; (use-package 'dired+ :config (toggle-diredp-find-file-reuse-dir 1)))))
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-project)
|
(provide 'init-project)
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
(use-package python
|
(use-package python
|
||||||
:mode ("\\.py\\'" . python-mode)
|
:mode ("\\.py\\'" . python-mode)
|
||||||
:interpreter ("python" . python-mode)
|
:interpreter ("python" . python-mode)
|
||||||
:init (add-hook 'python-mode-hook 'enable-tab-width-4)
|
:init
|
||||||
|
(progn
|
||||||
|
(add-hook 'python-mode-hook 'enable-tab-width-4)
|
||||||
|
(add-hook 'python-mode-hook 'emr-initialize))
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq-default python-indent-offset 4)
|
(setq-default python-indent-offset 4)
|
||||||
(setq python-environment-directory my-tmp-dir)
|
(setq python-environment-directory my-tmp-dir)
|
||||||
(setq python-shell-interpreter "ipython")
|
(setq python-shell-interpreter "ipython")
|
||||||
|
|
||||||
;; interferes with smartparens
|
;; interferes with smartparens
|
||||||
(define-key python-mode-map (kbd "DEL") nil)
|
(define-key python-mode-map (kbd "DEL") nil)
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,12 @@
|
||||||
(goto-char 2))
|
(goto-char 2))
|
||||||
(add-hook 'reb-mode-hook 'my--reb-cleanup)
|
(add-hook 'reb-mode-hook 'my--reb-cleanup)
|
||||||
|
|
||||||
|
(use-package pcre2el
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(bind 'normal rxt-help-mode-map [escape] 'kill-buffer-and-window)
|
||||||
|
(setq reb-re-syntax 'pcre)))
|
||||||
|
|
||||||
(after "evil"
|
(after "evil"
|
||||||
(evil-set-initial-state 'reb-mode 'insert)
|
(evil-set-initial-state 'reb-mode 'insert)
|
||||||
;; Either a) converts selected (or entered-in) pcre regex into elisp
|
;; Either a) converts selected (or entered-in) pcre regex into elisp
|
||||||
|
@ -45,13 +51,6 @@
|
||||||
(t
|
(t
|
||||||
(re-builder))))))))
|
(re-builder))))))))
|
||||||
|
|
||||||
(use-package pcre2el
|
|
||||||
:config
|
|
||||||
(progn
|
|
||||||
(bind 'normal rxt-help-mode-map [escape] 'kill-buffer-and-window)
|
|
||||||
|
|
||||||
(after "re-builder" (setq reb-re-syntax 'pcre))))
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-regex)
|
(provide 'init-regex)
|
||||||
;;; init-regex.el ends here
|
;;; init-regex.el ends here
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
("\\.rake$" . enh-ruby-mode)
|
("\\.rake$" . enh-ruby-mode)
|
||||||
("\\.gemspec$" . enh-ruby-mode)
|
("\\.gemspec$" . enh-ruby-mode)
|
||||||
("\\.?pryrc$" . enh-ruby-mode)
|
("\\.?pryrc$" . enh-ruby-mode)
|
||||||
("/Gemfile$" . enh-ruby-mode)
|
("/Gemfile$" . enh-ruby-mode)
|
||||||
("/Capfile$" . enh-ruby-mode)
|
("/Capfile$" . enh-ruby-mode)
|
||||||
("/Vagrantfile$" . enh-ruby-mode)
|
("/Vagrantfile$" . enh-ruby-mode)
|
||||||
("/Rakefile$" . enh-ruby-mode))
|
("/Rakefile$" . enh-ruby-mode))
|
||||||
:interpreter "ruby"
|
:interpreter "ruby"
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
@ -23,27 +23,31 @@
|
||||||
;; Don't interfere with my custom RET behavior
|
;; Don't interfere with my custom RET behavior
|
||||||
(define-key enh-ruby-mode-map [?\n] nil)
|
(define-key enh-ruby-mode-map [?\n] nil)
|
||||||
|
|
||||||
(after "emr"
|
(use-package ruby-refactor
|
||||||
(use-package ruby-refactor)
|
:init
|
||||||
(emr-declare-command 'ruby-refactor-extract-to-method
|
(add-hook 'enh-ruby-mode-hook 'emr-initialize)
|
||||||
:title "extract method"
|
:config
|
||||||
:modes 'enh-ruby-mode
|
(after "emr"
|
||||||
:predicate (lambda () (use-region-p)))
|
(emr-declare-command 'ruby-refactor-extract-to-method
|
||||||
(emr-declare-command 'ruby-refactor-extract-local-variable
|
:title "extract method"
|
||||||
:title "extract local variable"
|
:modes 'enh-ruby-mode
|
||||||
:modes 'enh-ruby-mode
|
:predicate (lambda () (use-region-p)))
|
||||||
:predicate (lambda () (use-region-p)))
|
(emr-declare-command 'ruby-refactor-extract-local-variable
|
||||||
(emr-declare-command 'ruby-refactor-extract-constant
|
:title "extract local variable"
|
||||||
:title "extract constant"
|
:modes 'enh-ruby-mode
|
||||||
:modes 'enh-ruby-mode
|
:predicate (lambda () (use-region-p)))
|
||||||
:predicate (lambda () (use-region-p)))
|
(emr-declare-command 'ruby-refactor-extract-constant
|
||||||
(emr-declare-command 'ruby-refactor-add-parameter
|
:title "extract constant"
|
||||||
:title "add parameter"
|
:modes 'enh-ruby-mode
|
||||||
:modes 'enh-ruby-mode)
|
:predicate (lambda () (use-region-p)))
|
||||||
(emr-declare-command 'ruby-refactor-extract-to-let
|
(emr-declare-command 'ruby-refactor-add-parameter
|
||||||
:title "extract to let"
|
:title "add parameter"
|
||||||
:modes 'enh-ruby-mode
|
:modes 'enh-ruby-mode)
|
||||||
:predicate (lambda () (use-region-p))))
|
(emr-declare-command 'ruby-refactor-extract-to-let
|
||||||
|
:title "extract to let"
|
||||||
|
:modes 'enh-ruby-mode
|
||||||
|
:predicate (lambda () (use-region-p)))))
|
||||||
|
|
||||||
|
|
||||||
;; Rakefiles ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; Rakefiles ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(define-minor-mode rake-mode
|
(define-minor-mode rake-mode
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
;; For GNU-Smalltalk
|
|
||||||
(use-package smalltalk-mode :mode "\\.g?st$")
|
|
||||||
|
|
||||||
(provide 'init-smalltalk)
|
|
||||||
;;; init-smalltalk.el ends here
|
|
|
@ -1,7 +1,7 @@
|
||||||
(use-package workgroups2
|
(use-package workgroups2
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq wg-session-file "~/.emacs.d/workgroups/.default")
|
(setq wg-session-file "~/.emacs.workgroup")
|
||||||
(setq wg-workgroup-directory "~/.emacs.d/workgroups/")
|
(setq wg-workgroup-directory "~/.emacs.d/workgroups/")
|
||||||
(setq wg-first-wg-name "main")
|
(setq wg-first-wg-name "main")
|
||||||
|
|
||||||
|
|
|
@ -1,36 +1,37 @@
|
||||||
(use-package yasnippet
|
(use-package yasnippet
|
||||||
|
:defer t
|
||||||
|
:commands (yas-minor-mode yas-minor-mode-on my--init-yas-mode my:snippets)
|
||||||
:mode (("emacs\\.d/snippets/.+$" . snippet-mode))
|
:mode (("emacs\\.d/snippets/.+$" . snippet-mode))
|
||||||
:demand t
|
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
(defvar yas-minor-mode-map
|
(defvar yas-minor-mode-map
|
||||||
;; Fix yasnippet keymaps so they only work in insert mode
|
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(bind 'insert map [(tab)] 'yas-expand)
|
(bind 'insert map [(tab)] 'yas-expand)
|
||||||
(bind 'insert map (kbd "TAB") 'yas-expand)
|
(bind 'visual map "<backtab>" 'yas-insert-snippet)
|
||||||
(bind 'visual map (kbd "<backtab>") 'yas-insert-snippet)
|
|
||||||
map))
|
map))
|
||||||
|
|
||||||
;; (add-hook 'snippet-mode-hook 'yas-minor-mode-on)
|
(add-hook 'snippet-mode-hook 'yas-minor-mode-on)
|
||||||
;; (add-hook 'text-mode-hook 'yas-minor-mode-on)
|
(add-hook 'text-mode-hook 'yas-minor-mode-on)
|
||||||
;; (add-hook 'prog-mode-hook 'yas-minor-mode-on)
|
(add-hook 'prog-mode-hook 'yas-minor-mode-on)
|
||||||
;; (add-hook 'org-mode-hook 'yas-minor-mode-on))
|
(add-hook 'org-mode-hook 'yas-minor-mode-on)
|
||||||
(add-hook 'snippet-mode-hook 'disable-final-newline))
|
(add-hook 'snippet-mode-hook 'disable-final-newline))
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
(bind 'insert [(tab)] nil)
|
||||||
|
(bind 'visual "<backtab>" nil)
|
||||||
|
|
||||||
(setq yas-verbosity 0)
|
(setq yas-verbosity 0)
|
||||||
(setq yas-indent-line 'auto)
|
(setq yas-indent-line 'auto)
|
||||||
(setq yas-also-auto-indent-first-line nil)
|
(setq yas-also-auto-indent-first-line t)
|
||||||
(setq yas-wrap-around-region nil)
|
(setq yas-wrap-around-region nil)
|
||||||
|
|
||||||
;; Only load personal snippets
|
;; Only load personal snippets
|
||||||
(setq yas-snippet-dirs `(,my-snippets-dir))
|
(setq yas-snippet-dirs `(,my-snippets-dir))
|
||||||
(setq yas-prompt-functions '(yas-ido-prompt yas-no-prompt))
|
(setq yas-prompt-functions '(yas-ido-prompt yas-no-prompt))
|
||||||
|
|
||||||
(yas-global-mode 1)
|
|
||||||
(yas-reload-all)
|
(yas-reload-all)
|
||||||
|
|
||||||
(after "helm"
|
(after "helm" (add-to-list 'yas-dont-activate 'helm-alive-p))
|
||||||
(add-to-list 'yas-dont-activate 'helm-alive-p))
|
|
||||||
|
|
||||||
;; Exit snippets on ESC in normal mode
|
;; Exit snippets on ESC in normal mode
|
||||||
(defadvice evil-force-normal-state (before evil-esc-quit-yasnippet activate)
|
(defadvice evil-force-normal-state (before evil-esc-quit-yasnippet activate)
|
||||||
|
@ -55,8 +56,7 @@
|
||||||
(1- (region-end)))))))
|
(1- (region-end)))))))
|
||||||
;; Previous hook causes yas-selected-text to persist between expansions.
|
;; Previous hook causes yas-selected-text to persist between expansions.
|
||||||
;; This little hack gets around it.
|
;; This little hack gets around it.
|
||||||
(add-hook! 'yas-after-exit-snippet-hook
|
(add-hook! 'yas-after-exit-snippet-hook (setq-local yas-selected-text nil))
|
||||||
(setq-local yas-selected-text nil))
|
|
||||||
|
|
||||||
(evil-define-operator my:snippets (beg end &optional name)
|
(evil-define-operator my:snippets (beg end &optional name)
|
||||||
:motion nil
|
:motion nil
|
||||||
|
@ -67,8 +67,7 @@
|
||||||
(if (and beg end)
|
(if (and beg end)
|
||||||
(yas-insert-snippet)
|
(yas-insert-snippet)
|
||||||
(if name
|
(if name
|
||||||
(popwin:find-file (concat my-snippets-dir
|
(popwin:find-file (concat my-snippets-dir (symbol-name major-mode) "/" name))
|
||||||
(symbol-name major-mode) "/" name))
|
|
||||||
(yas-visit-snippet-file))))
|
(yas-visit-snippet-file))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
|
|
||||||
(require 'yt-stopwatch)
|
|
||||||
|
|
||||||
(provide 'init-youtube)
|
|
||||||
;;; init-youtube.el ends here
|
|
||||||
|
|
|
@ -25,6 +25,17 @@
|
||||||
"M-d" 'dash-at-point
|
"M-d" 'dash-at-point
|
||||||
"M-R" 'my:eval-buffer)
|
"M-R" 'my:eval-buffer)
|
||||||
|
|
||||||
|
(when is-mac
|
||||||
|
;; Restore text nav keys
|
||||||
|
(bind "<A-left>" 'backward-word
|
||||||
|
"<A-right>" 'forward-word
|
||||||
|
"<M-backspace>" 'my.backward-kill-to-bol-and-indent
|
||||||
|
"A-SPC" 'just-one-space
|
||||||
|
"M-a" 'mark-whole-buffer
|
||||||
|
"M-c" 'evil-yank
|
||||||
|
"M-s" 'save-buffer
|
||||||
|
"M-v" 'yank))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Local keymaps ;;
|
;; Local keymaps ;;
|
||||||
|
@ -40,20 +51,20 @@
|
||||||
"," (λ (if (projectile-project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
|
"," (λ (if (projectile-project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
|
||||||
"<" 'helm-buffers-list
|
"<" 'helm-buffers-list
|
||||||
"." 'ido-find-file
|
"." 'ido-find-file
|
||||||
">" 'my-ido-find-project-file
|
">" (λ (let ((default-directory (project-root))) (ido-find-file)))
|
||||||
"/" 'helm-projectile-find-file
|
"/" 'helm-projectile-find-file
|
||||||
";" 'helm-semantic-or-imenu
|
";" 'helm-semantic-or-imenu
|
||||||
"M" 'helm-projectile-recentf ; recent PROJECT files
|
|
||||||
"]" 'helm-etags-select
|
"]" 'helm-etags-select
|
||||||
"a" 'helm-projectile-find-other-file
|
"a" 'helm-projectile-find-other-file
|
||||||
"E" 'my:init-files
|
"E" 'my:init-files
|
||||||
"g" 'git-gutter+-show-hunk
|
"g" 'git-gutter+-show-hunk
|
||||||
"h" 'helm-apropos
|
"h" 'helm-apropos
|
||||||
"m" 'helm-recentf
|
"m" 'helm-recentf
|
||||||
|
"M" 'helm-projectile-recentf ; recent PROJECT files
|
||||||
"p" 'helm-projectile-switch-project
|
"p" 'helm-projectile-switch-project
|
||||||
"r" 'emr-show-refactor-menu ; init-dev.el
|
"r" 'emr-show-refactor-menu ; init-dev.el
|
||||||
"qq" 'evil-save-and-quit
|
"qq" 'evil-save-and-quit
|
||||||
"QQ" 'evil-quit-all
|
"QQ" (λ (my:kill-buffers t) (evil-quit-all))
|
||||||
|
|
||||||
"oo" 'my-open-with
|
"oo" 'my-open-with
|
||||||
"of" (λ (my-open-with "Finder.app" default-directory))
|
"of" (λ (my-open-with "Finder.app" default-directory))
|
||||||
|
@ -69,7 +80,8 @@
|
||||||
|
|
||||||
;; <localleader>
|
;; <localleader>
|
||||||
(bind my-localleader-map
|
(bind my-localleader-map
|
||||||
"\\" 'neotree-toggle
|
"\\" 'my-neotree-toggle
|
||||||
|
"." 'my-neotree-find
|
||||||
";" 'linum-mode
|
";" 'linum-mode
|
||||||
"=" 'toggle-transparency
|
"=" 'toggle-transparency
|
||||||
"E" 'evil-emacs-state
|
"E" 'evil-emacs-state
|
||||||
|
@ -85,22 +97,24 @@
|
||||||
|
|
||||||
|
|
||||||
(bind 'normal
|
(bind 'normal
|
||||||
"," 'my-leader-map
|
"," 'my-leader-map
|
||||||
"\\" 'my-localleader-map
|
"\\" 'my-localleader-map
|
||||||
|
|
||||||
;; behave like D and C; yank to end of line
|
;; behave like D and C; yank to end of line
|
||||||
"Y" (λ (evil-yank (point) (point-at-eol)))
|
"Y" (λ (evil-yank (point) (point-at-eol)))
|
||||||
"zx" 'my-kill-real-buffer
|
"zx" 'my-kill-real-buffer
|
||||||
"ZX" 'bury-buffer
|
"ZX" 'bury-buffer
|
||||||
"]b" 'my-next-real-buffer
|
"]b" 'my-next-real-buffer
|
||||||
"[b" 'my-previous-real-buffer
|
"[b" 'my-previous-real-buffer
|
||||||
"]w" 'wg-switch-to-workgroup-right
|
"]w" 'wg-switch-to-workgroup-right
|
||||||
"[w" 'wg-switch-to-workgroup-left
|
"[w" 'wg-switch-to-workgroup-left
|
||||||
|
|
||||||
;; Increment/decrement number under cursor
|
;; Increment/decrement number under cursor
|
||||||
"g=" 'evil-numbers/inc-at-pt
|
"g=" 'evil-numbers/inc-at-pt
|
||||||
"g-" 'evil-numbers/dec-at-pt
|
"g-" 'evil-numbers/dec-at-pt
|
||||||
"gR" 'my:eval-buffer ; init-dev.el
|
"gR" 'my:eval-buffer ; init-dev.el
|
||||||
|
"gc" 'evil-commentary
|
||||||
|
"gy" 'evil-commentary-yank
|
||||||
|
|
||||||
'visual
|
'visual
|
||||||
", =" 'align-regexp
|
", =" 'align-regexp
|
||||||
|
@ -117,6 +131,9 @@
|
||||||
'normal "X" 'evil-exchange
|
'normal "X" 'evil-exchange
|
||||||
|
|
||||||
'motion
|
'motion
|
||||||
|
"%" 'evilmi-jump-items
|
||||||
|
[tab] 'evilmi-jump-items ; alias for %
|
||||||
|
|
||||||
"]g" 'git-gutter+-next-hunk
|
"]g" 'git-gutter+-next-hunk
|
||||||
"[g" 'git-gutter+-previous-hunk
|
"[g" 'git-gutter+-previous-hunk
|
||||||
|
|
||||||
|
@ -148,6 +165,29 @@
|
||||||
"j" 'my--maybe-exit-insert-mode
|
"j" 'my--maybe-exit-insert-mode
|
||||||
"C-g" 'evil-normal-state
|
"C-g" 'evil-normal-state
|
||||||
|
|
||||||
|
;; Company-mode
|
||||||
|
"C-SPC" 'company-complete-common
|
||||||
|
"C-x C-k" 'company-dictionary
|
||||||
|
"C-x C-f" 'company-files
|
||||||
|
"C-x C-]" 'company-etags
|
||||||
|
"C-x s" 'company-ispell
|
||||||
|
"C-x C-s" 'company-yasnippet
|
||||||
|
"C-x C-o" 'company-semantic
|
||||||
|
"C-x C-n" 'company-dabbrev-code
|
||||||
|
"C-x C-p" (λ (let ((company-selection-wrap-around t))
|
||||||
|
(call-interactively 'company-dabbrev-code)
|
||||||
|
(company-select-previous-or-abort)))
|
||||||
|
|
||||||
|
'operator
|
||||||
|
"s" 'evil-surround-edit
|
||||||
|
"S" 'evil-Surround-edit
|
||||||
|
|
||||||
|
'visual
|
||||||
|
"z" 'evil-snipe-s
|
||||||
|
"Z" 'evil-snipe-S
|
||||||
|
|
||||||
|
"S" 'evil-surround-region
|
||||||
|
|
||||||
;; Rotate-text (see elisp/rotate-text.el)
|
;; Rotate-text (see elisp/rotate-text.el)
|
||||||
'normal "!" 'rotate-word-at-point
|
'normal "!" 'rotate-word-at-point
|
||||||
'visual "!" 'rotate-region
|
'visual "!" 'rotate-region
|
||||||
|
@ -155,17 +195,21 @@
|
||||||
'emacs
|
'emacs
|
||||||
[escape] 'evil-normal-state)
|
[escape] 'evil-normal-state)
|
||||||
|
|
||||||
;; Enable TAB to do matchit
|
|
||||||
(bind 'motion evil-matchit-mode-map [tab] 'evilmi-jump-items)
|
|
||||||
|
|
||||||
(bind evil-window-map
|
(bind evil-window-map
|
||||||
;; winner-mode: window layout undo/redo (see init-core.el)
|
;; winner-mode: window layout undo/redo (see core.el)
|
||||||
"u" 'winner-undo
|
"u" 'winner-undo
|
||||||
"C-u" 'winner-undo
|
"C-u" 'winner-undo
|
||||||
"C-r" 'winner-redo)
|
"C-r" 'winner-redo)
|
||||||
|
|
||||||
|
;; Real go-to-definition for elisp
|
||||||
|
(bind 'motion emacs-lisp-mode-map
|
||||||
|
"gd" (λ (let ((func (function-called-at-point)))
|
||||||
|
(if func (find-function func))))
|
||||||
|
"gD" (λ (let ((func (function-called-at-point)))
|
||||||
|
(if func (find-function-other-window func)))))
|
||||||
|
|
||||||
;; Peek at file from dired
|
;; Peek at file from dired
|
||||||
(bind dired-mode-map "o" (λ (popwin:find-file (dired-get-file-for-visit))))
|
;; (bind dired-mode-map "o" (λ (popwin:find-file (dired-get-file-for-visit))))
|
||||||
|
|
||||||
(after "help-mode"
|
(after "help-mode"
|
||||||
(bind 'normal help-mode-map
|
(bind 'normal help-mode-map
|
||||||
|
@ -177,26 +221,14 @@
|
||||||
(kbd "<M-return>") 'evil-open-below
|
(kbd "<M-return>") 'evil-open-below
|
||||||
(kbd "<S-M-return>") 'evil-open-above)
|
(kbd "<S-M-return>") 'evil-open-above)
|
||||||
|
|
||||||
(when is-mac
|
|
||||||
;; Restore text nav keys
|
|
||||||
(bind "<A-left>" 'backward-word
|
|
||||||
"<A-right>" 'forward-word
|
|
||||||
"<M-backspace>" 'my.backward-kill-to-bol-and-indent
|
|
||||||
"M-a" 'mark-whole-buffer
|
|
||||||
"M-c" 'evil-yank
|
|
||||||
"M-s" 'save-buffer
|
|
||||||
"M-v" 'yank))
|
|
||||||
|
|
||||||
;; Fix osx keymappings and then some
|
;; Fix osx keymappings and then some
|
||||||
(use-package smart-forward
|
(bind 'insert
|
||||||
:config
|
"<M-left>" 'my.move-to-bol
|
||||||
(bind 'insert
|
"<M-right>" 'my.move-to-eol
|
||||||
"<M-left>" 'my.move-to-bol
|
"<M-up>" 'beginning-of-buffer
|
||||||
"<M-right>" 'my.move-to-eol
|
"<M-down>" 'end-of-buffer
|
||||||
"<M-up>" 'beginning-of-buffer
|
"<A-up>" 'smart-up
|
||||||
"<M-down>" 'end-of-buffer
|
"<A-down>" 'smart-down)
|
||||||
"<A-up>" 'smart-up
|
|
||||||
"<A-down>" 'smart-down))
|
|
||||||
|
|
||||||
;; Line selection via linum
|
;; Line selection via linum
|
||||||
(bind "<left-margin> <down-mouse-1>" 'my-select-linum
|
(bind "<left-margin> <down-mouse-1>" 'my-select-linum
|
||||||
|
@ -204,6 +236,9 @@
|
||||||
"<left-margin> <drag-mouse-1>" 'my-select-linum
|
"<left-margin> <drag-mouse-1>" 'my-select-linum
|
||||||
"<left-margin> <double-mouse-1>" 'my-select-block)
|
"<left-margin> <double-mouse-1>" 'my-select-block)
|
||||||
|
|
||||||
|
(bind 'visual
|
||||||
|
"*" 'evil-visualstar/begin-search-forward
|
||||||
|
"#" 'evil-visualstar/begin-search-backward)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Keymap fixes ;;
|
;; Keymap fixes ;;
|
||||||
|
@ -217,7 +252,7 @@
|
||||||
(bind 'insert "<tab>" 'my.dumb-indent)
|
(bind 'insert "<tab>" 'my.dumb-indent)
|
||||||
(bind 'insert "<A-tab>" 'indent-for-tab-command)
|
(bind 'insert "<A-tab>" 'indent-for-tab-command)
|
||||||
|
|
||||||
;; Except for lisp
|
;; No dumb-tab for lisp
|
||||||
(bind 'insert lisp-mode-map [remap my.dumb-indent] 'indent-for-tab-command)
|
(bind 'insert lisp-mode-map [remap my.dumb-indent] 'indent-for-tab-command)
|
||||||
(bind 'insert emacs-lisp-mode-map [remap my.dumb-indent] 'indent-for-tab-command)
|
(bind 'insert emacs-lisp-mode-map [remap my.dumb-indent] 'indent-for-tab-command)
|
||||||
|
|
||||||
|
@ -246,7 +281,25 @@
|
||||||
minibuffer-local-completion-map
|
minibuffer-local-completion-map
|
||||||
minibuffer-local-must-match-map
|
minibuffer-local-must-match-map
|
||||||
minibuffer-local-isearch-map))
|
minibuffer-local-isearch-map))
|
||||||
(bind map "<escape>" 'keyboard-escape-quit))
|
(bind map [escape] 'my--minibuffer-quit))
|
||||||
|
(bind 'emacs [escape] 'my--minibuffer-quit)
|
||||||
|
|
||||||
|
;; Redefine to get rid of that silly delete-other-windows nonsense
|
||||||
|
(defun keyboard-escape-quit ()
|
||||||
|
(interactive)
|
||||||
|
(cond ((eq last-command 'mode-exited) nil)
|
||||||
|
((region-active-p)
|
||||||
|
(deactivate-mark))
|
||||||
|
((> (minibuffer-depth) 0)
|
||||||
|
(abort-recursive-edit))
|
||||||
|
(current-prefix-arg
|
||||||
|
nil)
|
||||||
|
((> (recursion-depth) 0)
|
||||||
|
(exit-recursive-edit))
|
||||||
|
(buffer-quit-function
|
||||||
|
(funcall buffer-quit-function))
|
||||||
|
((string-match "^ \\*" (buffer-name (current-buffer)))
|
||||||
|
(bury-buffer))))
|
||||||
|
|
||||||
(dolist (map (list evil-ex-search-keymap minibuffer-local-map))
|
(dolist (map (list evil-ex-search-keymap minibuffer-local-map))
|
||||||
(bind map "\C-w" 'evil-delete-backward-word))
|
(bind map "\C-w" 'evil-delete-backward-word))
|
||||||
|
|
|
@ -25,6 +25,17 @@
|
||||||
(exmap "t" 'my:tmux-run)
|
(exmap "t" 'my:tmux-run)
|
||||||
(exmap "tcd" 'my:tmux-chdir)
|
(exmap "tcd" 'my:tmux-chdir)
|
||||||
|
|
||||||
|
(exmap "a" 'helm-projectile-find-other-file)
|
||||||
|
(exmap "proj[ect]" 'helm-projectile-switch-project)
|
||||||
|
(exmap "ag" 'my:helm-ag-search)
|
||||||
|
(exmap "agr" 'my:helm-ag-regex-search)
|
||||||
|
(exmap "ag[cw]d" 'my:helm-ag-search-cwd)
|
||||||
|
(exmap "agr[cw]d" 'my:helm-ag-regex-search-cwd)
|
||||||
|
(exmap "sw[oop]" 'my:helm-swoop)
|
||||||
|
(exmap "rec[ent]" 'my:helm-recentf)
|
||||||
|
(exmap "snip[pets]" 'my:snippets)
|
||||||
|
(exmap "ref[actor]" 'emr-show-refactor-menu)
|
||||||
|
|
||||||
(after "flycheck"
|
(after "flycheck"
|
||||||
(exmap "er[rors]" (λ (flycheck-buffer) (flycheck-list-errors))))
|
(exmap "er[rors]" (λ (flycheck-buffer) (flycheck-list-errors))))
|
||||||
|
|
||||||
|
@ -33,22 +44,6 @@
|
||||||
(exmap "grevert" 'git-gutter+-revert-hunks)
|
(exmap "grevert" 'git-gutter+-revert-hunks)
|
||||||
(exmap "gdiff" 'git-gutter+-show-hunk))
|
(exmap "gdiff" 'git-gutter+-show-hunk))
|
||||||
|
|
||||||
(after "helm"
|
|
||||||
(exmap "a" 'helm-projectile-find-other-file)
|
|
||||||
(exmap "proj[ect]" 'helm-projectile-switch-project)
|
|
||||||
(exmap "ag" 'my:helm-ag-search)
|
|
||||||
(exmap "agr" 'my:helm-ag-regex-search)
|
|
||||||
(exmap "ag[cw]d" 'my:helm-ag-search-cwd)
|
|
||||||
(exmap "agr[cw]d" 'my:helm-ag-regex-search-cwd)
|
|
||||||
(exmap "sw[oop]" 'my:helm-swoop)
|
|
||||||
(exmap "rec[ent]" 'my:helm-recentf))
|
|
||||||
|
|
||||||
(after "yasnippet"
|
|
||||||
(exmap "snip[pets]" 'my:snippets))
|
|
||||||
|
|
||||||
(after "emr"
|
|
||||||
(exmap "ref[actor]" 'emr-show-refactor-menu))
|
|
||||||
|
|
||||||
(after "re-builder"
|
(after "re-builder"
|
||||||
(exmap "re[gex]" 'my:regex))
|
(exmap "re[gex]" 'my:regex))
|
||||||
|
|
||||||
|
|
|
@ -1,44 +1,7 @@
|
||||||
;;;; Modes 'n hooks ;;;;;;;;;;;;;;;;;
|
|
||||||
(associate-mode "/LICENSE[^/]*$" 'text-mode)
|
|
||||||
(associate-mode "zsh\\(env\\|rc\\)?$" 'sh-mode)
|
|
||||||
(associate-mode "z\\(profile\\|login\\|logout\\)?$" 'sh-mode)
|
|
||||||
(associate-mode "zsh/" 'sh-mode)
|
|
||||||
(associate-mode "\\.applescript$" 'applescript-mode)
|
|
||||||
(associate-mode "Cask$" 'emacs-lisp-mode)
|
|
||||||
(associate-mode "\\.el\\.gz$" 'emacs-lisp-mode)
|
|
||||||
(associate-mode "/Makefile$" 'makefile-gmake-mode)
|
|
||||||
(associate-mode "\\.plist$" 'nxml-mode)
|
|
||||||
|
|
||||||
;; (setenv "SHELL" (s-trim (shell-command-to-string "which zsh")))
|
|
||||||
(setenv "SHELL" "/usr/local/bin/zsh")
|
|
||||||
(setenv "EMACS" "1")
|
|
||||||
|
|
||||||
;; show-paren faces
|
|
||||||
(set-face-background 'show-paren-match nil)
|
|
||||||
(set-face-foreground 'show-paren-match "orange")
|
|
||||||
(set-face-attribute 'show-paren-match nil :weight 'extra-bold)
|
|
||||||
(let ((face 'evil-search-highlight-persist-highlight-face))
|
|
||||||
(set-face-attribute face nil :inherit 'isearch-lazy-highlight-face)
|
|
||||||
(set-face-foreground face nil)
|
|
||||||
(set-face-background face nil))
|
|
||||||
|
|
||||||
(set-register ?. "~/.dotfiles/")
|
(set-register ?. "~/.dotfiles/")
|
||||||
(set-register ?d "~/Dropbox/Projects/")
|
(set-register ?d "~/Dropbox/Projects/")
|
||||||
(set-register ?@ "~/.emacs.d/init.el")
|
(set-register ?@ "~/.emacs.d/init.el")
|
||||||
|
|
||||||
(add-hook 'help-mode-hook 'visual-line-mode)
|
|
||||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
|
||||||
|
|
||||||
;; Performance checks
|
|
||||||
(add-hook! 'find-file-hook
|
|
||||||
;; If file is oversized...
|
|
||||||
(when (> (buffer-size) (* 1024 1024))
|
|
||||||
(setq buffer-read-only t)
|
|
||||||
(buffer-disable-undo)
|
|
||||||
(fundamental-mode)
|
|
||||||
(visual-line-mode)))
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Keymap Fixes ;;;;;;;;;;;;;;;;;;;;;;
|
;;;; Keymap Fixes ;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Implements some helpful keymappings for emacs sub-modes
|
;; Implements some helpful keymappings for emacs sub-modes
|
||||||
(add-hook! 'ido-setup-hook
|
(add-hook! 'ido-setup-hook
|
||||||
|
@ -53,8 +16,7 @@
|
||||||
(dolist (map (list evil-ex-search-keymap minibuffer-local-map))
|
(dolist (map (list evil-ex-search-keymap minibuffer-local-map))
|
||||||
(bind map "\C-w" 'evil-delete-backward-word))
|
(bind map "\C-w" 'evil-delete-backward-word))
|
||||||
|
|
||||||
(bind minibuffer-local-map
|
(bind minibuffer-local-map "\C-u" 'evil-delete-whole-line)
|
||||||
"\C-u" 'evil-delete-whole-line)
|
|
||||||
|
|
||||||
;; Redefine to get rid of that silly delete-other-windows nonsense
|
;; Redefine to get rid of that silly delete-other-windows nonsense
|
||||||
;; (defun keyboard-escape-quit ()
|
;; (defun keyboard-escape-quit ()
|
||||||
|
|
|
@ -119,6 +119,8 @@
|
||||||
`(rainbow-delimiters-unmatched-face ((t (:inherit 'error))))
|
`(rainbow-delimiters-unmatched-face ((t (:inherit 'error))))
|
||||||
`(rainbow-delimiters-depth-1-face ((t (:foreground "#CCCCCC" :weight bold :bold t))))
|
`(rainbow-delimiters-depth-1-face ((t (:foreground "#CCCCCC" :weight bold :bold t))))
|
||||||
|
|
||||||
|
`(linum-highlight-face ((t (:background ,gutters-active))))
|
||||||
|
|
||||||
;; js2-mode
|
;; js2-mode
|
||||||
;; *****************************************************************************************
|
;; *****************************************************************************************
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue