Add eclim, omnisharp, and cpp support
This commit is contained in:
parent
48e4d30534
commit
bdba39ddf9
25 changed files with 963 additions and 466 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
vendor/
|
elpa/
|
||||||
tmp/
|
tmp/
|
||||||
eshell/
|
eshell/
|
||||||
auto-save-list/
|
auto-save-list/
|
||||||
|
|
425
elisp/shaderlab-mode.el
Normal file
425
elisp/shaderlab-mode.el
Normal file
|
@ -0,0 +1,425 @@
|
||||||
|
;;; shaderlab-mode-el -- Major mode for editing Shaderlab files
|
||||||
|
|
||||||
|
;; Author: Simon Carter <bbbscarter@gmail.com>
|
||||||
|
;; Created: 1 August 2011
|
||||||
|
;; Keywords: Shaderlab languages
|
||||||
|
|
||||||
|
;; Copyright (C) 2011 Simon Carter <bbbscarter@gmail.com>
|
||||||
|
|
||||||
|
;; This program 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 of
|
||||||
|
;; the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
;; This program 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 this program; if not, write to the Free
|
||||||
|
;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
;; MA 02111-1307 USA
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
;; Borrows heavily from cg-mode.el for syntax highlighting.
|
||||||
|
;; In addition, provides custom indentation, and works with other
|
||||||
|
;; shaderlab structures, such as material blocks, subshaders, etc.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(defconst shaderlab-font-lock-keywords-1 nil
|
||||||
|
"Subdued level highlighting for shaderlab mode.")
|
||||||
|
|
||||||
|
(defconst shaderlab-font-lock-keywords-2 nil
|
||||||
|
"Medium level highlighting for Shaderlab mode.
|
||||||
|
See also `shaderlab-font-lock-extra-types'.")
|
||||||
|
|
||||||
|
(defconst shaderlab-font-lock-keywords-3 nil
|
||||||
|
"Gaudy level highlighting for Shaderlab mode.
|
||||||
|
See also `shaderlab-font-lock-extra-types'.")
|
||||||
|
|
||||||
|
;; taken largely from the c mode from font-lock.el
|
||||||
|
(let* ((shaderlab-keywords
|
||||||
|
(eval-when-compile
|
||||||
|
(regexp-opt '("break" "continue" "do" "else" "for" "if" "return"
|
||||||
|
"while"
|
||||||
|
"asm" "asm_fragment"
|
||||||
|
"technique" "pass" "compile"
|
||||||
|
"in" "out" "inout"
|
||||||
|
"typedef" "static" "const" "uniform" "packed"
|
||||||
|
"Shader" "Properties" "SubShader" "Pass"
|
||||||
|
"Material"
|
||||||
|
"Tags" "LOD" "Cull"
|
||||||
|
"CGPROGRAM" "ENDCG"
|
||||||
|
"Fallback"))))
|
||||||
|
(shaderlab-type-specs
|
||||||
|
(eval-when-compile
|
||||||
|
(regexp-opt '("struct" "interface"))))
|
||||||
|
(shaderlab-type-specs-depth
|
||||||
|
(regexp-opt-depth shaderlab-type-specs))
|
||||||
|
(shaderlab-type-names
|
||||||
|
`(mapconcat 'identity
|
||||||
|
(cons
|
||||||
|
,(eval-when-compile
|
||||||
|
(regexp-opt
|
||||||
|
'("void" "string"
|
||||||
|
"fragout" "fragout_float"
|
||||||
|
"sampler" "sampler1D" "sampler2D" "sampler3D"
|
||||||
|
"samplerCube" "samplerRECT"
|
||||||
|
"SurfaceOutput")))
|
||||||
|
'("\\(bool\\|double\\|c?float\\|fixed\\|half\\|c?int\\)\\([1234]\\(x[1234]\\)?\\)?"))
|
||||||
|
"\\|"))
|
||||||
|
(shaderlab-type-names-depth
|
||||||
|
`(regexp-opt-depth ,shaderlab-type-names))
|
||||||
|
(shaderlab-reserved-names
|
||||||
|
(eval-when-compile
|
||||||
|
(regexp-opt
|
||||||
|
;; reserved but not supported (Cg is UGLY!)
|
||||||
|
'("short" "dword" "long" "signed"
|
||||||
|
"auto" "catch" "char" "class" "column major"
|
||||||
|
"const_cast" "decl" "default" "delete"
|
||||||
|
"discard" "dynamic_cast" "emit" "enum" "explicit"
|
||||||
|
"extern" "friend" "get" "goto" "inline"
|
||||||
|
"long" "mutable" "namespace" "new" "operator"
|
||||||
|
"pixelfragment" "pixelshader" "private"
|
||||||
|
"protected" "public" "register" "reinterpret_cast"
|
||||||
|
"row_major" "sampler_state" "shared" "sizeof"
|
||||||
|
"static_cast" "template" "this" "throw"
|
||||||
|
"try" "typeid" "typename" "union" "using"
|
||||||
|
"virtual" "volatile" "__identifier"
|
||||||
|
"switch" "case" "default"))))
|
||||||
|
(shaderlab-reserved-names-depth
|
||||||
|
`(regexp-opt-depth ,shaderlab-reserved-names))
|
||||||
|
(shaderlab-bindings
|
||||||
|
(eval-when-compile
|
||||||
|
(regexp-opt
|
||||||
|
'("COLOR" "COLOR0" "COLOR1" "COLOR2" "COLOR3"
|
||||||
|
"POSITION" "BLENDWEIGHT" "NORMAL" "DIFFUSE"
|
||||||
|
"SPECULAR" "FOGCOORD" "PSIZE" "ATTR6" "TANGENT"
|
||||||
|
"TEXCOORD0" "TEXCOORD1" "TEXCOORD2" "TEXCOORD3"
|
||||||
|
"TEXCOORD4" "TEXCOORD5" "TEXCOORD6" "TEXCOORD7"
|
||||||
|
"HPOS" "PSIZ" "FOG" "FOGC" "COL0" "COL1" "BCOL0"))))
|
||||||
|
(shaderlab-bindings-depth
|
||||||
|
(regexp-opt-depth shaderlab-bindings))
|
||||||
|
(shaderlab-math-calls
|
||||||
|
(eval-when-compile
|
||||||
|
(regexp-opt
|
||||||
|
'(;; Mathmatical Functions
|
||||||
|
"abs" "acos" "all" "any" "asin" "atan" "atan2" "ceil" "clamp"
|
||||||
|
"cos" "cosh" "cross" "degrees" "determinant" "dot" "exp" "exp2"
|
||||||
|
"floor" "fmod" "frac" "frexp" "isfinite" "isinf" "isnan" "ldexp"
|
||||||
|
"lerp" "lit" "log" "log2" "log10" "max" "min" "modf" "mul" "noise"
|
||||||
|
"pow" "radians" "round" "rsqrt" "saturate" "sign" "sin" "sincos"
|
||||||
|
"sinh" "smoothstep" "step" "sqrt" "tan" "tanh" "transpose"
|
||||||
|
;; Geometric Functions
|
||||||
|
"distance" "faceforward" "length" "normalize" "reflect" "refract"
|
||||||
|
;; Texture Map Functions
|
||||||
|
"tex1D" "tex1Dproj" "tex2D" "tex2Dproj" "texRECT" "texRECTproj"
|
||||||
|
"tex3D" "tex3Dproj" "texCUBE texCUBEproj"
|
||||||
|
;; Derivitive Functions
|
||||||
|
"ddx" "ddy"
|
||||||
|
;; Debugging Function
|
||||||
|
"debug"
|
||||||
|
))))
|
||||||
|
(shaderlab-math-calls-depth
|
||||||
|
(regexp-opt-depth shaderlab-math-calls))
|
||||||
|
(shaderlab-preprocessor-directives
|
||||||
|
(eval-when-compile
|
||||||
|
(regexp-opt
|
||||||
|
'("define" "else" "endif" "if" "ifdef" "elif"
|
||||||
|
"ifndef" "include" "line" "pragma" "undef"))))
|
||||||
|
(shaderlab-preprocessor-directives-depth
|
||||||
|
(regexp-opt-depth shaderlab-preprocessor-directives)))
|
||||||
|
|
||||||
|
|
||||||
|
(setq shaderlab-font-lock-keywords-1
|
||||||
|
(list
|
||||||
|
;;
|
||||||
|
;; These are all anchored at the beginning of line for speed.
|
||||||
|
;;
|
||||||
|
;; Fontify function name definitions (GNU style; without type on line).
|
||||||
|
'("^\\(\\sw+\\)[ \t]*(" 1 font-lock-function-name-face)
|
||||||
|
;;
|
||||||
|
;'("\".*\"" . font-lock-string-face)
|
||||||
|
;; Fontify error directives.
|
||||||
|
'("^#[ \t]*error[ \t]+\\(.+\\)" 1 font-lock-warning-face prepend)
|
||||||
|
;;
|
||||||
|
;; Fontify filenames in #include <...> preprocessor directives as strings.
|
||||||
|
'("^#[ \t]*\\(import\\|include\\)[ \t]*\\(<[^>\"\n]*>?\\)"
|
||||||
|
2 font-lock-string-face)
|
||||||
|
;;
|
||||||
|
;; Fontify function macro names.
|
||||||
|
'("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
|
||||||
|
;;
|
||||||
|
;; Fontify symbol names in #if ... defined preprocessor directives.
|
||||||
|
'("^#[ \t]*\\(elif\\|if\\)\\>"
|
||||||
|
("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
|
||||||
|
(1 font-lock-builtin-face) (2 font-lock-variable-name-face nil t)))
|
||||||
|
;;
|
||||||
|
;; Fontify otherwise as symbol names, and the preprocessor directive names.
|
||||||
|
(list
|
||||||
|
(concat "^#[ \t]*\\(" shaderlab-preprocessor-directives
|
||||||
|
"\\)\\>[ \t!]*\\(\\sw+\\)?")
|
||||||
|
'(1 font-lock-builtin-face)
|
||||||
|
(list (+ 2 shaderlab-preprocessor-directives-depth)
|
||||||
|
'font-lock-variable-name-face nil t))))
|
||||||
|
|
||||||
|
(setq shaderlab-font-lock-keywords-2
|
||||||
|
(append shaderlab-font-lock-keywords-1
|
||||||
|
(list
|
||||||
|
;;
|
||||||
|
;; Simple regexps for speed.
|
||||||
|
;;
|
||||||
|
;; Fontify all type names.
|
||||||
|
`(eval .
|
||||||
|
(cons (concat "\\<\\(" ,shaderlab-type-names "\\)\\>") 'font-lock-type-face))
|
||||||
|
;;
|
||||||
|
;; Fontify all bindings.
|
||||||
|
`(eval .
|
||||||
|
(cons (concat "\\<\\(" ,shaderlab-bindings "\\)\\>") 'font-lock-constant-face))
|
||||||
|
;;
|
||||||
|
;; Fontify all math calls.
|
||||||
|
`(eval .
|
||||||
|
(cons (concat "\\<\\(" ,shaderlab-math-calls "\\)\\>") 'font-lock-builtin-face))
|
||||||
|
;;
|
||||||
|
;; Fontify reserved but unimplemented keywords
|
||||||
|
`(eval .
|
||||||
|
(cons (concat "\\<\\(" ,shaderlab-reserved-names "\\)\\>") 'font-lock-warning-face))
|
||||||
|
;;
|
||||||
|
;; Fontify all builtin keywords (except case, default and goto; see below).
|
||||||
|
(concat "\\<\\(" shaderlab-keywords "\\|" shaderlab-type-specs "\\)\\>")
|
||||||
|
;;
|
||||||
|
;; Fontify case/goto keywords and targets, and case default/goto tags.
|
||||||
|
'("\\<\\(case\\|goto\\)\\>"
|
||||||
|
(1 font-lock-keyword-face)
|
||||||
|
("\\(-[0-9]+\\|\\sw+\\)"
|
||||||
|
;; Return limit of search.
|
||||||
|
(save-excursion (skip-chars-forward "^:\n") (point))
|
||||||
|
nil
|
||||||
|
(1 font-lock-constant-face nil t)))
|
||||||
|
;; Anders Lindgren <andersl@andersl.com> points out that it is quicker to
|
||||||
|
;; use MATCH-ANCHORED to effectively anchor the regexp on the left.
|
||||||
|
;; This must come after the one for keywords and targets.
|
||||||
|
'(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:[ \t]*$"
|
||||||
|
(beginning-of-line) (end-of-line)
|
||||||
|
(1 font-lock-constant-face)))
|
||||||
|
)))
|
||||||
|
|
||||||
|
(setq shaderlab-font-lock-keywords-3
|
||||||
|
(append shaderlab-font-lock-keywords-2
|
||||||
|
;;
|
||||||
|
;; More complicated regexps for more complete highlighting for types.
|
||||||
|
;; We still have to fontify type specifiers individually, as C is so hairy.
|
||||||
|
(list
|
||||||
|
;;
|
||||||
|
;; Fontify builtin true and false constants
|
||||||
|
'("\\(true\\|false\\)" 1 font-lock-constant-face)
|
||||||
|
;;
|
||||||
|
;; Fontify all storage types, plus their items.
|
||||||
|
`(eval .
|
||||||
|
(list (concat "\\<\\(" ,shaderlab-type-names "\\)\\>"
|
||||||
|
"\\([ \t*&]+\\sw+\\>\\)*")
|
||||||
|
;; Fontify each declaration item.
|
||||||
|
(list 'font-lock-match-c-style-declaration-item-and-skip-to-next
|
||||||
|
;; Start with point after all type specifiers.
|
||||||
|
(list 'goto-char (list 'or
|
||||||
|
(list 'match-beginning
|
||||||
|
(+ ,shaderlab-type-names-depth 2))
|
||||||
|
'(match-end 1)))
|
||||||
|
;; Finish with point after first type specifier.
|
||||||
|
'(goto-char (match-end 1))
|
||||||
|
;; Fontify as a variable or function name.
|
||||||
|
'(1 (if (match-beginning 2)
|
||||||
|
font-lock-function-name-face
|
||||||
|
font-lock-variable-name-face)))))
|
||||||
|
;;
|
||||||
|
;; Fontify all storage specs and types, plus their items.
|
||||||
|
`(eval .
|
||||||
|
(list (concat "\\<\\(" ,shaderlab-type-specs "\\)\\>"
|
||||||
|
"[ \t]*\\(\\sw+\\)?")
|
||||||
|
(list 1 'font-lock-keyword-face)
|
||||||
|
(list ,(+ shaderlab-type-specs-depth 2) 'font-lock-type-face nil t)
|
||||||
|
(list 'font-lock-match-c-style-declaration-item-and-skip-to-next
|
||||||
|
nil
|
||||||
|
;; Finish with point after the variable name if
|
||||||
|
;; there is one.
|
||||||
|
`(if (match-end 2)
|
||||||
|
(goto-char (match-end 2)))
|
||||||
|
;; Fontify as a variable or function name.
|
||||||
|
'(1 (if (match-beginning 2)
|
||||||
|
font-lock-function-name-face
|
||||||
|
font-lock-variable-name-face) nil t))))
|
||||||
|
;;
|
||||||
|
;; Fontify structures, or typedef names, plus their items.
|
||||||
|
'("\\(}\\)[ \t*]*\\sw"
|
||||||
|
(font-lock-match-c-style-declaration-item-and-skip-to-next
|
||||||
|
(goto-char (match-end 1)) nil
|
||||||
|
(1 font-lock-type-face)))
|
||||||
|
;;
|
||||||
|
;; Fontify anything at beginning of line as a declaration or definition.
|
||||||
|
'("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*"
|
||||||
|
(1 font-lock-type-face)
|
||||||
|
(font-lock-match-c-style-declaration-item-and-skip-to-next
|
||||||
|
(goto-char (or (match-beginning 2) (match-end 1))) nil
|
||||||
|
(1 (if (match-beginning 2)
|
||||||
|
font-lock-function-name-face
|
||||||
|
font-lock-variable-name-face))))
|
||||||
|
)))
|
||||||
|
)
|
||||||
|
|
||||||
|
(defvar shaderlab-font-lock-keywords shaderlab-font-lock-keywords-3
|
||||||
|
"Default expressions to highlight in C mode.
|
||||||
|
See also `shaderlab-font-lock-extra-types'.")
|
||||||
|
|
||||||
|
(defvar shaderlab-mode-hook nil)
|
||||||
|
(defvar shaderlab-mode-map
|
||||||
|
(let ((shaderlab-mode-map (make-keymap)))
|
||||||
|
(define-key shaderlab-mode-map "\C-j" 'newline-and-indent)
|
||||||
|
shaderlab-mode-map)
|
||||||
|
"Keymap for SHADERLAB major mode")
|
||||||
|
|
||||||
|
(define-derived-mode shaderlab-mode text-mode "Shaderlab"
|
||||||
|
"Major mode for editing shaderlab shaders.
|
||||||
|
\\{shaderlab-mode-map}"
|
||||||
|
(set-syntax-table shaderlab-mode-syntax-table2)
|
||||||
|
(set (make-local-variable 'font-lock-defaults) '(shaderlab-font-lock-keywords))
|
||||||
|
;; Register our indentation function
|
||||||
|
(set (make-local-variable 'indent-line-function) 'shaderlab-indent-line)
|
||||||
|
)
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.shader" . shaderlab-mode))
|
||||||
|
|
||||||
|
(defun shaderlab-indent-line ()
|
||||||
|
"Indent current line as SHADERLAB code."
|
||||||
|
(interactive)
|
||||||
|
(beginning-of-line)
|
||||||
|
(let ((regexp-closing-brace "^[^ \\W\n]*};?\\w*")
|
||||||
|
(regexp-opening-brace "^.*{\\w*$")
|
||||||
|
(regexp-empty-line "^[\t ]*\n"))
|
||||||
|
|
||||||
|
(let ((not-indented t) cur-indent)
|
||||||
|
(cond ((bobp)
|
||||||
|
;(message "bobp")
|
||||||
|
(setq cur-indent 0))
|
||||||
|
((looking-at regexp-closing-brace) ; If the line we are looking at is the end of a block, then decrease the indentation
|
||||||
|
;(message "Closing brace")
|
||||||
|
(save-excursion
|
||||||
|
;Look backwards for a non-whitespace block or an opening brace
|
||||||
|
(let ((looking-for-line t))
|
||||||
|
(while looking-for-line
|
||||||
|
(forward-line -1)
|
||||||
|
(cond ((looking-at regexp-opening-brace)
|
||||||
|
(setq cur-indent (current-indentation))
|
||||||
|
(setq looking-for-line nil))
|
||||||
|
((not (looking-at regexp-empty-line))
|
||||||
|
(setq cur-indent (- (current-indentation) default-tab-width))
|
||||||
|
(setq looking-for-line nil))))))
|
||||||
|
|
||||||
|
(when (< cur-indent 0) ; We can't indent past the left margin
|
||||||
|
(setq cur-indent 0)))
|
||||||
|
((looking-at "^\\W*#")
|
||||||
|
(message "preprocessor")
|
||||||
|
(setq cur-indent 0))
|
||||||
|
(t (save-excursion
|
||||||
|
(while not-indented ; Iterate backwards until we find an indentation hint
|
||||||
|
(forward-line -1)
|
||||||
|
(cond ((looking-at regexp-closing-brace) ; This hint indicates that we need to indent at the level of the END_ token
|
||||||
|
;(message "Found closing brace at %s" (what-line))
|
||||||
|
(setq cur-indent (current-indentation))
|
||||||
|
(setq not-indented nil))
|
||||||
|
((looking-at regexp-opening-brace) ; This hint indicates that we need to indent an extra level
|
||||||
|
;(message "Found opening brace at %s" (what-line))
|
||||||
|
(setq cur-indent (+ (current-indentation) default-tab-width)) ; Do the actual indenting
|
||||||
|
(setq not-indented nil))
|
||||||
|
((bobp)
|
||||||
|
(setq not-indented nil)))))))
|
||||||
|
(if cur-indent
|
||||||
|
(progn
|
||||||
|
;(message "Indenting to %d" cur-indent)
|
||||||
|
(indent-line-to cur-indent))
|
||||||
|
;(message "not indenting!")
|
||||||
|
(indent-line-to 0))))) ; If we didn't see an indentation hint, then allow no indentation
|
||||||
|
|
||||||
|
|
||||||
|
(defvar shaderlab-mode-syntax-table
|
||||||
|
(let ((table (make-syntax-table)))
|
||||||
|
|
||||||
|
;; Populate the syntax TABLE
|
||||||
|
(modify-syntax-entry ?_ "_" table)
|
||||||
|
;(modify-syntax-entry ?_ "w" table)
|
||||||
|
(modify-syntax-entry ?\\ "\\" table)
|
||||||
|
(modify-syntax-entry ?+ "." table)
|
||||||
|
(modify-syntax-entry ?- "." table)
|
||||||
|
(modify-syntax-entry ?= "." table)
|
||||||
|
(modify-syntax-entry ?% "." table)
|
||||||
|
(modify-syntax-entry ?< "." table)
|
||||||
|
(modify-syntax-entry ?> "." table)
|
||||||
|
(modify-syntax-entry ?& "." table)
|
||||||
|
(modify-syntax-entry ?| "." table)
|
||||||
|
(modify-syntax-entry ?\' "\"" table)
|
||||||
|
;; Set up block and line oriented comments. The new C standard
|
||||||
|
;; mandates both comment styles even in C, so since all languages
|
||||||
|
;; now require dual comments, we make this the default.
|
||||||
|
;;(cond
|
||||||
|
;; Emacs 22 and higher do nothing
|
||||||
|
;; ((>= emacs-major-version 22))
|
||||||
|
;; XEmacs 19 & 20
|
||||||
|
;; ((memq '8-bit c-emacs-features)
|
||||||
|
;; (modify-syntax-entry ?/ ". 1456" table)
|
||||||
|
;; (modify-syntax-entry ?* ". 23" table))
|
||||||
|
;; Emacs 19 & 20
|
||||||
|
;; ((memq '1-bit c-emacs-features)
|
||||||
|
;; (modify-syntax-entry ?/ ". 124b" table)
|
||||||
|
;; (modify-syntax-entry ?* ". 23" table))
|
||||||
|
;; incompatible
|
||||||
|
;; (t (error "Shaderlab Mode is incompatible with this version of Emacs"))
|
||||||
|
;; )
|
||||||
|
(modify-syntax-entry ?\n "> b" table)
|
||||||
|
;; Give CR the same syntax as newline, for selective-display
|
||||||
|
(modify-syntax-entry ?\^m "> b" table)
|
||||||
|
table)
|
||||||
|
"Syntax table for shaderlab-mode")
|
||||||
|
|
||||||
|
(provide 'shaderlab-mode)
|
||||||
|
|
||||||
|
(defun shaderlab-populate-syntax-table (table)
|
||||||
|
"Populate the given syntax table as necessary for a C-like language.
|
||||||
|
This includes setting ' and \" as string delimiters, and setting up
|
||||||
|
the comment syntax to handle both line style \"//\" and block style
|
||||||
|
\"/*\" \"*/\" comments."
|
||||||
|
|
||||||
|
(modify-syntax-entry ?_ "w" table)
|
||||||
|
;(modify-syntax-entry ?_ "_" table)
|
||||||
|
(modify-syntax-entry ?\\ "\\" table)
|
||||||
|
(modify-syntax-entry ?+ "." table)
|
||||||
|
(modify-syntax-entry ?- "." table)
|
||||||
|
(modify-syntax-entry ?= "." table)
|
||||||
|
(modify-syntax-entry ?% "." table)
|
||||||
|
(modify-syntax-entry ?< "." table)
|
||||||
|
(modify-syntax-entry ?> "." table)
|
||||||
|
(modify-syntax-entry ?& "." table)
|
||||||
|
(modify-syntax-entry ?| "." table)
|
||||||
|
(modify-syntax-entry ?\' "\"" table)
|
||||||
|
(modify-syntax-entry ?\240 "." table)
|
||||||
|
|
||||||
|
;; Set up block and line oriented comments. The new C
|
||||||
|
;; standard mandates both comment styles even in C, so since
|
||||||
|
;; all languages now require dual comments, we make this the
|
||||||
|
;; default.
|
||||||
|
(modify-syntax-entry ?/ ". 124b" table)
|
||||||
|
(modify-syntax-entry ?* ". 23" table)
|
||||||
|
|
||||||
|
(modify-syntax-entry ?\n "> b" table)
|
||||||
|
;; Give CR the same syntax as newline, for selective-display
|
||||||
|
(modify-syntax-entry ?\^m "> b" table)
|
||||||
|
table)
|
||||||
|
|
||||||
|
|
||||||
|
(defvar shaderlab-mode-syntax-table2
|
||||||
|
(let ((shaderlab-mode-syntax-table2 (shaderlab-populate-syntax-table (make-syntax-table))))
|
||||||
|
shaderlab-mode-syntax-table2)
|
||||||
|
"Syntax table for shaderlab-mode")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; shaderlab-mode.el ends here
|
25
init.el
25
init.el
|
@ -9,29 +9,30 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(cd "~") ; Default directory, instead of /
|
(cd "~") ; Default directory, instead of /
|
||||||
(setq skip-installs nil) ; Don't check packages (for slightly speedier startup)
|
|
||||||
;; (setq use-package-verbose t)
|
;; (setq use-package-verbose t)
|
||||||
|
|
||||||
(server-mode t)
|
(server-mode t)
|
||||||
(unless (server-running-p) (server-start))
|
(unless (server-running-p) (server-start))
|
||||||
(desktop-save-mode t)
|
(when window-system (desktop-save-mode 1))
|
||||||
|
|
||||||
;; Global vars
|
;; Global vars
|
||||||
(defvar my/dir (file-name-directory load-file-name))
|
(defconst my/dir (file-name-directory load-file-name))
|
||||||
(defvar my/init-dir (expand-file-name "init" my/dir))
|
(defconst my/init-dir (expand-file-name "init" my/dir))
|
||||||
(defvar my/themes-dir (expand-file-name "themes" my/dir))
|
(defconst my/themes-dir (expand-file-name "themes" my/dir))
|
||||||
(defvar my/elisp-dir (expand-file-name "elisp" my/dir))
|
(defconst my/elisp-dir (expand-file-name "elisp" my/dir))
|
||||||
(defvar my/tmp-dir (expand-file-name "tmp" my/dir))
|
(defconst my/tmp-dir (expand-file-name "tmp" my/dir))
|
||||||
(defvar my/snippets-dir (expand-file-name "snippets" my/dir))
|
(defconst my/snippets-dir (expand-file-name "snippets" my/dir))
|
||||||
|
|
||||||
(defvar my/theme 'brin)
|
(defconst my/theme 'brin)
|
||||||
(defvar my/font "Inconsolata-14")
|
(defconst my/font "Inconsolata-14")
|
||||||
|
|
||||||
(add-to-list 'load-path my/init-dir)
|
(add-to-list 'load-path my/init-dir)
|
||||||
|
|
||||||
(mapc 'require
|
(mapc 'require
|
||||||
'(core ; Just the... bear necessities...
|
'(core ; Just the... bear necessities...
|
||||||
|
|
||||||
|
my-defuns
|
||||||
|
|
||||||
;; Modules to improve on emacs' heresy
|
;; Modules to improve on emacs' heresy
|
||||||
init-project ; Project navigation tools & settings
|
init-project ; Project navigation tools & settings
|
||||||
init-ac ; Auto-complete engine & settings
|
init-ac ; Auto-complete engine & settings
|
||||||
|
@ -45,6 +46,6 @@
|
||||||
mod-webdev ; Environment for webdev (SCSS, PHP, Rails, Jekyll)
|
mod-webdev ; Environment for webdev (SCSS, PHP, Rails, Jekyll)
|
||||||
mod-love ; Love.app gamedev
|
mod-love ; Love.app gamedev
|
||||||
mod-cpp ; C++ gamedev
|
mod-cpp ; C++ gamedev
|
||||||
;; mod-eclim ; Integration into eclipse (for Java)
|
mod-eclim ; Integration into eclipse (for Java)
|
||||||
;; mod-csharp ; Emacs as a Csharp IDE
|
mod-csharp ; Emacs as a Csharp/Unity IDE
|
||||||
))
|
))
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
(mapc 'my/install-package
|
;; (mapc 'my/install-package
|
||||||
'(evil
|
;; '(evil
|
||||||
evil-leader
|
;; evil-leader
|
||||||
evil-nerd-commenter ; auto commenting made easy
|
;; evil-nerd-commenter ; auto commenting made easy
|
||||||
evil-matchit ; jumping between block delimiters
|
;; evil-matchit ; jumping between block delimiters
|
||||||
evil-surround ; surround-with delimiters
|
;; evil-surround ; surround-with delimiters
|
||||||
evil-numbers ; increment/decrement numbers
|
;; evil-numbers ; increment/decrement numbers
|
||||||
evil-exchange ; exchanging two text objects (gx/gX)
|
;; evil-exchange ; exchanging two text objects (gx/gX)
|
||||||
evil-space ; mimics ; and , for f, F, t, T w/ space
|
;; evil-space ; mimics ; and , for f, F, t, T w/ space
|
||||||
evil-visualstar ; visual-based * and #
|
;; evil-visualstar ; visual-based * and #
|
||||||
autopair ; delimiter auto-closing
|
;; autopair ; delimiter auto-closing
|
||||||
rainbow-delimiters ; colored matching parenthesis
|
;; rainbow-delimiters ; colored matching parenthesis
|
||||||
saveplace ; restore cursor position on buffer load
|
;; saveplace ; restore cursor position on buffer load
|
||||||
anzu ; display current + total matches searching
|
;; anzu ; display current + total matches searching
|
||||||
smex ; less M-x cruft
|
;; smex ; less M-x cruft
|
||||||
recentf ; access to list of recent files
|
;; recentf ; access to list of recent files
|
||||||
key-chord ; for mapping key chords in insert mode
|
;; key-chord ; for mapping key chords in insert mode
|
||||||
multiple-cursors ; cursors, of the numerous variety
|
;; multiple-cursors ; cursors, of the numerous variety
|
||||||
ediff
|
;; ediff
|
||||||
))
|
;; deferred
|
||||||
|
;; ))
|
||||||
|
|
||||||
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
@ -38,7 +39,10 @@
|
||||||
|
|
||||||
;;;; Plugins ;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;; Plugins ;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(use-package evil
|
(use-package deferred :ensure t :defer t)
|
||||||
|
(use-package ediff :ensure t :defer t)
|
||||||
|
|
||||||
|
(use-package evil :ensure t
|
||||||
:diminish undo-tree-mode
|
:diminish undo-tree-mode
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
@ -47,20 +51,21 @@
|
||||||
|
|
||||||
(evil-mode 1)
|
(evil-mode 1)
|
||||||
|
|
||||||
(use-package evil-leader)
|
(use-package evil-leader :ensure t)
|
||||||
(use-package evil-nerd-commenter)
|
(use-package evil-nerd-commenter :ensure t)
|
||||||
(use-package evil-matchit)
|
(use-package evil-matchit :ensure t)
|
||||||
(use-package evil-surround)
|
(use-package evil-surround :ensure t)
|
||||||
(use-package evil-numbers)
|
(use-package evil-numbers :ensure t)
|
||||||
(use-package evil-exchange)
|
(use-package evil-exchange :ensure t)
|
||||||
(use-package evil-space)
|
(use-package evil-space :ensure t)
|
||||||
(use-package evil-visualstar)
|
(use-package evil-visualstar :ensure t)
|
||||||
(use-package evil-ex-registers)
|
(use-package evil-ex-registers)
|
||||||
|
|
||||||
;; To get evil-leader mappings to work in the messages buffer...
|
;; To get evil-leader mappings to work in the messages buffer...
|
||||||
(kill-buffer "*Messages*")
|
(kill-buffer "*Messages*")
|
||||||
|
|
||||||
(setq evil-leader/in-all-states t)
|
(setq evil-leader/in-all-states t)
|
||||||
|
|
||||||
(global-evil-leader-mode 1)
|
(global-evil-leader-mode 1)
|
||||||
(global-evil-matchit-mode 1)
|
(global-evil-matchit-mode 1)
|
||||||
(global-evil-surround-mode 1)
|
(global-evil-surround-mode 1)
|
||||||
|
@ -79,8 +84,8 @@
|
||||||
;; Enable registers in ex-mode
|
;; Enable registers in ex-mode
|
||||||
(define-key evil-ex-completion-map (kbd "C-r") #'evil-ex-paste-from-register)))
|
(define-key evil-ex-completion-map (kbd "C-r") #'evil-ex-paste-from-register)))
|
||||||
|
|
||||||
(use-package rainbow-mode :defer t)
|
(use-package rainbow-mode :ensure t :defer t)
|
||||||
(use-package rainbow-delimiters
|
(use-package rainbow-delimiters :ensure t
|
||||||
:commands rainbow-delimiters-mode
|
:commands rainbow-delimiters-mode
|
||||||
:init
|
:init
|
||||||
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
|
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
|
||||||
|
@ -90,7 +95,7 @@
|
||||||
|
|
||||||
;;;; Init plugins ;;;;;;;;;;;;;;;;;;;
|
;;;; Init plugins ;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(use-package autopair
|
(use-package autopair :ensure t
|
||||||
:diminish autopair-mode
|
:diminish autopair-mode
|
||||||
:init
|
:init
|
||||||
(progn (autopair-global-mode)
|
(progn (autopair-global-mode)
|
||||||
|
@ -98,16 +103,16 @@
|
||||||
;; disable blink-matching-paren
|
;; disable blink-matching-paren
|
||||||
(setq blink-matching-paren nil)))
|
(setq blink-matching-paren nil)))
|
||||||
|
|
||||||
(use-package anzu
|
(use-package anzu :ensure t
|
||||||
:diminish anzu-mode
|
:diminish anzu-mode
|
||||||
:init (global-anzu-mode))
|
:init (global-anzu-mode))
|
||||||
|
|
||||||
(use-package key-chord
|
(use-package key-chord :ensure t
|
||||||
:init
|
:init
|
||||||
(progn (key-chord-mode 1)
|
(progn (key-chord-mode 1)
|
||||||
(setq key-chord-two-keys-delay 0.5)))
|
(setq key-chord-two-keys-delay 0.5)))
|
||||||
|
|
||||||
(use-package saveplace
|
(use-package saveplace :ensure t
|
||||||
:idle
|
:idle
|
||||||
(progn (setq-default save-place t)
|
(progn (setq-default save-place t)
|
||||||
(setq save-place-file (expand-file-name "saveplace" my/tmp-dir))))
|
(setq save-place-file (expand-file-name "saveplace" my/tmp-dir))))
|
||||||
|
@ -123,7 +128,7 @@
|
||||||
savehist-file (expand-file-name "savehist" my/tmp-dir))
|
savehist-file (expand-file-name "savehist" my/tmp-dir))
|
||||||
(savehist-mode 1)))
|
(savehist-mode 1)))
|
||||||
|
|
||||||
(use-package multiple-cursors
|
(use-package multiple-cursors :ensure t
|
||||||
:commands (mc/mark-next-like-this mc/mark-previous-like-this mc/mark-all-like-this)
|
:commands (mc/mark-next-like-this mc/mark-previous-like-this mc/mark-all-like-this)
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
@ -132,7 +137,7 @@
|
||||||
(defadvice keyboard-quit (around mc-and-keyboard-quit activate)
|
(defadvice keyboard-quit (around mc-and-keyboard-quit activate)
|
||||||
(mc/keyboard-quit) ad-do-it)))
|
(mc/keyboard-quit) ad-do-it)))
|
||||||
|
|
||||||
(use-package smex
|
(use-package smex :ensure t
|
||||||
:bind (("M-x" . smex)
|
:bind (("M-x" . smex)
|
||||||
("M-X" . smex-major-mode-commands))
|
("M-X" . smex-major-mode-commands))
|
||||||
:config
|
:config
|
||||||
|
@ -142,7 +147,8 @@
|
||||||
(when (boundp 'smex-cache) (smex-update)))
|
(when (boundp 'smex-cache) (smex-update)))
|
||||||
(add-hook 'after-load-functions 'smex-update-after-load)))
|
(add-hook 'after-load-functions 'smex-update-after-load)))
|
||||||
|
|
||||||
(use-package recentf
|
(use-package recentf :ensure t
|
||||||
|
:commands recentf-mode
|
||||||
:idle
|
:idle
|
||||||
(progn (recentf-mode 1)
|
(progn (recentf-mode 1)
|
||||||
(add-to-list 'recentf-exclude "\\.ido\\.last\\'")
|
(add-to-list 'recentf-exclude "\\.ido\\.last\\'")
|
||||||
|
|
|
@ -4,28 +4,13 @@
|
||||||
(global-set-key (kbd "C-c C-p") 'package-list-packages)
|
(global-set-key (kbd "C-c C-p") 'package-list-packages)
|
||||||
|
|
||||||
(when is-mac
|
(when is-mac
|
||||||
;; Send current file to OSX apps
|
|
||||||
(defun open-file-with (path &optional appName)
|
|
||||||
(if (not (string= "" appName))
|
|
||||||
(setq appName (concat "-a " appName ".app")))
|
|
||||||
(shell-command (concat "open " appName " " path)))
|
|
||||||
|
|
||||||
(defun open-with (appName)
|
|
||||||
(interactive)
|
|
||||||
(open-file-with (buffer-file-name) appName))
|
|
||||||
|
|
||||||
(defun send-to-transmit () (interactive) (open-with "Transmit"))
|
|
||||||
(defun send-to-launchbar () (interactive) (open-with "LaunchBar"))
|
|
||||||
(defun send-dir-to-launchbar () (interactive) (open-file-with default-directory "LaunchBar"))
|
|
||||||
(defun send-dir-to-finder () (interactive) (open-file-with default-directory "Finder"))
|
|
||||||
|
|
||||||
(nmap my/mode-map
|
(nmap my/mode-map
|
||||||
(kbd "C-c o") 'send-dir-to-finder
|
(kbd "C-c o") 'send-dir-to-finder
|
||||||
(kbd "C-c u") 'send-to-transmit
|
(kbd "C-c u") 'send-to-transmit
|
||||||
(kbd "C-c l") 'send-to-launchbar
|
(kbd "C-c l") 'send-to-launchbar
|
||||||
(kbd "C-c L") 'send-dir-to-launchbar
|
(kbd "C-c L") 'send-dir-to-launchbar
|
||||||
;; TODO: Open in tmux
|
;; TODO: Open in tmux
|
||||||
(kbd "C-c t") (lambda() (interactive) (shell))
|
;; (kbd "C-c t") (λ (shell))
|
||||||
)
|
)
|
||||||
|
|
||||||
;; Evaluating elisp
|
;; Evaluating elisp
|
||||||
|
@ -91,8 +76,8 @@
|
||||||
";" 'helm-imenu
|
";" 'helm-imenu
|
||||||
"," 'ido-switch-buffer
|
"," 'ido-switch-buffer
|
||||||
"=" 'align-regexp
|
"=" 'align-regexp
|
||||||
"x" 'kill-other-buffers
|
"x" 'my/kill-other-buffers
|
||||||
"X" 'kill-all-buffers
|
"X" 'my/kill-all-buffers
|
||||||
(kbd "RET") 'org-capture
|
(kbd "RET") 'org-capture
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -107,9 +92,7 @@
|
||||||
"X" 'evil-destroy ; Delete without yanking
|
"X" 'evil-destroy ; Delete without yanking
|
||||||
|
|
||||||
;; copy to end of line
|
;; copy to end of line
|
||||||
"Y" (lambda()
|
"Y" (λ (evil-yank (point) (point-at-eol)))
|
||||||
(interactive)
|
|
||||||
(evil-yank (point) (point-at-eol)))
|
|
||||||
|
|
||||||
"zz" 'kill-this-buffer ; Close buffer
|
"zz" 'kill-this-buffer ; Close buffer
|
||||||
"]b" 'previous-buffer
|
"]b" 'previous-buffer
|
||||||
|
@ -126,15 +109,11 @@
|
||||||
|
|
||||||
(vmap my/mode-map
|
(vmap my/mode-map
|
||||||
; vnoremap < <gv
|
; vnoremap < <gv
|
||||||
"<" (lambda ()
|
"<" (λ (evil-shift-left (region-beginning) (region-end))
|
||||||
(interactive)
|
|
||||||
(evil-shift-left (region-beginning) (region-end))
|
|
||||||
(evil-normal-state)
|
(evil-normal-state)
|
||||||
(evil-visual-restore))
|
(evil-visual-restore))
|
||||||
; vnoremap > >gv
|
; vnoremap > >gv
|
||||||
">" (lambda ()
|
">" (λ (evil-shift-right (region-beginning) (region-end))
|
||||||
(interactive)
|
|
||||||
(evil-shift-right (region-beginning) (region-end))
|
|
||||||
(evil-normal-state)
|
(evil-normal-state)
|
||||||
(evil-visual-restore))
|
(evil-visual-restore))
|
||||||
)
|
)
|
||||||
|
@ -161,10 +140,14 @@
|
||||||
|
|
||||||
;; Preserve buffer-movement in emacs mode
|
;; Preserve buffer-movement in emacs mode
|
||||||
(emap my/mode-map
|
(emap my/mode-map
|
||||||
|
"j" 'evil-next-line
|
||||||
|
"k" 'evil-previous-line
|
||||||
|
|
||||||
(kbd "C-w h") 'evil-window-left
|
(kbd "C-w h") 'evil-window-left
|
||||||
(kbd "C-w l") 'evil-window-right
|
(kbd "C-w l") 'evil-window-right
|
||||||
(kbd "C-w j") 'evil-window-down
|
(kbd "C-w j") 'evil-window-down
|
||||||
(kbd "C-w k") 'evil-window-up
|
(kbd "C-w k") 'evil-window-up
|
||||||
|
|
||||||
(kbd "s-j") "5j"
|
(kbd "s-j") "5j"
|
||||||
(kbd "s-k") "5k")
|
(kbd "s-k") "5k")
|
||||||
|
|
||||||
|
@ -230,15 +213,5 @@
|
||||||
(when (get-buffer "*Completions*") (delete-windows-on "*Completions*"))
|
(when (get-buffer "*Completions*") (delete-windows-on "*Completions*"))
|
||||||
(abort-recursive-edit)))
|
(abort-recursive-edit)))
|
||||||
|
|
||||||
(defun kill-other-buffers ()
|
|
||||||
(interactive)
|
|
||||||
(mapc 'kill-buffer (cdr (buffer-list (current-buffer))))
|
|
||||||
(message "All other buffers killed"))
|
|
||||||
|
|
||||||
(defun kill-all-buffers ()
|
|
||||||
(interactive)
|
|
||||||
(mapc 'kill-buffer (buffer-list))
|
|
||||||
(message "All buffers killed"))
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(provide 'core-keymaps)
|
(provide 'core-keymaps)
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
;; Don't open files from the workspace in a new frame
|
;; Don't open files from the workspace in a new frame
|
||||||
(setq ns-pop-up-frames nil)
|
(setq ns-pop-up-frames nil)
|
||||||
|
|
||||||
(my/install-package 'exec-path-from-shell) ; fix emacs PATH on OSX
|
;; fix emacs PATH on OSX
|
||||||
(use-package exec-path-from-shell
|
(use-package exec-path-from-shell :ensure t
|
||||||
:if window-system
|
:if window-system
|
||||||
:init (exec-path-from-shell-initialize))
|
:init (exec-path-from-shell-initialize))
|
||||||
|
|
||||||
|
|
|
@ -2,31 +2,36 @@
|
||||||
;; (require 'cl)
|
;; (require 'cl)
|
||||||
|
|
||||||
;; Package management bootstrap
|
;; Package management bootstrap
|
||||||
(setq package-user-dir (expand-file-name "vendor" my/dir))
|
(setq package-enable-at-startup nil
|
||||||
(setq package-enable-at-startup nil)
|
package-archives
|
||||||
(setq package-archives '(("melpa" . "http://melpa.milkbox.net/packages/")
|
'(("melpa" . "http://melpa.milkbox.net/packages/")
|
||||||
("org" . "http://orgmode.org/elpa/")
|
("org" . "http://orgmode.org/elpa/")
|
||||||
("marmalade" . "http://marmalade-repo.org/packages/")
|
("marmalade" . "http://marmalade-repo.org/packages/")
|
||||||
("gnu" . "http://elpa.gnu.org/packages/")))
|
("gnu" . "http://elpa.gnu.org/packages/"))
|
||||||
|
package-archive-exclude-alist
|
||||||
|
'(("melpa" org-trello)
|
||||||
|
("melpa" org)
|
||||||
|
("marmalade" org)
|
||||||
|
("gnu" org))
|
||||||
|
)
|
||||||
|
|
||||||
(let ((default-directory my/elisp-dir))
|
(let ((default-directory my/elisp-dir))
|
||||||
(normal-top-level-add-to-load-path '("."))
|
(normal-top-level-add-to-load-path '("."))
|
||||||
(normal-top-level-add-subdirs-to-load-path))
|
(normal-top-level-add-subdirs-to-load-path))
|
||||||
|
|
||||||
(package-initialize)
|
(eval-and-compile
|
||||||
|
(package-initialize)
|
||||||
|
(require 'use-package))
|
||||||
|
|
||||||
;; Check if a package is installed; if load is t, load it too.
|
;; Check if a package is installed; if load is t, load it too.
|
||||||
;; Works for packages bundled with emacs too!
|
;; Works for packages bundled with emacs too!
|
||||||
(defun my/install-package (package)
|
(defun my/install-package (package)
|
||||||
(unless skip-installs
|
|
||||||
(message "=> checking: %s" package)
|
(message "=> checking: %s" package)
|
||||||
(unless (package-installed-p package)
|
(unless (package-installed-p package)
|
||||||
(unless (assoc package package-archive-contents)
|
|
||||||
(package-refresh-contents))
|
|
||||||
(message "=> installing: %s" package)
|
(message "=> installing: %s" package)
|
||||||
(package-install package))))
|
(package-install package)))
|
||||||
|
|
||||||
(require 'use-package)
|
(use-package diminish :ensure t)
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(provide 'core-packages)
|
(provide 'core-packages)
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
(my/install-package 'diminish)
|
|
||||||
(global-linum-mode t) ; line numbers for everybody!
|
(global-linum-mode t) ; line numbers for everybody!
|
||||||
|
|
||||||
;; Sane scroll settings
|
|
||||||
(setq scroll-margin 3
|
|
||||||
scroll-conservatively 100000
|
|
||||||
scroll-preserve-screen-position 1)
|
|
||||||
|
|
||||||
;; Show line/col-no in mode-line
|
;; Show line/col-no in mode-line
|
||||||
(line-number-mode t)
|
(line-number-mode t)
|
||||||
(column-number-mode t)
|
(column-number-mode t)
|
||||||
|
|
97
init/core.el
97
init/core.el
|
@ -4,21 +4,37 @@
|
||||||
|
|
||||||
;; Emacs under-the-hood
|
;; Emacs under-the-hood
|
||||||
(prefer-coding-system 'utf-8)
|
(prefer-coding-system 'utf-8)
|
||||||
|
(global-auto-revert-mode 1) ; revert buffers for changed files
|
||||||
|
(setq-default load-prefer-newer t) ; load newer .el over older .elc
|
||||||
(setq redisplay-dont-pause t)
|
(setq redisplay-dont-pause t)
|
||||||
(setq-default gc-cons-threshold 50000000) ; avoid garbage collection (default is 400k)
|
(setq-default gc-cons-threshold 50000000) ; avoid garbage collection (default is 400k)
|
||||||
(setq make-backup-files nil ; Don't want any backup files
|
(setq make-backup-files nil ; Don't want any backup files
|
||||||
auto-save-list-file-name nil ; Don't want any .saves files
|
auto-save-list-file-name nil ; Don't want any .saves files
|
||||||
auto-save-default nil) ; Don't want any auto saving
|
auto-save-default nil) ; Don't want any auto saving
|
||||||
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||||
(setq inhibit-startup-screen t) ; don't show EMACs start screen
|
(setq confirm-kill-emacs nil)
|
||||||
|
|
||||||
;; If I ever enable bkacups/autosaves, then change where they go
|
;; Sane scroll settings
|
||||||
|
(setq scroll-margin 3
|
||||||
|
scroll-conservatively 100000
|
||||||
|
scroll-preserve-screen-position 1)
|
||||||
|
|
||||||
|
(setq inhibit-startup-screen t ; don't show EMACs start screen
|
||||||
|
inhibit-splash-screen t
|
||||||
|
inhibit-startup-buffer-menu t
|
||||||
|
inhibit-startup-echo-area-message t
|
||||||
|
initial-major-mode 'text-mode
|
||||||
|
initial-scratch-message nil)
|
||||||
|
|
||||||
|
(setq-default use-dialog-box nil)
|
||||||
|
(setq-default enable-recursive-minibuffers nil)
|
||||||
|
(setq-default visible-bell nil)
|
||||||
|
(setq sentence-end-double-space nil)
|
||||||
|
|
||||||
|
;; If I ever enable backups/autosaves, then change where they go
|
||||||
(setq backup-directory-alist `((".*" . ,my/tmp-dir)))
|
(setq backup-directory-alist `((".*" . ,my/tmp-dir)))
|
||||||
(setq auto-save-file-name-transforms `((".*" ,my/tmp-dir t)))
|
(setq auto-save-file-name-transforms `((".*" ,my/tmp-dir t)))
|
||||||
|
|
||||||
;; Always revert buffers if the files were changed
|
|
||||||
(global-auto-revert-mode 1)
|
|
||||||
|
|
||||||
;; window layout undo/redo, keymaps in core-keymaps.el
|
;; window layout undo/redo, keymaps in core-keymaps.el
|
||||||
(when (fboundp 'winner-mode) (winner-mode 1))
|
(when (fboundp 'winner-mode) (winner-mode 1))
|
||||||
|
|
||||||
|
@ -29,25 +45,7 @@
|
||||||
(eq system-type 'gnu/linux)
|
(eq system-type 'gnu/linux)
|
||||||
"Is this running on Linux?")
|
"Is this running on Linux?")
|
||||||
|
|
||||||
;;;; Macros ;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
;; Vimmish keymapping shortcuts
|
|
||||||
(defmacro nmap (map &rest body)
|
|
||||||
`(evil-define-key 'normal ,map ,@body))
|
|
||||||
(defmacro vmap (map &rest body)
|
|
||||||
`(evil-define-key 'visual ,map ,@body))
|
|
||||||
(defmacro imap (map &rest body)
|
|
||||||
`(evil-define-key 'insert ,map ,@body))
|
|
||||||
(defmacro emap (map &rest body)
|
|
||||||
`(evil-define-key 'emacs ,map ,@body))
|
|
||||||
|
|
||||||
;; insert-mode key-chord mapping
|
|
||||||
(defmacro ichmap (key command)
|
|
||||||
`(key-chord-define evil-insert-state-map ,key ,command))
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Advice ;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;; Advice ;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; Make next/previous-buffer skip special buffers
|
;; Make next/previous-buffer skip special buffers
|
||||||
(defadvice next-buffer (after avoid-messages-buffer-in-next-buffer)
|
(defadvice next-buffer (after avoid-messages-buffer-in-next-buffer)
|
||||||
"Advice around `next-buffer' to avoid going into the *Messages* buffer."
|
"Advice around `next-buffer' to avoid going into the *Messages* buffer."
|
||||||
|
@ -58,65 +56,16 @@
|
||||||
(when (string= "*Messages*" (buffer-name))
|
(when (string= "*Messages*" (buffer-name))
|
||||||
(previous-buffer)))
|
(previous-buffer)))
|
||||||
|
|
||||||
;; Prevent prompts when trying to close window. If I'm closing the window,
|
|
||||||
;; I likely want it to close!
|
|
||||||
(when window-system
|
|
||||||
(defadvice save-buffers-kill-emacs (around no-y-or-n activate)
|
|
||||||
(flet ((yes-or-no-p (&rest args) t)
|
|
||||||
(y-or-n-p (&rest args) t))
|
|
||||||
ad-do-it)))
|
|
||||||
|
|
||||||
;; Prevent GUI dialog boxes, they make emacs hang
|
|
||||||
(defadvice yes-or-no-p (around prevent-dialog activate)
|
|
||||||
(let ((use-dialog-box nil)) ad-do-it))
|
|
||||||
(defadvice y-or-n-p (around prevent-dialog-yorn activate)
|
|
||||||
(let ((use-dialog-box nil)) ad-do-it))
|
|
||||||
|
|
||||||
|
|
||||||
;;;; My personal minor mode ;;;;;;;;
|
;;;; My personal minor mode ;;;;;;;;
|
||||||
|
|
||||||
(defvar my/mode-map (make-sparse-keymap))
|
(defvar my/mode-map (make-sparse-keymap))
|
||||||
(define-minor-mode my/mode :keymap my/mode-map :global t)
|
(define-minor-mode my/mode :keymap my/mode-map :global t)
|
||||||
|
|
||||||
|
|
||||||
;;;; Commands ;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
;; File navigation defuns
|
|
||||||
(defun my/initfiles ()
|
|
||||||
(interactive)
|
|
||||||
(ido-find-file-in-dir my/dir))
|
|
||||||
|
|
||||||
(defun my/open-scratch ()
|
|
||||||
(interactive)
|
|
||||||
(switch-to-buffer (get-buffer-create "*scratch*"))
|
|
||||||
(text-mode))
|
|
||||||
|
|
||||||
(defun my/expand-space ()
|
|
||||||
(interactive)
|
|
||||||
(save-excursion (insert " ")))
|
|
||||||
|
|
||||||
(defun my/expand-backspace ()
|
|
||||||
(interactive)
|
|
||||||
(save-excursion (delete-char 1))
|
|
||||||
(delete-backward-char 1))
|
|
||||||
|
|
||||||
(defun my/enable-hard-wrap()
|
|
||||||
(interactive)
|
|
||||||
(auto-fill-mode 1))
|
|
||||||
|
|
||||||
(defun my/byte-recompile ()
|
|
||||||
(interactive)
|
|
||||||
(byte-recompile-file (expand-file-name "init.el" my/dir))
|
|
||||||
(byte-recompile-directory my/init-dir 0)
|
|
||||||
(byte-recompile-directory my/elisp-dir 0))
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Load the rest ;;;;;;;;;;;;;;;;;;
|
;;;; Load the rest ;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(require 'core-packages)
|
(require 'core-packages)
|
||||||
(require 'core-ui)
|
(require 'core-ui)
|
||||||
(require 'core-editor)
|
(require 'core-editor)
|
||||||
(use-package core-osx :if is-mac)
|
(when is-mac (require 'core-osx))
|
||||||
|
|
||||||
(add-hook 'after-init-hook (lambda() (require 'core-keymaps)))
|
(add-hook 'after-init-hook (lambda() (require 'core-keymaps)))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -1,36 +1,32 @@
|
||||||
(my/install-package 'auto-complete)
|
(use-package auto-complete :ensure t
|
||||||
|
|
||||||
(defun my/ac-path-completion-enable()
|
|
||||||
(add-to-list 'ac-sources 'ac-source-filename)
|
|
||||||
(add-to-list 'ac-sources 'ac-source-files-in-current-dir))
|
|
||||||
|
|
||||||
(use-package auto-complete
|
|
||||||
:diminish auto-complete-mode
|
:diminish auto-complete-mode
|
||||||
:init
|
:init
|
||||||
(progn (require 'auto-complete-config)
|
(progn
|
||||||
|
(require 'auto-complete-config)
|
||||||
|
|
||||||
;; Use more vim-like keymappings
|
|
||||||
(add-hook 'change-major-mode-hook
|
|
||||||
(lambda () (imap ac-mode-map (kbd "C-SPC") 'auto-complete)))
|
|
||||||
|
|
||||||
;; (setq ac-auto-start 2)
|
|
||||||
;; (setq ac-auto-show-menu nil ; Suggestions box must be invoked manually (see core-keymaps.el)
|
|
||||||
;; ac-use-menu-map t ; Enable ac-menu-map map when menu is open
|
|
||||||
;; ac-us-quick-help nil ; Don't show tooltips unless invoked (see core-keymaps.el)
|
|
||||||
;; ac-fuzzy-cursor-color nil)
|
|
||||||
|
|
||||||
;; Keep auto-complete quiet until it's needed
|
|
||||||
(setq ac-auto-start nil)
|
(setq ac-auto-start nil)
|
||||||
|
(setq ac-auto-show-menu t ; Suggestions box must be invoked manually (see core-keymaps.el)
|
||||||
|
ac-use-menu-map t ; Enable ac-menu-map map when menu is open
|
||||||
|
ac-use-quick-help nil ; Don't show tooltips unless invoked (see core-keymaps.el)
|
||||||
|
ac-use-fuzzy nil
|
||||||
|
ac-candidate-limit 25)
|
||||||
|
|
||||||
(ac-config-default)
|
(setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
|
||||||
(ac-linum-workaround) ; Fix line number flux bug
|
(add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
|
||||||
;; (ac-flyspell-workaround) ; Compatibility with flyspell/make
|
(add-hook 'css-mode-hook 'ac-css-mode-setup)
|
||||||
)
|
(add-hook 'shell-script-mode-hook 'my/ac-files-setup)
|
||||||
|
;; (add-hook 'auto-complete-mode-hook 'ac-common-setup)
|
||||||
|
(global-auto-complete-mode t)
|
||||||
|
|
||||||
|
;; Fix line number flux bug
|
||||||
|
(ac-linum-workaround))
|
||||||
:config
|
:config
|
||||||
(progn (add-to-list 'ac-dictionary-files "~/.emacs.d/ac-dict/global")
|
(progn
|
||||||
|
(add-to-list 'ac-dictionary-files "~/.emacs.d/ac-dict/global")
|
||||||
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
|
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
|
||||||
|
|
||||||
(imap ac-mode-map (kbd "C-S-SPC") 'auto-complete)
|
(imap ac-mode-map (kbd "C-SPC") 'auto-complete)
|
||||||
|
;; (imap ac-mode-map (kbd "C-S-SPC") 'auto-complete)
|
||||||
(define-key ac-completing-map (kbd "<tab>") 'ac-expand)
|
(define-key ac-completing-map (kbd "<tab>") 'ac-expand)
|
||||||
(define-key ac-completing-map (kbd "C-n") 'ac-next)
|
(define-key ac-completing-map (kbd "C-n") 'ac-next)
|
||||||
(define-key ac-completing-map (kbd "C-p") 'ac-previous)
|
(define-key ac-completing-map (kbd "C-p") 'ac-previous)
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
(mapc 'my/install-package '(flycheck flyspell))
|
(use-package flycheck :ensure t
|
||||||
|
|
||||||
(use-package flycheck
|
|
||||||
:commands global-flycheck-mode
|
:commands global-flycheck-mode
|
||||||
:diminish (flycheck-mode . " !")
|
:diminish (flycheck-mode . " !")
|
||||||
:init (add-hook 'after-init-hook #'global-flycheck-mode)
|
:init (add-hook 'after-init-hook #'global-flycheck-mode)
|
||||||
|
@ -11,7 +9,7 @@
|
||||||
(setq flycheck-indication-mode 'right-fringe)
|
(setq flycheck-indication-mode 'right-fringe)
|
||||||
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))))
|
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))))
|
||||||
|
|
||||||
(use-package flyspell
|
(use-package flyspell :ensure t
|
||||||
:commands flyspell-mode
|
:commands flyspell-mode
|
||||||
:diminish (flyspell-mode . " @")
|
:diminish (flyspell-mode . " @")
|
||||||
:config
|
:config
|
||||||
|
|
|
@ -1,33 +1,26 @@
|
||||||
(mapc 'my/install-package
|
(use-package git-commit-mode :ensure t
|
||||||
'(git-commit-mode
|
|
||||||
git-rebase-mode
|
|
||||||
gitconfig-mode
|
|
||||||
gitignore-mode
|
|
||||||
git-gutter-fringe))
|
|
||||||
|
|
||||||
(use-package git-commit-mode
|
|
||||||
:mode (("/COMMIT_EDITMSG\\'" . git-commit-mode)
|
:mode (("/COMMIT_EDITMSG\\'" . git-commit-mode)
|
||||||
("/NOTES_EDITMSG\\'" . git-commit-mode)
|
("/NOTES_EDITMSG\\'" . git-commit-mode)
|
||||||
("/MERGE_MSG\\'" . git-commit-mode)
|
("/MERGE_MSG\\'" . git-commit-mode)
|
||||||
("/TAG_EDITMSG\\'" . git-commit-mode)
|
("/TAG_EDITMSG\\'" . git-commit-mode)
|
||||||
("/PULLREQ_EDITMSG\\'" . git-commit-mode)))
|
("/PULLREQ_EDITMSG\\'" . git-commit-mode)))
|
||||||
|
|
||||||
(use-package git-rebase-mode
|
(use-package git-rebase-mode :ensure t
|
||||||
:mode ("/git-rebase-todo\\'" . git-rebase-mode))
|
:mode ("/git-rebase-todo\\'" . git-rebase-mode))
|
||||||
|
|
||||||
(use-package gitconfig-mode
|
(use-package gitconfig-mode :ensure t
|
||||||
:mode (("/\\.gitconfig\\'" . gitconfig-mode)
|
:mode (("/\\.gitconfig\\'" . gitconfig-mode)
|
||||||
("/\\.git/config\\'" . gitconfig-mode)
|
("/\\.git/config\\'" . gitconfig-mode)
|
||||||
("/git/config\\'" . gitconfig-mode)
|
("/git/config\\'" . gitconfig-mode)
|
||||||
("/\\.gitmodules\\'" . gitconfig-mode))
|
("/\\.gitmodules\\'" . gitconfig-mode))
|
||||||
:config (add-hook 'gitconfig-mode-hook 'flyspell-mode))
|
:config (add-hook 'gitconfig-mode-hook 'flyspell-mode))
|
||||||
|
|
||||||
(use-package gitignore-mode
|
(use-package gitignore-mode :ensure t
|
||||||
:mode (("/\\.gitignore\\'" . gitignore-mode)
|
:mode (("/\\.gitignore\\'" . gitignore-mode)
|
||||||
("/\\.git/info/exclude\\'" . gitignore-mode)
|
("/\\.git/info/exclude\\'" . gitignore-mode)
|
||||||
("/git/ignore\\'" . gitignore-mode)))
|
("/git/ignore\\'" . gitignore-mode)))
|
||||||
|
|
||||||
(use-package git-gutter-fringe
|
(use-package git-gutter-fringe :ensure t
|
||||||
:diminish git-gutter-mode
|
:diminish git-gutter-mode
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
|
|
|
@ -1,28 +1,20 @@
|
||||||
(mapc 'my/install-package
|
|
||||||
'(ido-ubiquitous ; enhances ido-everywhere
|
|
||||||
ido-vertical-mode ; vertical listing for ido completion
|
|
||||||
flx-ido ; enhances ido's flex matching
|
|
||||||
projectile ; project search (like ctrlp)
|
|
||||||
helm ; augments search of, well, anything
|
|
||||||
grizzl ; better searching engine for projectile
|
|
||||||
ag ; the_silver_searcher support
|
|
||||||
dired+
|
|
||||||
))
|
|
||||||
|
|
||||||
(setq dired-recursive-deletes 'always
|
(add-hook 'dired-load-hook
|
||||||
|
(lambda()
|
||||||
|
(use-package dired+ :ensure t :config
|
||||||
|
(setq dired-recursive-deletes 'always
|
||||||
dired-recursive-copies 'always
|
dired-recursive-copies 'always
|
||||||
|
|
||||||
;; if there is a dired buffer displayed in the next window, use its
|
;; if there is a dired buffer displayed in the next window, use its
|
||||||
;; current subdir, instead of the current subdir of this dired buffer
|
;; current subdir, instead of the current subdir of this dired buffer
|
||||||
dired-dwim-target t)
|
dired-dwim-target t))))
|
||||||
|
|
||||||
(add-hook 'dired-load-hook (lambda() (use-package dired+)))
|
(use-package ag :ensure t :defer t)
|
||||||
|
(use-package helm :ensure t :defer t)
|
||||||
(use-package ag :defer t)
|
(use-package grizzl :ensure t :defer t)
|
||||||
(use-package helm :defer t)
|
|
||||||
(use-package neotree :commands (neotree-show neotree-hide neotree-toggle))
|
(use-package neotree :commands (neotree-show neotree-hide neotree-toggle))
|
||||||
|
|
||||||
(use-package projectile
|
(use-package projectile :ensure t
|
||||||
:diminish projectile-mode
|
:diminish projectile-mode
|
||||||
:config
|
:config
|
||||||
(progn (projectile-global-mode)
|
(progn (projectile-global-mode)
|
||||||
|
@ -30,7 +22,7 @@
|
||||||
projectile-enable-caching t)))
|
projectile-enable-caching t)))
|
||||||
|
|
||||||
(use-package ido
|
(use-package ido
|
||||||
:init
|
:pre-load
|
||||||
(progn
|
(progn
|
||||||
;; ido remaps its keys every time it's invoked, this screws with
|
;; ido remaps its keys every time it's invoked, this screws with
|
||||||
;; custom mappings. So we've gotta neuter ido.
|
;; custom mappings. So we've gotta neuter ido.
|
||||||
|
@ -47,14 +39,14 @@
|
||||||
(set-keymap-parent ido-buffer-completion-map ido-common-completion-map))
|
(set-keymap-parent ido-buffer-completion-map ido-common-completion-map))
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(use-package ido-ubiquitous)
|
|
||||||
(use-package ido-vertical-mode)
|
|
||||||
|
|
||||||
(ido-mode 1)
|
(ido-mode 1)
|
||||||
(ido-vertical-mode 1)
|
|
||||||
|
(use-package ido-ubiquitous :ensure t)
|
||||||
|
(use-package ido-vertical-mode :ensure t :config (ido-vertical-mode 1))
|
||||||
|
|
||||||
(ido-everywhere 1)
|
(ido-everywhere 1)
|
||||||
|
|
||||||
(use-package flx-ido :init (flx-ido-mode 1))
|
(use-package flx-ido :ensure t :config (flx-ido-mode 1))
|
||||||
|
|
||||||
(add-to-list 'ido-ignore-files "\\`.DS_Store\\'")
|
(add-to-list 'ido-ignore-files "\\`.DS_Store\\'")
|
||||||
(setq ido-use-faces nil
|
(setq ido-use-faces nil
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
(my/install-package 'yasnippet)
|
(use-package yasnippet :ensure t
|
||||||
|
|
||||||
(use-package yasnippet
|
|
||||||
:diminish (yas-minor-mode . " $")
|
:diminish (yas-minor-mode . " $")
|
||||||
:mode (("emacs.+/snippets/" . snippet-mode))
|
:mode (("emacs.+/snippets/" . snippet-mode))
|
||||||
:pre-load (progn
|
:pre-load (progn
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
|
|
||||||
(mapc 'my/install-package '(auto-complete-clang auto-complete-c-headers))
|
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
||||||
|
|
||||||
(add-hook 'c-mode-common-hook
|
(add-hook 'c-mode-common-hook
|
||||||
(lambda()
|
(lambda()
|
||||||
(use-package auto-complete-clang)
|
(use-package auto-complete-clang :ensure t)
|
||||||
(use-package auto-complete-c-headers)
|
(use-package auto-complete-c-headers :ensure t)
|
||||||
|
|
||||||
(setq ac-sources '(ac-source-clang ac-source-c-headers ac-source-yasnippet))))
|
(setq ac-sources
|
||||||
|
'(ac-source-clang
|
||||||
|
ac-source-c-headers
|
||||||
|
ac-source-yasnippet
|
||||||
|
ac-source-words-in-same-mode-buffers
|
||||||
|
))))
|
||||||
|
|
||||||
;; TODO Better SFML & build settings
|
(use-package glsl-mode :ensure t
|
||||||
|
:mode (("\\.glsl\\'" . glsl-mode)
|
||||||
|
("\\.vert\\'" . glsl-mode)
|
||||||
|
("\\.frag\\'" . glsl-mode)
|
||||||
|
("\\.geom\\'" . glsl-mode)))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(provide 'mod-cpp)
|
(provide 'mod-cpp)
|
||||||
|
|
23
init/mod-csharp.el
Normal file
23
init/mod-csharp.el
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
;; TODO Make more Unity-friendly
|
||||||
|
|
||||||
|
(use-package omnisharp :ensure t :defer t
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
;; (setq flycheck-idle-change-delay 2)
|
||||||
|
(setq omnisharp-server-executable-path "/Users/hlissner/Omni/OmniSharpServer/OmniSharp/bin/Debug/OmniSharp.exe")))
|
||||||
|
|
||||||
|
(use-package shaderlab-mode :defer t
|
||||||
|
:mode "\\.shader")
|
||||||
|
|
||||||
|
(use-package csharp-mode :ensure t
|
||||||
|
:mode "\\.cs\\'"
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(diminish 'abbrev-mode)
|
||||||
|
(imap csharp-mode-map (kbd "C-SPC") 'omnisharp-auto-complete))
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(setq csharp-want-imenu nil)
|
||||||
|
(add-hook 'csharp-mode-hook (lambda() (omnisharp-mode t) (flycheck-mode t)))))
|
||||||
|
|
||||||
|
(provide 'mod-csharp)
|
|
@ -1,25 +1,14 @@
|
||||||
(mapc 'my/install-package
|
(use-package yaml-mode :ensure t :mode "\\.yaml\\'")
|
||||||
'(yaml-mode
|
(use-package json-mode :ensure t
|
||||||
jedi
|
|
||||||
python-mode
|
|
||||||
inf-ruby
|
|
||||||
ac-inf-ruby
|
|
||||||
rbenv
|
|
||||||
json-mode
|
|
||||||
))
|
|
||||||
|
|
||||||
(use-package yaml-mode :mode "\\.yaml\\'")
|
|
||||||
|
|
||||||
(use-package json-mode
|
|
||||||
:mode (("\\.json\\'" . json-mode)
|
:mode (("\\.json\\'" . json-mode)
|
||||||
("\\.jshintrc\\'" . json-mode)))
|
("\\.jshintrc\\'" . json-mode)))
|
||||||
|
|
||||||
(use-package python
|
(use-package python :ensure python-mode
|
||||||
:mode ("\\.py\\'" . python-mode)
|
:mode ("\\.py\\'" . python-mode)
|
||||||
:interpreter ("python" . python-mode)
|
:interpreter ("python" . python-mode)
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(use-package jedi
|
(use-package jedi :ensure t
|
||||||
:init
|
:init
|
||||||
(if (not (file-directory-p "~/.emacs.d/.python-environments/default/"))
|
(if (not (file-directory-p "~/.emacs.d/.python-environments/default/"))
|
||||||
(jedi:install-server)))
|
(jedi:install-server)))
|
||||||
|
@ -31,16 +20,7 @@
|
||||||
|
|
||||||
;; Don't remap backspace. Leave it to autopair, please.
|
;; Don't remap backspace. Leave it to autopair, please.
|
||||||
(define-key python-mode-map [backspace] nil)
|
(define-key python-mode-map [backspace] nil)
|
||||||
(nmap python-mode-map (kbd "s-r")
|
(my/setup-run-code python-mode-map "python"))
|
||||||
(lambda()
|
|
||||||
(interactive)
|
|
||||||
(shell-command-on-region (point-min) (point-max) "python")))
|
|
||||||
(vmap python-mode-map (kbd "s-r")
|
|
||||||
(lambda()
|
|
||||||
(interactive)
|
|
||||||
(shell-command-on-region (region-beginning) (region-end) "python")))
|
|
||||||
)
|
|
||||||
|
|
||||||
:init
|
:init
|
||||||
(add-hook 'python-mode-hook 'jedi:ac-setup)
|
(add-hook 'python-mode-hook 'jedi:ac-setup)
|
||||||
;; (evil-define-key 'insert ac-mode-map (kbd "C-SPC") 'jedi:complete)
|
;; (evil-define-key 'insert ac-mode-map (kbd "C-SPC") 'jedi:complete)
|
||||||
|
@ -53,21 +33,27 @@
|
||||||
:interpreter "ruby"
|
:interpreter "ruby"
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(require 'ruby-mode-indent-fix)
|
(my/setup-run-code ruby-mode-map "ruby")
|
||||||
(evil-set-initial-state 'inf-ruby-mode 'insert)
|
|
||||||
|
|
||||||
|
(require 'ruby-mode-indent-fix)
|
||||||
(setq ruby-indent-level 4)
|
(setq ruby-indent-level 4)
|
||||||
(setq ruby-deep-indent-paren nil)
|
(setq ruby-deep-indent-paren nil)
|
||||||
|
|
||||||
(use-package rbenv)
|
(setq rsense-home "/usr/local/Cellar/rsense/0.3/libexec")
|
||||||
(use-package inf-ruby
|
(when (file-directory-p rsense-home)
|
||||||
|
(add-to-list 'load-path (concat rsense-home "/etc"))
|
||||||
|
(require 'rsense)
|
||||||
|
(add-hook 'ruby-mode-hook 'my/ac-ruby-setup))
|
||||||
|
|
||||||
|
(use-package rbenv :ensure t)
|
||||||
|
(use-package inf-ruby :ensure t
|
||||||
|
:config
|
||||||
|
(evil-set-initial-state 'inf-ruby-mode 'insert)
|
||||||
:init
|
:init
|
||||||
(add-to-list 'ac-modes 'inf-ruby-mode))
|
(add-to-list 'ac-modes 'inf-ruby-mode))
|
||||||
(use-package ac-inf-ruby
|
(use-package ac-inf-ruby :ensure t
|
||||||
:init
|
:init
|
||||||
(add-hook 'inf-ruby-mode-hook 'ac-inf-ruby-enable)))
|
(add-hook 'inf-ruby-mode-hook 'ac-inf-ruby-enable))))
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(provide 'mod-dev)
|
(provide 'mod-dev)
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
|
(use-package eclim :ensure emacs-eclim
|
||||||
|
:commands (eclim-mode global-eclim-mode)
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(setq eclim-eclipse-dirs '("~/.opt/eclipse")
|
||||||
|
eclim-executable "~/.opt/eclipse/eclim")
|
||||||
|
(add-hook 'java-mode-hook 'eclim-mode))
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
;; (use-package eclim-ant)
|
||||||
|
;; (use-package eclim-maven)
|
||||||
|
(use-package eclim-problems)
|
||||||
|
(use-package eclim-project)
|
||||||
|
(use-package eclimd)
|
||||||
|
|
||||||
;; TODO Eclim stuff
|
(require 'ac-emacs-eclim-source)
|
||||||
|
(ac-emacs-eclim-java-setup)
|
||||||
|
|
||||||
|
(setq help-at-pt-display-when-idle t)
|
||||||
|
(setq help-at-pt-timer-delay 0.1)
|
||||||
|
(help-at-pt-set-timer)
|
||||||
|
))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(provide 'mod-eclim)
|
(provide 'mod-eclim)
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
|
(use-package lua-mode :ensure t
|
||||||
(mapc 'my/install-package '(lua-mode))
|
|
||||||
|
|
||||||
(use-package lua-mode
|
|
||||||
:mode "\\.lua\\'"
|
:mode "\\.lua\\'"
|
||||||
:interpreter "lua"
|
:interpreter "lua"
|
||||||
:init
|
:init
|
||||||
|
@ -14,7 +11,7 @@
|
||||||
:group lua)
|
:group lua)
|
||||||
|
|
||||||
(define-key love-mode-map (kbd "s-b")
|
(define-key love-mode-map (kbd "s-b")
|
||||||
(lambda() (interactive) (shell-command (concat "open -a love.app " default-directory))))
|
(λ (shell-command (concat "open -a love.app " default-directory))))
|
||||||
|
|
||||||
(add-hook 'lua-mode-hook
|
(add-hook 'lua-mode-hook
|
||||||
(lambda()
|
(lambda()
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
(mapc 'my/install-package '(org))
|
|
||||||
|
|
||||||
;; Ex-commands
|
;; Ex-commands
|
||||||
(evil-ex-define-cmd "gtd" 'open-gtd)
|
(evil-ex-define-cmd "gtd" 'open-gtd)
|
||||||
(evil-ex-define-cmd "notes" 'open-notes)
|
(evil-ex-define-cmd "notes" 'open-notes)
|
||||||
|
@ -18,18 +16,8 @@
|
||||||
(funcall fun)
|
(funcall fun)
|
||||||
(evil-append nil))
|
(evil-append nil))
|
||||||
|
|
||||||
(defun my/gtd()
|
|
||||||
"Load up my notes folder in dropbox"
|
|
||||||
(interactive)
|
|
||||||
(find-file "~/Dropbox/notes/gtd.org"))
|
|
||||||
|
|
||||||
(defun my/notes()
|
|
||||||
"Load up my notes folder in dropbox"
|
|
||||||
(interactive)
|
|
||||||
(ido-find-file-in-dir "~/Dropbox/notes"))
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(use-package org
|
(use-package org :ensure t
|
||||||
:mode ("\\.org\\'" . org-mode)
|
:mode ("\\.org\\'" . org-mode)
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
|
@ -48,7 +36,7 @@
|
||||||
(setq org-hide-leading-stars t)
|
(setq org-hide-leading-stars t)
|
||||||
(setq org-export-backends '(ascii html latex md))
|
(setq org-export-backends '(ascii html latex md))
|
||||||
(setq org-todo-keywords
|
(setq org-todo-keywords
|
||||||
'((sequence "TODO" "DOING" "VERIFY" "WAITING" "|" "DONE" "DELEGATED")))
|
'((sequence "TODO" "DOING" "VERIFY" "WAITING" "|" "DONE" "DELEGATED" "CANCELLED")))
|
||||||
|
|
||||||
(setq org-tag-alist '(("@work" . ?b)
|
(setq org-tag-alist '(("@work" . ?b)
|
||||||
("@home" . ?h)
|
("@home" . ?h)
|
||||||
|
@ -59,7 +47,7 @@
|
||||||
("@phone" . ?p)
|
("@phone" . ?p)
|
||||||
("@reading" . ?r)
|
("@reading" . ?r)
|
||||||
("@computer" . ?l)
|
("@computer" . ?l)
|
||||||
("quantified" . ?q)
|
("projects" . ?q)
|
||||||
("lowenergy" . ?0)
|
("lowenergy" . ?0)
|
||||||
("highenergy" . ?1)))
|
("highenergy" . ?1)))
|
||||||
|
|
||||||
|
@ -74,6 +62,20 @@
|
||||||
("e" "Excerpt" entry (file (concat org-directory "/excerpts.org")) "* %?")
|
("e" "Excerpt" entry (file (concat org-directory "/excerpts.org")) "* %?")
|
||||||
))
|
))
|
||||||
|
|
||||||
|
(setq org-agenda-custom-commands
|
||||||
|
'(("x" agenda)
|
||||||
|
("y" agenda*)
|
||||||
|
("w" todo "WAITING")
|
||||||
|
("W" todo-tree "WAITING")
|
||||||
|
("tp" tags "+Projects")
|
||||||
|
("tg" tags-todo "+gamedev")
|
||||||
|
("tw" tags-tree "+webdev")
|
||||||
|
("f" occur-tree "\\<FIXME\\>")
|
||||||
|
("h" . "HOME+Name tags searches") ; description for "h" prefix
|
||||||
|
("hl" tags "+home+Lisa")
|
||||||
|
("hp" tags "+home+Peter")
|
||||||
|
("hk" tags "+home+Kim")))
|
||||||
|
|
||||||
(define-minor-mode evil-org-mode
|
(define-minor-mode evil-org-mode
|
||||||
"Buffer local minor mode for evil-org"
|
"Buffer local minor mode for evil-org"
|
||||||
:init-value nil
|
:init-value nil
|
||||||
|
@ -82,6 +84,9 @@
|
||||||
:group 'evil-org)
|
:group 'evil-org)
|
||||||
|
|
||||||
;; Keymaps
|
;; Keymaps
|
||||||
|
;; (emap org-agenda-mode-map
|
||||||
|
;; ...)
|
||||||
|
|
||||||
(imap evil-org-mode-map
|
(imap evil-org-mode-map
|
||||||
(kbd "<s-return>") 'org-insert-heading-after-current)
|
(kbd "<s-return>") 'org-insert-heading-after-current)
|
||||||
|
|
||||||
|
@ -90,11 +95,14 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(nmap evil-org-mode-map
|
(nmap evil-org-mode-map
|
||||||
|
",l" 'org-insert-link
|
||||||
|
",s" 'org-schedule
|
||||||
",a" 'org-attach
|
",a" 'org-attach
|
||||||
",A" 'org-agenda
|
",A" 'org-agenda
|
||||||
",t" 'org-todo
|
",t" 'org-todo
|
||||||
",T" 'org-show-todo-tree
|
",T" 'org-show-todo-tree
|
||||||
",\\" 'org-match-sparse-tree
|
",\\" 'org-match-sparse-tree
|
||||||
|
",+" 'org-align-all-tags
|
||||||
"gh" 'outline-up-heading
|
"gh" 'outline-up-heading
|
||||||
"gj" (if (fboundp 'org-forward-same-level) ;to be backward compatible with older org version
|
"gj" (if (fboundp 'org-forward-same-level) ;to be backward compatible with older org version
|
||||||
'org-forward-same-level
|
'org-forward-same-level
|
||||||
|
@ -112,7 +120,9 @@
|
||||||
"<" 'org-metaleft
|
"<" 'org-metaleft
|
||||||
">" 'org-metaright
|
">" 'org-metaright
|
||||||
"-" 'org-cycle-list-bullet
|
"-" 'org-cycle-list-bullet
|
||||||
|
(kbd "RET") (lambda() (interactive) (org-insert-heading-after-current) (evil-insert-state))
|
||||||
(kbd "SPC") 'org-todo
|
(kbd "SPC") 'org-todo
|
||||||
|
(kbd "M-SPC") (lambda() (interactive) (org-todo "DONE"))
|
||||||
(kbd "TAB") 'org-cycle
|
(kbd "TAB") 'org-cycle
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
28
init/mod-shell.el
Normal file
28
init/mod-shell.el
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
(setq shell-file-name "zsh")
|
||||||
|
(setq comint-process-echoes t)
|
||||||
|
(setq comint-prompt-regexp "^$ ")
|
||||||
|
(setq comint-input-ignoredups t)
|
||||||
|
(setq comint-completion-addsuffix t)
|
||||||
|
(setq comint-prompt-read-only t)
|
||||||
|
(setq comint-get-old-input (lambda () ""))
|
||||||
|
|
||||||
|
;; Setup auto-complete-esque path completion
|
||||||
|
(add-to-list 'ac-modes 'shell-mode)
|
||||||
|
(add-hook 'shell-mode-hook (lambda ()
|
||||||
|
(linum-mode 0)
|
||||||
|
(yas-minor-mode -1)
|
||||||
|
(enable-path-completion)
|
||||||
|
|
||||||
|
;; I want ac to silently offer completion, but leave
|
||||||
|
;; the actual tab-work to the underlying shell (ZSH is
|
||||||
|
;; powerful enough!)
|
||||||
|
(local-unset-key [tab])
|
||||||
|
|
||||||
|
(evil-define-key 'normal shell-mode-map "j" nil)
|
||||||
|
(evil-define-key 'normal shell-mode-map "k" nil)
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
(provide 'mod-shell)
|
|
@ -1,8 +1,6 @@
|
||||||
(mapc 'my/install-package '(markdown-mode))
|
|
||||||
|
|
||||||
(add-hook 'text-mode-hook 'my/enable-hard-wrap)
|
(add-hook 'text-mode-hook 'my/enable-hard-wrap)
|
||||||
|
|
||||||
(use-package markdown-mode
|
(use-package markdown-mode :ensure t
|
||||||
:mode (("\\.md\\'" . markdown-mode)
|
:mode (("\\.md\\'" . markdown-mode)
|
||||||
("/README\\'" . markdown-mode))
|
("/README\\'" . markdown-mode))
|
||||||
:init
|
:init
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
(mapc 'my/install-package
|
(use-package rainbow-mode :ensure t
|
||||||
'(emmet-mode
|
|
||||||
scss-mode
|
|
||||||
web-mode
|
|
||||||
haml-mode
|
|
||||||
tern
|
|
||||||
tern-auto-complete
|
|
||||||
php-mode
|
|
||||||
rainbow-mode ; highlight color codes
|
|
||||||
))
|
|
||||||
|
|
||||||
(use-package rainbow-mode
|
|
||||||
:defer t
|
:defer t
|
||||||
:init (add-hook 'scss-mode 'rainbow-mode))
|
:init (add-hook 'scss-mode 'rainbow-mode))
|
||||||
|
|
||||||
(use-package scss-mode :mode "\\.scss\\'")
|
(use-package scss-mode :ensure t
|
||||||
(use-package haml-mode :mode "\\.haml\\'")
|
:mode "\\.scss\\'"
|
||||||
(use-package web-mode
|
:config
|
||||||
|
(add-hook 'scss-mode-hook (lambda() (add-to-list 'ac-sources 'ac-css-mode-setup))))
|
||||||
|
|
||||||
|
(use-package haml-mode :ensure t :mode "\\.haml\\'")
|
||||||
|
(use-package web-mode :ensure t
|
||||||
:mode (("\\.\\(p\\)?htm\\(l\\)?\\'" . web-mode)
|
:mode (("\\.\\(p\\)?htm\\(l\\)?\\'" . web-mode)
|
||||||
("\\.tpl\\(\\.php\\)?\\'" . web-mode)
|
("\\.tpl\\(\\.php\\)?\\'" . web-mode)
|
||||||
("\\.erb\\'" . web-mode)))
|
("\\.erb\\'" . web-mode)))
|
||||||
|
|
||||||
(use-package php-mode
|
(use-package php-mode :ensure t
|
||||||
:mode "\\.php\\'"
|
:mode (("\\.php\\'" . php-mode)
|
||||||
|
("\\.inc\\'" . php-mode))
|
||||||
:interpreter "php"
|
:interpreter "php"
|
||||||
:config
|
:config
|
||||||
(setq php-template-compatibility nil))
|
(progn
|
||||||
|
(my/setup-run-code php-mode-map "php")
|
||||||
|
(setq php-template-compatibility nil)))
|
||||||
|
|
||||||
(use-package tern
|
(use-package js-mode
|
||||||
:commands (tern-mode tern-ac-complete tern-ac-setup)
|
:mode "\\.js\\'"
|
||||||
|
:interpreter "node")
|
||||||
|
|
||||||
|
(use-package tern :ensure t
|
||||||
|
:commands tern-mode
|
||||||
:config
|
:config
|
||||||
(progn (use-package tern-auto-complete)
|
(progn
|
||||||
(setq tern-ac-on-dot nil))
|
(my/setup-run-code js-mode-map "node")
|
||||||
|
(use-package tern-auto-complete :ensure t
|
||||||
|
:config (setq tern-ac-on-dot nil)))
|
||||||
:init
|
:init
|
||||||
;; replace auto-complete with tern-ac-complete only in js-mode
|
;; replace auto-complete with tern-ac-complete only in js-mode
|
||||||
(add-hook 'js-mode-hook
|
(add-hook 'js-mode-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(imap ac-mode-map (kbd "C-SPC") 'tern-ac-complete)
|
|
||||||
(tern-mode t)
|
(tern-mode t)
|
||||||
|
(imap js-mode-map (kbd "C-SPC") 'tern-ac-complete)
|
||||||
(tern-ac-setup))))
|
(tern-ac-setup))))
|
||||||
|
|
||||||
(use-package emmet-mode
|
(use-package emmet-mode :ensure t
|
||||||
:defer t
|
:defer t
|
||||||
:config
|
:config
|
||||||
(progn
|
|
||||||
(imap 'emmet-mode-map (kbd "s-e") 'emmet-expand-line)
|
(imap 'emmet-mode-map (kbd "s-e") 'emmet-expand-line)
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
(add-hook 'scss-mode-hook 'emmet-mode)
|
(add-hook 'scss-mode-hook 'emmet-mode)
|
||||||
(add-hook 'web-mode-hook 'emmet-mode)
|
(add-hook 'web-mode-hook 'emmet-mode)
|
||||||
(add-hook 'nxml-mode-hook 'emmet-mode))
|
(add-hook 'nxml-mode-hook 'emmet-mode)))
|
||||||
)
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(provide 'mod-webdev)
|
(provide 'mod-webdev)
|
||||||
|
|
100
init/my-defuns.el
Normal file
100
init/my-defuns.el
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
;;;; Macros ;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(defmacro λ (&rest body)
|
||||||
|
`(lambda () (interactive) ,@body))
|
||||||
|
|
||||||
|
;; vimmish keymapping shortcuts
|
||||||
|
(defmacro nmap (map &rest body)
|
||||||
|
`(evil-define-key 'normal ,map ,@body))
|
||||||
|
(defmacro vmap (map &rest body)
|
||||||
|
`(evil-define-key 'visual ,map ,@body))
|
||||||
|
(defmacro imap (map &rest body)
|
||||||
|
`(evil-define-key 'insert ,map ,@body))
|
||||||
|
(defmacro emap (map &rest body)
|
||||||
|
`(evil-define-key 'emacs ,map ,@body))
|
||||||
|
|
||||||
|
;; insert-mode key-chord mapping
|
||||||
|
(defmacro ichmap (key command)
|
||||||
|
`(key-chord-define evil-insert-state-map ,key ,command))
|
||||||
|
|
||||||
|
;;;; Commands ;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; File navigation defuns
|
||||||
|
(defun my/initfiles ()
|
||||||
|
(interactive)
|
||||||
|
(ido-find-file-in-dir my/dir))
|
||||||
|
|
||||||
|
(defun my/open-scratch ()
|
||||||
|
(interactive)
|
||||||
|
(switch-to-buffer (get-buffer-create "*scratch*"))
|
||||||
|
(text-mode))
|
||||||
|
|
||||||
|
(defun my/expand-space ()
|
||||||
|
(interactive)
|
||||||
|
(save-excursion (insert " ")))
|
||||||
|
|
||||||
|
(defun my/expand-backspace ()
|
||||||
|
(interactive)
|
||||||
|
(save-excursion (delete-char 1))
|
||||||
|
(delete-backward-char 1))
|
||||||
|
|
||||||
|
(defun my/enable-hard-wrap()
|
||||||
|
(interactive)
|
||||||
|
(auto-fill-mode 1))
|
||||||
|
|
||||||
|
(defun my/byte-recompile ()
|
||||||
|
(interactive)
|
||||||
|
(byte-recompile-file (expand-file-name "init.el" my/dir))
|
||||||
|
(byte-recompile-directory my/init-dir 0)
|
||||||
|
(byte-recompile-directory my/elisp-dir 0))
|
||||||
|
|
||||||
|
(defun my/notes()
|
||||||
|
"Load up my notes folder in dropbox"
|
||||||
|
(interactive)
|
||||||
|
(ido-find-file-in-dir "~/Dropbox/notes"))
|
||||||
|
|
||||||
|
(defun my/kill-all-buffers ()
|
||||||
|
(interactive)
|
||||||
|
(mapc 'kill-buffer (buffer-list))
|
||||||
|
(message "All buffers killed"))
|
||||||
|
|
||||||
|
(defun my/kill-other-buffers ()
|
||||||
|
(interactive)
|
||||||
|
(mapc 'kill-buffer (cdr (buffer-list (current-buffer))))
|
||||||
|
(message "All other buffers killed"))
|
||||||
|
|
||||||
|
(defun my/kill-non-project-buffers ()) ; TODO Implement this
|
||||||
|
|
||||||
|
;;;; Ac-setup Defuns ;;;;;;;;;;;;;;
|
||||||
|
(defun my/ac-ruby-setup()
|
||||||
|
"Set up RSense and ac-sources"
|
||||||
|
(setq ac-sources (append '(ac-source-rsense ac-source-yasnippet) ac-sources)))
|
||||||
|
|
||||||
|
(defun my/ac-files-setup()
|
||||||
|
"Set up filepath completion sources"
|
||||||
|
(setq ac-sources (append '(ac-source-filename ac-source-files-in-current-dir) ac-sources)))
|
||||||
|
|
||||||
|
(defun my/setup-run-code(mode interpreter)
|
||||||
|
(interactive)
|
||||||
|
(nmap mode (kbd "s-r")
|
||||||
|
(λ (shell-command-on-region (point-min) (point-max) interpreter)))
|
||||||
|
(vmap mode (kbd "s-r")
|
||||||
|
(λ (shell-command-on-region (region-beginning) (region-end) interpreter))))
|
||||||
|
|
||||||
|
;;;; Mac-specific Defuns ;;;;;;;;;
|
||||||
|
(when is-mac
|
||||||
|
;; Send current file to OSX apps
|
||||||
|
(defun open-file-with (path &optional appName)
|
||||||
|
(if (not (string= "" appName))
|
||||||
|
(setq appName (concat "-a " appName ".app")))
|
||||||
|
(shell-command (concat "open " appName " " path)))
|
||||||
|
|
||||||
|
(defun open-with (appName)
|
||||||
|
(interactive)
|
||||||
|
(open-file-with (buffer-file-name) appName))
|
||||||
|
|
||||||
|
(defun send-to-transmit () (interactive) (open-with "Transmit"))
|
||||||
|
(defun send-to-launchbar () (interactive) (open-with "LaunchBar"))
|
||||||
|
(defun send-dir-to-launchbar () (interactive) (open-file-with default-directory "LaunchBar"))
|
||||||
|
(defun send-dir-to-finder () (interactive) (open-file-with default-directory "Finder")))
|
||||||
|
|
||||||
|
;;
|
||||||
|
(provide 'my-defuns)
|
Loading…
Add table
Add a link
Reference in a new issue