Initial commit (brand new NARF)
This commit is contained in:
parent
de70863bed
commit
d0628e018a
105 changed files with 1837 additions and 16026 deletions
160
Cask
160
Cask
|
@ -3,151 +3,53 @@
|
|||
(source marmalade)
|
||||
(source gnu)
|
||||
|
||||
;; Essentials
|
||||
(depends-on "cask")
|
||||
;; Core
|
||||
(depends-on "dash")
|
||||
(depends-on "s")
|
||||
(depends-on "f")
|
||||
(depends-on "deferred")
|
||||
(depends-on "fuzzy")
|
||||
(depends-on "use-package")
|
||||
(depends-on "smex")
|
||||
(depends-on "pos-tip")
|
||||
(depends-on "nlinum")
|
||||
(depends-on "vim-empty-lines-mode")
|
||||
(depends-on "hlinum" :git "https://github.com/tom-tan/hlinum-mode")
|
||||
(depends-on "popwin")
|
||||
(depends-on "help-fns+")
|
||||
|
||||
;; Themes
|
||||
(depends-on "solarized-theme")
|
||||
|
||||
;; OSX
|
||||
;; OSX --- core-osx.el
|
||||
(depends-on "exec-path-from-shell")
|
||||
(depends-on "dash-at-point")
|
||||
|
||||
;; Core
|
||||
(depends-on "shut-up")
|
||||
(depends-on "popwin")
|
||||
(depends-on "saveplace")
|
||||
|
||||
;; Editing
|
||||
;; UI --- core-ui.el
|
||||
(depends-on "nlinum")
|
||||
(depends-on "smart-mode-line")
|
||||
(depends-on "dired+")
|
||||
(depends-on "expand-region")
|
||||
(depends-on "flycheck")
|
||||
(depends-on "flyspell")
|
||||
(depends-on "rainbow-delimiters")
|
||||
(depends-on "smartparens")
|
||||
(depends-on "yasnippet")
|
||||
(depends-on "diff-hl")
|
||||
(depends-on "ace-jump-mode")
|
||||
(depends-on "ace-window")
|
||||
(depends-on "ace-link")
|
||||
(depends-on "pcre2el")
|
||||
(depends-on "emr")
|
||||
(depends-on "smart-forward")
|
||||
(depends-on "anzu")
|
||||
(depends-on "iedit")
|
||||
(depends-on "quickrun")
|
||||
(depends-on "goto-last-change")
|
||||
|
||||
;; Auto-completion
|
||||
(depends-on "company")
|
||||
(depends-on "company-c-headers")
|
||||
(depends-on "company-cmake")
|
||||
(depends-on "company-tern")
|
||||
(depends-on "company-anaconda")
|
||||
(depends-on "company-inf-ruby")
|
||||
(depends-on "company-statistics")
|
||||
|
||||
;; Eeeevil
|
||||
;; Evil --- core-editor.el
|
||||
(depends-on "evil")
|
||||
(depends-on "evil-search-highlight-persist")
|
||||
(depends-on "evil-anzu")
|
||||
(depends-on "evil-commentary")
|
||||
(depends-on "evil-matchit")
|
||||
(depends-on "evil-numbers")
|
||||
(depends-on "evil-exchange")
|
||||
(depends-on "evil-visualstar")
|
||||
(depends-on "evil-iedit-state")
|
||||
(depends-on "evil-indent-textobject")
|
||||
(depends-on "evil-jumper")
|
||||
(depends-on "evil-iedit-state")
|
||||
(depends-on "evil-anzu")
|
||||
(depends-on "evil-matchit")
|
||||
(depends-on "evil-numbers")
|
||||
(depends-on "evil-search-highlight-persist")
|
||||
(depends-on "evil-snipe")
|
||||
(depends-on "evil-surround")
|
||||
(depends-on "evil-space")
|
||||
(depends-on "evil-surround" :git "https://github.com/hlissner/evil-surround")
|
||||
(depends-on "evil-visualstar")
|
||||
(depends-on "evil-plugins" :git "https://github.com/tarao/evil-plugins")
|
||||
|
||||
;; Project management
|
||||
(depends-on "projectile")
|
||||
(depends-on "helm")
|
||||
(depends-on "helm-ag")
|
||||
(depends-on "helm-css-scss")
|
||||
(depends-on "helm-projectile")
|
||||
(depends-on "helm-swoop")
|
||||
(depends-on "helm-company")
|
||||
(depends-on "helm-c-yasnippet")
|
||||
(depends-on "neotree" :git "https://github.com/jeffplang/emacs-neotree")
|
||||
(depends-on "ido-ubiquitous")
|
||||
(depends-on "ido-vertical-mode")
|
||||
(depends-on "flx-ido")
|
||||
(depends-on "workgroups2")
|
||||
(depends-on "xcscope")
|
||||
;; Editor --- core-editor.el
|
||||
(depends-on "ace-jump-mode")
|
||||
(depends-on "ace-link")
|
||||
(depends-on "ace-window")
|
||||
(depends-on "emr")
|
||||
(depends-on "expand-region")
|
||||
(depends-on "goto-last-change")
|
||||
(depends-on "hl-todo" :git "https://github.com/tarsius/hl-todo")
|
||||
(depends-on "rainbow-delimiters")
|
||||
(depends-on "rotate-text" :git "https://github.com/debug-ito/rotate-text.el")
|
||||
(depends-on "smart-forward")
|
||||
(depends-on "smartparens")
|
||||
(depends-on "smex")
|
||||
|
||||
;; Modes/mode-specific
|
||||
(depends-on "org-plus-contrib")
|
||||
(depends-on "org-opml" :git "https://github.com/edavis/org-opml")
|
||||
;(depends-on "org-present")
|
||||
|
||||
(depends-on "rainbow-mode")
|
||||
(depends-on "lua-mode")
|
||||
(depends-on "haml-mode")
|
||||
(depends-on "scss-mode")
|
||||
(depends-on "sass-mode")
|
||||
(depends-on "sws-mode")
|
||||
(depends-on "json-mode")
|
||||
(depends-on "yaml-mode")
|
||||
(depends-on "markdown-mode")
|
||||
(depends-on "glsl-mode")
|
||||
(depends-on "groovy-mode")
|
||||
(depends-on "swift-mode")
|
||||
;; (depends-on "haxe-mode")
|
||||
(depends-on "go-mode")
|
||||
|
||||
(depends-on "php-mode")
|
||||
(depends-on "php-refactor-mode")
|
||||
(depends-on "php-extras" :git "https://github.com/arnested/php-extras")
|
||||
|
||||
(depends-on "web-mode")
|
||||
(depends-on "emmet-mode")
|
||||
(depends-on "web-beautify")
|
||||
|
||||
(depends-on "tern")
|
||||
(depends-on "js2-mode")
|
||||
(depends-on "js2-refactor")
|
||||
|
||||
(depends-on "enh-ruby-mode")
|
||||
(depends-on "ruby-refactor")
|
||||
(depends-on "rspec-mode")
|
||||
(depends-on "inf-ruby")
|
||||
(depends-on "robe")
|
||||
|
||||
(depends-on "anaconda-mode")
|
||||
|
||||
(depends-on "omnisharp")
|
||||
(depends-on "csharp-mode")
|
||||
(depends-on "emacs-eclim")
|
||||
|
||||
(depends-on "git-commit-mode")
|
||||
(depends-on "git-rebase-mode")
|
||||
(depends-on "gitconfig-mode")
|
||||
(depends-on "gitignore-mode")
|
||||
|
||||
(depends-on "applescript-mode")
|
||||
(depends-on "cmake-mode")
|
||||
|
||||
(depends-on "rust-mode")
|
||||
(depends-on "d-mode")
|
||||
(depends-on "android-mode")
|
||||
|
||||
(depends-on "vimrc-mode")
|
||||
|
||||
;(depends-on "osh")
|
||||
;(depends-on "sonic-pi" :git "https://github.com/repl-electric/sonic-pi.el")
|
||||
;; OTHER
|
||||
;;(depends-on "shaderlab-mode" :git "https://bitbucket.org/bbbscarter/emacs-shaderlab-mode")
|
||||
;;(depends-on "unityjs-mode" :git "https://github.com/naruse/EmacsUnityScript")
|
||||
|
|
23
Makefile
23
Makefile
|
@ -1,22 +1,11 @@
|
|||
EMACS=emacs
|
||||
|
||||
all: update
|
||||
|
||||
update: install autoloads
|
||||
cask update
|
||||
all: install update
|
||||
|
||||
install:
|
||||
cask install
|
||||
@cask install
|
||||
|
||||
compile: clean
|
||||
@cask exec ${EMACS} -f narf::byte-compile
|
||||
update:
|
||||
@cask update
|
||||
|
||||
clean: clean-extras
|
||||
@rm -rf init.elc init/*.elc contrib/*.elc core/*.elc
|
||||
|
||||
clean-extras:
|
||||
@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 semanticdb
|
||||
|
||||
autoloads:
|
||||
@rm -rf core/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"))'
|
||||
clean:
|
||||
@rm -f init.elc {core,modules,private,contrib}/*.elc
|
||||
|
|
55
README.md
55
README.md
|
@ -1,55 +0,0 @@
|
|||
# NARF Emacs
|
||||
|
||||

|
||||
|
||||
> What we do every night, Pinky...
|
||||
|
||||
This is emacs for the stubborn vimmer, megalomaniac mouse and masochists alike.
|
||||
It has been configured first: to emulate vim as best it can, and second: to
|
||||
surpass it in any way possible; all this is built on top of
|
||||
[Evil-mode](https://gitorious.org/evil/pages/Home), a vim emulator for emacs.
|
||||
|
||||
This has only been tested on Emacs 24.5 on OSX, YMMV.
|
||||
|
||||
Any contributions or suggestions are welcome. The world won't take over itself.
|
||||
|
||||
## Installation
|
||||
|
||||
`brew install cask`
|
||||
|
||||
Narf only requires [Cask](https://github.com/cask/cask) for managing its plugins
|
||||
outside of emacs.
|
||||
|
||||
Also, though not strictly a requirement, I recommend the railwaycat/emacsmacport
|
||||
build of emacs for OSX users, which you can get via homebrew:
|
||||
|
||||
```sh
|
||||
brew tap railwaycat/emacsmacport
|
||||
brew install emacs-mac
|
||||
```
|
||||
|
||||
Lastly, a recursive clone will get everything you need:
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/hlissner/emacs.d ~/.emacs.d
|
||||
cd ~/.emacs.d
|
||||
make # installs plugins via cask and generates autoloads
|
||||
make compile # optional
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
A summary of what to expect can be found in these three files:
|
||||
|
||||
```
|
||||
./Cask # what packages are included
|
||||
./init/narf-commands.el # what custom ex commands are defined
|
||||
./init/narf-bindings.el # the keybindings
|
||||
```
|
||||
|
||||
## Disclaimer
|
||||
|
||||
I am not an elisp guru. You have been warned.
|
||||
|
||||
## What about Windo-
|
||||

|
0
contrib/company-dict/README.md
Normal file
0
contrib/company-dict/README.md
Normal file
0
contrib/company-dict/company-dict.el
Normal file
0
contrib/company-dict/company-dict.el
Normal file
|
@ -1,65 +0,0 @@
|
|||
;;; evil-ex-registers.el --- Command to paste from register in ex mode
|
||||
|
||||
;; Author: INA Lintaro <tarao.gnn at gmail.com>
|
||||
;; URL: http://github.com/tarao/evil-plugins
|
||||
;; Version: 0.1
|
||||
;; Keywords: evil, plugin
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;;; License:
|
||||
;;
|
||||
;; 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'evil)
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(defalias 'evil-orig-get-register (symbol-function 'evil-get-register))
|
||||
|
||||
(defun evil-get-spec-register (register &optional noerror)
|
||||
"Return contents of REGISTER.
|
||||
Signal an error if empty, unless NOERROR is non-nil.
|
||||
|
||||
Support some registers listed below in addition to
|
||||
`evil-get-register'.
|
||||
the file name under the cursor
|
||||
the expanded file name under the cursor
|
||||
the word under the cursor
|
||||
the WORD under the cursor"
|
||||
(cond
|
||||
((or (= register ?\C-f) ; ^F the filename under the cursor
|
||||
(= register ?\C-p)) ; ^P the expanded filename under the cursor
|
||||
(let ((file (thing-at-point 'filename)))
|
||||
(or (and file (= register ?\C-p) (expand-file-name file)) file)))
|
||||
((or (= register ?\C-w) ; ^W the word under the cursor
|
||||
(= register ?\C-a)) ; ^A the WORD under the cursor
|
||||
(let* ((word (if (= register ?\C-a) #'evil-move-WORD #'evil-move-word))
|
||||
(range (evil-inner-object-range nil nil nil nil word)))
|
||||
(filter-buffer-substring (nth 0 range) (nth 1 range))))
|
||||
(t (evil-orig-get-register register noerror))))
|
||||
|
||||
(defun evil-ex-paste-from-register (&optional register)
|
||||
"Paste from REGISTER in command line."
|
||||
(interactive)
|
||||
(cl-flet ((evil-get-register (register &optional noerror)
|
||||
(with-current-buffer evil-ex-current-buffer
|
||||
(evil-get-spec-register register noerror))))
|
||||
(if (called-interactively-p 'any)
|
||||
(call-interactively #'evil-paste-from-register)
|
||||
(evil-paste-from-register register))))
|
||||
|
||||
(provide 'evil-ex-registers)
|
||||
;;; evil-ex-registers.el ends here
|
|
@ -1,168 +0,0 @@
|
|||
;;; flycheck-objc.el --- Flycheck for objc-mode. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2014 Rafal Kowalski
|
||||
|
||||
;; Author: Rafal Kowalski <rafal.kowalski@mac.com>
|
||||
;; Keywords: c, tools
|
||||
|
||||
;; 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Flycheck settings for objc-mode.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'flycheck)
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-definitions nil objc-clang
|
||||
"Additional preprocessor definitions for Clang.
|
||||
|
||||
The value of this variable is a list of strings, where each
|
||||
string is an additional definition to pass to Clang, via the `-D'
|
||||
option."
|
||||
:type '(repeat (string :tag "Definition"))
|
||||
:safe #'flycheck-string-list-p
|
||||
:package-version '(flycheck . "0.15"))
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-include-path nil objc-clang
|
||||
"A list of include directories for Clang.
|
||||
|
||||
Thae value of this variable is a list of strings, where each
|
||||
string is a directory to add to the include path of Clang.
|
||||
Relative paths are relative to the file being checked."
|
||||
:type '(repeat (directory :tag "Include directory"))
|
||||
:safe #'flycheck-string-list-p
|
||||
:package-version '(flycheck . "0.14"))
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-framework-path nil objc-clang
|
||||
"A list of frameworks for Clang.
|
||||
|
||||
Thae value of this variable is a list of strings, where each
|
||||
string is a path to a frameworks directory to add to the frameworks
|
||||
path of Clang. Relative paths are relative to the file being
|
||||
checked."
|
||||
:type '(repeat (directory :tag "Framework directory"))
|
||||
:safe #'flycheck-string-list-p
|
||||
:package-version '(flycheck . "0.14"))
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-includes nil objc-clang
|
||||
"A list of additional include files for Clang.
|
||||
|
||||
The value of this variable is a list of strings, where each
|
||||
string is a file to include before syntax checking. Relative
|
||||
paths are relative to the file being checked."
|
||||
:type '(repeat (file :tag "Include file"))
|
||||
:safe #'flycheck-string-list-p
|
||||
:package-version '(flycheck . "0.15"))
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-language-standard nil objc-clang
|
||||
"The language standard to use in Clang.
|
||||
|
||||
The value of this variable is either a string denoting a language
|
||||
standard, or nil, to use the default standard. When non-nil,
|
||||
pass the language standard via the `-std' option."
|
||||
:type '(choice (const :tag "Default standard" nil)
|
||||
(string :tag "Language standard"))
|
||||
:safe #'stringp
|
||||
:package-version '(flycheck . "0.15"))
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-standard-library nil objc-clang
|
||||
"The standard library to use for Clang.
|
||||
|
||||
The value of this variable is the name of a standard library as
|
||||
string, or nil to use the default standard library.
|
||||
|
||||
Refer to the Clang manual at URL
|
||||
`http://clang.llvm.org/docs/UsersManual.html' for more
|
||||
information about the standard library."
|
||||
:type '(choice (const "libc++")
|
||||
(const :tag "GNU libstdc++" "libstdc++")
|
||||
(string :tag "Library name"))
|
||||
:safe #'stringp
|
||||
:package-version '(flycheck . "0.15"))
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-archs nil objc-clang
|
||||
"What architectures to use for clang.
|
||||
|
||||
When non-nil, set the architectures, via `-arch'."
|
||||
:type '(repeat (file :tag "Architecture"))
|
||||
:safe #'flycheck-string-list-p
|
||||
:package-version '(flycheck . "0.15"))
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-sysroot nil objc-clang
|
||||
"The system root to use in clang.
|
||||
|
||||
When non-nil,pass the language standard via the `-isysroot' option."
|
||||
:type '(choice (const :tag "Default sysroot" nil)
|
||||
(string :tag "Sysroot"))
|
||||
:safe #'stringp
|
||||
:package-version '(flycheck . "0.15"))
|
||||
|
||||
(flycheck-def-option-var flycheck-objc-clang-warnings '("all" "extra") objc-clang
|
||||
"A list of additional warnings to enable in Clang.
|
||||
|
||||
The value of this variable is a list of strings, where each string
|
||||
is the name of a warning category to enable. By default, all
|
||||
recommended warnings and some extra warnings are enabled (as by
|
||||
`-Wall' and `-Wextra' respectively).
|
||||
|
||||
Refer to the Clang manual at URL
|
||||
`http://clang.llvm.org/docs/UsersManual.html' for more
|
||||
information about warnings."
|
||||
:type '(choice (const :tag "No additional warnings" nil)
|
||||
(repeat :tag "Additional warnings"
|
||||
(string :tag "Warning name")))
|
||||
:safe #'flycheck-string-list-p
|
||||
:package-version '(flycheck . "0.14"))
|
||||
|
||||
(flycheck-define-checker objc-clang
|
||||
"A objc syntax checker using Clang.
|
||||
|
||||
See URL `http://clang.llvm.org/'."
|
||||
:command ("clang"
|
||||
"-fsyntax-only"
|
||||
"-fno-color-diagnostics" ; Do not include color codes in output
|
||||
"-fno-caret-diagnostics" ; Do not visually indicate the source
|
||||
; location
|
||||
"-fno-diagnostics-show-option" ; Do not show the corresponding
|
||||
; warning group
|
||||
(option "-isysroot" flycheck-objc-clang-sysroot)
|
||||
(option-list "-arch" flycheck-objc-clang-archs)
|
||||
(option "-std=" flycheck-objc-clang-language-standard)
|
||||
(option "-stdlib=" flycheck-objc-clang-standard-library)
|
||||
(option-list "-include" flycheck-objc-clang-includes)
|
||||
(option-list "-W" flycheck-objc-clang-warnings s-prepend)
|
||||
(option-list "-D" flycheck-objc-clang-definitions s-prepend)
|
||||
(option-list "-I" flycheck-objc-clang-include-path)
|
||||
(option-list "-F" flycheck-objc-clang-framework-path)
|
||||
"-x" (eval
|
||||
(cl-case major-mode
|
||||
(objc-mode "objective-c")
|
||||
(c-mode "c")))
|
||||
;; We must stay in the same directory, to properly resolve #include
|
||||
;; with quotes
|
||||
source-inplace)
|
||||
:error-patterns
|
||||
((info line-start (file-name) ":" line ":" column
|
||||
": note: " (message) line-end)
|
||||
(warning line-start (file-name) ":" line ":" column
|
||||
": warning: " (message) line-end)
|
||||
(error line-start (file-name) ":" line ":" column
|
||||
": " (or "fatal error" "error") ": " (message) line-end))
|
||||
:modes (c-mode objc-mode)
|
||||
:next-checkers ((warnings-only . objc-cppcheck)))
|
||||
|
||||
(provide 'flycheck-objc)
|
||||
;;; objc-flycheck.el ends here
|
2820
contrib/help-fns+.el
2820
contrib/help-fns+.el
File diff suppressed because it is too large
Load diff
|
@ -1,252 +0,0 @@
|
|||
;;; hide-mode-line.el --- Hides the mode line when there is only one frame and
|
||||
;;; one buffer.
|
||||
;;
|
||||
;; Filename: hide-mode-line.el
|
||||
;; Description: Hides the mode line when there is only one frame and one
|
||||
;; buffer.
|
||||
;; Author: Darren Embry
|
||||
;; Copyright (c) 2008, 2011 Darren Embry
|
||||
;; URL: http://webonastick.com/emacs-lisp/hide-mode-line.el
|
||||
;; Keywords: mode line, writeroom
|
||||
;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x
|
||||
;;
|
||||
;; Features that might be required by this library:
|
||||
;;
|
||||
;; None
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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, 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; see the file COPYING. If not, write to the Free
|
||||
;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
;; 02110-1301, USA.
|
||||
;;
|
||||
;; GPL 2 is available here:
|
||||
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Basically, automatically hides the mode-line if all of the following
|
||||
;; are true:
|
||||
;; - there is only one frame.
|
||||
;; - there is only one window displayed in that frame.
|
||||
;; - there is no minibuffer.
|
||||
;; - the hide-mode-line variable is set.
|
||||
;; and automatically shows the mode-line when any of the above isn't true.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; HOW TO USE
|
||||
;;
|
||||
;; Just put this file in your Emacs library directory and add this line to
|
||||
;; your ~/.emacs:
|
||||
;;
|
||||
;; (autoload 'hide-mode-line "hide-mode-line" nil t)
|
||||
;;
|
||||
;; and use M-x hide-mode-line to toggle. Setting the hide-mode-line variable
|
||||
;; won't automatically update the buffers' mode-line visibilities.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; MYSTERY BUG: every once in a while a few lines of text will be hidden
|
||||
;; for some reason until you do a redraw-display. See if you can
|
||||
;; reproduce this in a reliable fashion!
|
||||
;;
|
||||
;; MYSTERY BUG: not specific to this module, but... load linum, run M-x
|
||||
;; linum-mode, then (setq mode-line-format nil) this triggers display
|
||||
;; problems more reproducibly: sometimes the last line in the buffer
|
||||
;; doesn't have the line number show up; and sometimes the cursor line
|
||||
;; or the one after it doesn't have the line number show up. May be
|
||||
;; related to above bug.
|
||||
;;
|
||||
;; CAVEAT: this code does not instruct your window system to make the
|
||||
;; window full-screen.
|
||||
;;
|
||||
;; TODO: briefly show modeline for (example) 2 seconds when the following
|
||||
;; happens:
|
||||
;; - hide-mode-line is about to be activated
|
||||
;; - you switch to another buffer
|
||||
;;
|
||||
;; TODO: Emacs 21 does not implement window-tree.
|
||||
;;
|
||||
;; BUG: if the hide-mode-line-window-configuration-change-hook function
|
||||
;; displays a (message "moo") before it does its work, the screen is blanked
|
||||
;; when you resize the window until you hit C-l.
|
||||
;;
|
||||
;; BUG: if a frame is closed and there is only one frame remaining, and
|
||||
;; there is only one buffer in that window, mode lines are not hidden.
|
||||
;;
|
||||
;; SEE ALSO:
|
||||
;; http://www.emacswiki.org/cgi-bin/wiki/LineNumbers
|
||||
;; http://www.emacswiki.org/cgi-bin/wiki/WriteRoom
|
||||
;;
|
||||
;;=============================================================================
|
||||
|
||||
;;; History:
|
||||
;;
|
||||
;; 2008-01-31 r3090 initial version
|
||||
;; 2008-02-01 r3097 explicitly defint default for
|
||||
;; hide-mode-line-saved-mode-line-format
|
||||
;; 2008-02-01 r3100 implement hide-mode-line-unaffected-by-minibuffer
|
||||
;; 2008-02-01 r3101 more robust handling of case where mode-line-format is
|
||||
;; nil before this code runs
|
||||
;; 2008-02-01 r3106 disable in emacs21: window-tree function not available
|
||||
;; 2011-03-08 r5835 fix emacsw32 bug
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar hide-mode-line-saved-mode-line-format nil)
|
||||
(make-variable-buffer-local 'hide-mode-line-saved-mode-line-format)
|
||||
; TODO: add a hook of some kind when setting mode-line-format.
|
||||
|
||||
(defvar hide-mode-line nil)
|
||||
; TODO: add a hook to run hide-mode-line-update when setting hide-mode-line.
|
||||
; [or just use M-x hide-mode-line for now]
|
||||
|
||||
(defcustom hide-mode-line-unaffected-by-minibuffer nil
|
||||
"If non-nil, a minibuffer by itself does not un-hide the modeline."
|
||||
:group 'hide-mode-line
|
||||
:type 'boolean)
|
||||
|
||||
(defun there-is-only-one-frame ()
|
||||
"Return non-nil if there is only one frame, nil otherwise."
|
||||
(let ((frames (frames-on-display-list)))
|
||||
(if (= (length frames) 1)
|
||||
(car frames)
|
||||
nil)))
|
||||
(defun there-is-only-one-window-in (frame)
|
||||
"Return non-nil if there is only one window in the specified FRAME."
|
||||
(let ((root (car (window-tree frame)))) ;FIXME: does not work with emacs21
|
||||
(not (listp root))))
|
||||
(defun there-is-only-one-frame-and-one-window ()
|
||||
"Return non-nil if there is only one frame and one window."
|
||||
(let ((the-only-frame (there-is-only-one-frame)))
|
||||
(and the-only-frame
|
||||
(or hide-mode-line-unaffected-by-minibuffer
|
||||
(= (minibuffer-depth) 0))
|
||||
(there-is-only-one-window-in the-only-frame))))
|
||||
|
||||
(defun hide-mode-line-in (buffer)
|
||||
"Hide the specified BUFFER's mode line.
|
||||
|
||||
Saves the buffer's previous `mode-line-format' value if it's not
|
||||
already hidden."
|
||||
(with-current-buffer buffer
|
||||
(if (and (not hide-mode-line-saved-mode-line-format)
|
||||
;; minibuffers don't have modelines :p
|
||||
(not (minibufferp buffer)))
|
||||
(progn (setq hide-mode-line-saved-mode-line-format
|
||||
(list mode-line-format))
|
||||
(setq mode-line-format nil)
|
||||
;; bug workaround
|
||||
(redraw-modeline)))))
|
||||
(defun show-mode-line-in (buffer)
|
||||
"If the specified BUFFER's mode line is hidden, un-hides it.
|
||||
|
||||
Restores the buffer's `mode-line-format' from what was saved when
|
||||
hide-mode-line-in was called."
|
||||
(with-current-buffer buffer
|
||||
(if (and hide-mode-line-saved-mode-line-format
|
||||
;; minibuffers don't have modelines :p
|
||||
(not (minibufferp buffer)))
|
||||
(progn (setq mode-line-format
|
||||
(car hide-mode-line-saved-mode-line-format))
|
||||
(setq hide-mode-line-saved-mode-line-format nil)))))
|
||||
|
||||
(defun hide-mode-lines ()
|
||||
"Hide all buffers' mode lines using hide-mode-line-in."
|
||||
(mapcar 'hide-mode-line-in (buffer-list)))
|
||||
(defun show-mode-lines ()
|
||||
"Show all buffers' mode lines using show-mode-line-in."
|
||||
(mapcar 'show-mode-line-in (buffer-list))
|
||||
(if (equal window-system 'w32)
|
||||
;; bug workaround
|
||||
(redraw-display)))
|
||||
|
||||
(defun hide-mode-line-update ()
|
||||
"Update the state of all buffers' mode lines.
|
||||
|
||||
This uses hide-mode-lines or show-mode-lines."
|
||||
(if hide-mode-line
|
||||
(if (there-is-only-one-frame-and-one-window)
|
||||
(hide-mode-lines)
|
||||
(show-mode-lines))
|
||||
(show-mode-lines)))
|
||||
|
||||
(defun hide-mode-line-minibuffer-setup-hook ()
|
||||
"Internal function."
|
||||
(hide-mode-line-update))
|
||||
(defun hide-mode-line-minibuffer-exit-hook ()
|
||||
"Internal function."
|
||||
(hide-mode-line-update))
|
||||
(defun hide-mode-line-make-frame-function (new-frame)
|
||||
"Internal function."
|
||||
(hide-mode-line-update))
|
||||
(defun hide-mode-line-delete-frame-function (dead-frame-walking)
|
||||
"Internal function."
|
||||
(hide-mode-line-update))
|
||||
(defun hide-mode-line-window-configuration-change-hook ()
|
||||
"Internal function."
|
||||
(hide-mode-line-update))
|
||||
|
||||
(defun hide-mode-line-add-hooks ()
|
||||
"Internal function."
|
||||
(interactive)
|
||||
(add-hook 'minibuffer-setup-hook
|
||||
'hide-mode-line-minibuffer-setup-hook)
|
||||
(add-hook 'minibuffer-exit-hook
|
||||
'hide-mode-line-minibuffer-exit-hook)
|
||||
(add-hook 'after-make-frame-functions
|
||||
'hide-mode-line-make-frame-function)
|
||||
(add-hook 'delete-frame-functions
|
||||
'hide-mode-line-delete-frame-function)
|
||||
(add-hook 'window-configuration-change-hook
|
||||
'hide-mode-line-window-configuration-change-hook))
|
||||
|
||||
(defun hide-mode-line-remove-hooks ()
|
||||
"Internal function."
|
||||
(interactive)
|
||||
(remove-hook 'minibuffer-setup-hook
|
||||
'hide-mode-line-minibuffer-setup-hook)
|
||||
(remove-hook 'minibuffer-exit-hook
|
||||
'hide-mode-line-minibuffer-exit-hook)
|
||||
(remove-hook 'after-make-frame-functions
|
||||
'hide-mode-line-make-frame-function)
|
||||
(remove-hook 'delete-frame-functions
|
||||
'hide-mode-line-delete-frame-function)
|
||||
(remove-hook 'window-configuration-change-hook
|
||||
'hide-mode-line-window-configuration-change-hook))
|
||||
|
||||
;;;###autoload
|
||||
(defun hide-mode-line ()
|
||||
"Toggle the hide-mode-line functionality."
|
||||
(interactive)
|
||||
(if (functionp 'window-tree)
|
||||
(progn
|
||||
(if hide-mode-line
|
||||
(hide-mode-line-remove-hooks)
|
||||
(hide-mode-line-add-hooks))
|
||||
(setq hide-mode-line (not hide-mode-line))
|
||||
(hide-mode-line-update))
|
||||
(error (concat "Your Emacs does not provide the window-tree function. "
|
||||
"Please upgrade to GNU Emacs 22 "
|
||||
"or to some other version of Emacs that provides it."))))
|
||||
|
||||
(provide 'hide-mode-line)
|
||||
|
||||
;;; hide-mode-line.el ends here
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
;;; hl-todo.el --- highlight TODO keywords
|
||||
|
||||
;; Copyright (C) 2013-2014 Jonas Bernoulli
|
||||
|
||||
;; Author: Jonas Bernoulli <jonas@bernoul.li>
|
||||
;; Created: 20130310
|
||||
;; Homepage: http://github.com/tarsius/hl-todo
|
||||
;; Keywords: convenience
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This file 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 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; This file 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.
|
||||
|
||||
;; For a full copy of the GNU General Public License
|
||||
;; see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Hightlight TODO keywords. There are many minor modes like it
|
||||
;; but this one is mine. It also happens to be simpler than the
|
||||
;; alternatives.
|
||||
|
||||
;; For now at least -- I might extend it. Or I might abandon it
|
||||
;; in favor of one of the following -- so you might be better of
|
||||
;; going straight for one of these:
|
||||
|
||||
;; - [[http://emacswiki.org/fic-ext-mode.el][fic-ext-mode]]
|
||||
;; - [[https://github.com/lewang/fic-mode][fic-mode]]
|
||||
;; - [[http://emacswiki.org/FixmeMode][fixme-mode]]
|
||||
;; - [[https://github.com/rolandwalker/fixmee][fixmee]]
|
||||
;; - see http://emacswiki.org/FixmeMode for more alternatives
|
||||
|
||||
;; If you like this you might also like [[https://github.com/tarsius/orglink][orglink]].
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defgroup hl-todo nil
|
||||
"Highlight TODO keywords in comments."
|
||||
:group 'font-lock-extra-types)
|
||||
|
||||
(defface hl-todo
|
||||
'((t (:bold t :foreground "#cc9393")))
|
||||
"Face used to highlight TODO keywords."
|
||||
:group 'hl-todo)
|
||||
|
||||
(defcustom hl-todo-activate-in-modes '(emacs-lisp-mode)
|
||||
"Major modes in which `hl-todo-mode' should be activated.
|
||||
This is used by `global-hl-todo-mode'."
|
||||
:group 'hl-todo
|
||||
:type '(repeat function))
|
||||
|
||||
(defvar hl-todo-keywords nil)
|
||||
|
||||
(defcustom hl-todo-keyword-faces
|
||||
'(("\\(\\bTODO\\((.*)\\)?:?\\)" . "#cc9393")
|
||||
("\\(\\bNOTE\\((.*)\\)?:?\\)" . "#d0bf8f")
|
||||
("\\(\\bFIXME\\((.*)\\)?:?\\)" . "#cc9393"))
|
||||
"Faces used to highlight specific TODO keywords."
|
||||
:group 'hl-todo
|
||||
:type '(repeat (cons (string :tag "Keyword")
|
||||
(choice :tag "Face "
|
||||
(string :tag "Color")
|
||||
(sexp :tag "Face"))))
|
||||
:set (lambda (symbol value)
|
||||
(set-default symbol value)
|
||||
(setq hl-todo-keywords
|
||||
`((,(concat "\\_<\\("
|
||||
(mapconcat 'car value "\\|")
|
||||
"\\)\\_>")
|
||||
(1 (hl-todo-get-face) t))))))
|
||||
|
||||
(defun hl-todo-get-face ()
|
||||
(let ((f (cdr (assoc (match-string 1) hl-todo-keyword-faces))))
|
||||
(if (stringp f) (list :inherit 'hl-todo :foreground f) f)))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode hl-todo-mode
|
||||
"Highlight TODO tags in comments."
|
||||
:lighter ""
|
||||
:group 'hl-todo
|
||||
(if hl-todo-mode
|
||||
(font-lock-add-keywords nil hl-todo-keywords 'append)
|
||||
(font-lock-remove-keywords nil hl-todo-keywords))
|
||||
(when (called-interactively-p 'any)
|
||||
(font-lock-fontify-buffer)))
|
||||
|
||||
;;;###autoload
|
||||
(define-globalized-minor-mode global-hl-todo-mode
|
||||
hl-todo-mode turn-on-hl-todo-mode-if-desired)
|
||||
|
||||
(defun turn-on-hl-todo-mode-if-desired ()
|
||||
(when (apply 'derived-mode-p hl-todo-activate-in-modes)
|
||||
(hl-todo-mode 1)))
|
||||
|
||||
(provide 'hl-todo)
|
||||
;; Local Variables:
|
||||
;; indent-tabs-mode: nil
|
||||
;; End:
|
||||
;;; hl-todo.el ends here
|
|
@ -1,195 +0,0 @@
|
|||
;;; ruby-mode-indent-fix.el ---
|
||||
|
||||
;; this file is not part of Emacs
|
||||
|
||||
;; Copyright (C) 2012 Le Wang
|
||||
;; Author: Le Wang
|
||||
;; Maintainer: Le Wang
|
||||
;; Description:
|
||||
;; Author: Le Wang
|
||||
;; Maintainer: Le Wang
|
||||
|
||||
;; Created: Sun Feb 26 23:27:17 2012 (+0800)
|
||||
;; Version: 0.1
|
||||
;; Last-Updated: Mon Mar 26 11:23:48 2012 (+0800)
|
||||
;; By: Le Wang
|
||||
;; Update #: 29
|
||||
;; URL:
|
||||
;; Keywords:
|
||||
;; Compatibility:
|
||||
|
||||
;;; Installation:
|
||||
|
||||
;; (eval-after-load "ruby-mod" '(require 'ruby-mode-indent-fix))
|
||||
;;
|
||||
;;
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Fix some indentation issues with ruby-mode with advices.
|
||||
;;
|
||||
;; Based on work by Dmitry Gutov(dgutov)
|
||||
;; - http://stackoverflow.com/a/7622971/903943 and
|
||||
;; - https://gist.github.com/1274520
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 3, 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; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
;; Floor, Boston, MA 02110-1301, USA.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(defvar ruby--paren-closings-regex
|
||||
"[])}\"']"
|
||||
"regex matching closing paren or string delimiter.")
|
||||
|
||||
;; We make this advice around to avoid unnecessary buffer modifications.
|
||||
|
||||
(defadvice ruby-indent-line (around fix-closing-paren activate)
|
||||
"indent closing paren to line up properly.
|
||||
|
||||
i.e.
|
||||
|
||||
foo_function( {:a => 'foo',
|
||||
:b => 'bar'
|
||||
}
|
||||
)
|
||||
|
||||
Note that the closing paren is vertically aligned with the opening paren.
|
||||
|
||||
note: `ruby-deep-indent-paren' has to be enabled for this to work."
|
||||
(let ((column (current-column))
|
||||
indent)
|
||||
(when ruby-deep-indent-paren
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(let ((state (syntax-ppss)))
|
||||
(when (and (or (memq (sp-get-pair (char-after)) ruby-deep-indent-paren)
|
||||
(and (eq (char-after) ?\})
|
||||
(eq 'brace (ruby--point-in-braced-proc))))
|
||||
(not (zerop (car state))))
|
||||
(goto-char (cadr state))
|
||||
(setq indent (current-column))))))
|
||||
(if indent
|
||||
(indent-line-to indent)
|
||||
ad-do-it)))
|
||||
|
||||
(defun ruby--indent-before-all-sexps ()
|
||||
"
|
||||
1. search backwards for a closing delimiter ON THIS LINE, then
|
||||
find the matching opening
|
||||
|
||||
2. if found, recurse, else the point is at a place we don't need
|
||||
to worry about sexps.
|
||||
"
|
||||
(if (re-search-backward ruby--paren-closings-regex (point-at-bol) t)
|
||||
(let ((ppss (syntax-ppss))
|
||||
beg)
|
||||
(goto-char (match-beginning 0))
|
||||
(cond ((setq beg (nth 1 ppss)) ; brace
|
||||
(goto-char beg))
|
||||
((nth 3 ppss) ; string
|
||||
(goto-char (nth 8 ppss))))
|
||||
(ruby--indent-before-all-sexps))))
|
||||
|
||||
(defun ruby--point-in-braced-proc ()
|
||||
"returns 'proc if point is in braces where starting bracs is EOL or followed by arg-list
|
||||
|
||||
i.e.
|
||||
|
||||
arr.each { |foo|
|
||||
// do stuff
|
||||
}
|
||||
|
||||
or
|
||||
|
||||
1.times {
|
||||
// do stuff
|
||||
}
|
||||
returns 'brace if point in brace
|
||||
|
||||
return nil otherwise
|
||||
"
|
||||
(save-excursion
|
||||
(let ((ppss (syntax-ppss))
|
||||
beg)
|
||||
(cond ((nth 3 ppss) ; string
|
||||
nil)
|
||||
((setq beg (nth 1 ppss)) ; brace
|
||||
(goto-char beg)
|
||||
(if (looking-at-p "{[\t ]*\\(?:$\\||\\)")
|
||||
'proc
|
||||
(when (looking-at-p "{")
|
||||
'brace)))))))
|
||||
|
||||
(defadvice ruby-indent-line (around line-up-args activate)
|
||||
"indent new line after comma at EOL properly:
|
||||
|
||||
i.e.
|
||||
|
||||
foo_function a_param,
|
||||
b_param,
|
||||
c_param
|
||||
|
||||
Note that all params line up after the function.
|
||||
"
|
||||
(let (indent ppss)
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(skip-chars-backward " \t\n")
|
||||
(setq ppss (syntax-ppss))
|
||||
;; check for inside comment, string, or inside braces
|
||||
(when (and (eq ?, (char-before))
|
||||
(not (memq (syntax-ppss-context ppss) '(comment string)))
|
||||
(zerop (car ppss)))
|
||||
(ruby--indent-before-all-sexps)
|
||||
(back-to-indentation)
|
||||
(if (save-excursion
|
||||
(skip-chars-backward " \t\n")
|
||||
(eq (char-before) ?,))
|
||||
(setq indent (current-column))
|
||||
(skip-syntax-forward "w_.")
|
||||
(skip-chars-forward " ")
|
||||
;; if the first symbol on the line is followed, by a comma, then this
|
||||
;; line must be a continuation
|
||||
(setq indent (current-column)))))
|
||||
(if indent
|
||||
(indent-line-to indent)
|
||||
ad-do-it)))
|
||||
|
||||
;; (defadvice ruby-indent-line (around indent-no-brace-args activate)
|
||||
;; "indent new line after comma at EOL properly:
|
||||
|
||||
;; i.e.
|
||||
|
||||
;; foo_function a_param,
|
||||
;; b_param,
|
||||
;; c_param
|
||||
|
||||
;; Note that all params line up after the function."
|
||||
;; (let ((res (ruby--point-in-braced-proc)))
|
||||
;; (cond ((eq 'brace res)
|
||||
;; (let ((ruby-deep-indent-paren '(?\[ ?\( ?\{ t)))
|
||||
;; ad-do-it))
|
||||
;; (t
|
||||
;; ad-do-it))))
|
||||
|
||||
(provide 'ruby-mode-indent-fix)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; ruby-mode-indent-fix.el ends here
|
|
@ -1,425 +0,0 @@
|
|||
;;; 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) 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) 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
|
|
@ -1,532 +0,0 @@
|
|||
;;; autoloads.el --- automatically extracted autoloads
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
|
||||
;;;### (autoloads nil "../contrib/goto-last-change" "../contrib/goto-last-change.el"
|
||||
;;;;;; (21865 37510 0 0))
|
||||
;;; Generated autoloads from ../contrib/goto-last-change.el
|
||||
|
||||
(autoload 'goto-last-change "../contrib/goto-last-change" "\
|
||||
Go to the point where the last edit was made in the current buffer.
|
||||
Repeat the command to go to the second last edit, etc.
|
||||
|
||||
To go back to more recent edit, the reverse of this command, use \\[goto-last-change-reverse]
|
||||
or precede this command with \\[universal-argument] - (minus).
|
||||
|
||||
It does not go to the same point twice even if there has been many edits
|
||||
there. I call the minimal distance between distinguishable edits \"span\".
|
||||
Set variable `glc-default-span' to control how close is \"the same point\".
|
||||
Default span is 8.
|
||||
The span can be changed temporarily with \\[universal-argument] right before \\[goto-last-change]:
|
||||
\\[universal-argument] <NUMBER> set current span to that number,
|
||||
\\[universal-argument] (no number) multiplies span by 4, starting with default.
|
||||
The so set span remains until it is changed again with \\[universal-argument], or the consecutive
|
||||
repetition of this command is ended by any other command.
|
||||
|
||||
When span is zero (i.e. \\[universal-argument] 0) subsequent \\[goto-last-change] visits each and
|
||||
every point of edit and a message shows what change was made there.
|
||||
In this case it may go to the same point twice.
|
||||
|
||||
This command uses undo information. If undo is disabled, so is this command.
|
||||
At times, when undo information becomes too large, the oldest information is
|
||||
discarded. See variable `undo-limit'.
|
||||
|
||||
\(fn ARG)" t nil)
|
||||
|
||||
(autoload 'goto-last-change-reverse "../contrib/goto-last-change" "\
|
||||
Go back to more recent changes after \\[goto-last-change] have been used.
|
||||
See `goto-last-change' for use of prefix argument.
|
||||
|
||||
\(fn ARG)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "../contrib/help-fns+" "../contrib/help-fns+.el"
|
||||
;;;;;; (21631 21029 0 0))
|
||||
;;; Generated autoloads from ../contrib/help-fns+.el
|
||||
|
||||
(autoload 'describe-command "../contrib/help-fns+" "\
|
||||
Describe an Emacs command (interactive function).
|
||||
Equivalent to using a prefix arg with `describe-function'.
|
||||
|
||||
If you use Icicles then in Icicle mode keys bound to the commands are
|
||||
shown next to them in `*Completions*. You can toggle this keys
|
||||
display on/off using `C-x C-a'.
|
||||
|
||||
\(fn FUNCTION)" t nil)
|
||||
|
||||
(autoload 'describe-option "../contrib/help-fns+" "\
|
||||
Describe an Emacs user variable (option).
|
||||
Same as using a prefix arg with `describe-variable'.
|
||||
|
||||
\(fn VARIABLE &optional BUFFER)" t nil)
|
||||
|
||||
(autoload 'describe-option-of-type "../contrib/help-fns+" "\
|
||||
Describe an Emacs user OPTION (variable) of a given `defcustom' TYPE.
|
||||
A prefix argument determines the type-checking behavior:
|
||||
- None: OPTION is defined with TYPE or a subtype of TYPE.
|
||||
- Plain `C-u': OPTION is defined with TYPE or a subtype of TYPE,
|
||||
or its current value is compatible with TYPE.
|
||||
- Negative: OPTION is defined with TYPE (exact match).
|
||||
- Non-negative: OPTION is defined with TYPE (exact match),
|
||||
or its current value is compatible with TYPE.
|
||||
|
||||
If TYPE is nil (default value) then *all* `defcustom' variables are
|
||||
potential candidates. That is different from using `describe-option',
|
||||
because `describe-option' includes user-variable candidates not
|
||||
defined with `defcustom' (with `*'-prefixed doc strings).
|
||||
|
||||
\(fn TYPE OPTION)" t nil)
|
||||
|
||||
(autoload 'describe-file "../contrib/help-fns+" "\
|
||||
Describe the file named FILENAME.
|
||||
If FILENAME is nil, describe current directory (`default-directory').
|
||||
|
||||
Starting with Emacs 22, if the file is an image file then:
|
||||
* Show a thumbnail of the image as well.
|
||||
* If you have command-line tool `exiftool' installed and in your
|
||||
`$PATH' or `exec-path', then show EXIF data (metadata) about the
|
||||
image. See standard Emacs library `image-dired.el' for more
|
||||
information about `exiftool'.
|
||||
|
||||
If FILENAME is the name of an autofile bookmark and you use library
|
||||
`Bookmark+', then show also the bookmark information (tags etc.). In
|
||||
this case, a prefix arg shows the internal form of the bookmark.
|
||||
|
||||
In Lisp code:
|
||||
|
||||
Non-nil optional arg INTERNAL-FORM-P shows the internal form.
|
||||
Non-nil optional arg NO-ERROR-P prints an error message but does not
|
||||
raise an error.
|
||||
|
||||
\(fn FILENAME &optional INTERNAL-FORM-P NO-ERROR-P)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "../contrib/hide-mode-line" "../contrib/hide-mode-line.el"
|
||||
;;;;;; (21641 7940 0 0))
|
||||
;;; Generated autoloads from ../contrib/hide-mode-line.el
|
||||
|
||||
(autoload 'hide-mode-line "../contrib/hide-mode-line" "\
|
||||
Toggle the hide-mode-line functionality.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "../contrib/hl-todo" "../contrib/hl-todo.el"
|
||||
;;;;;; (21835 1957 0 0))
|
||||
;;; Generated autoloads from ../contrib/hl-todo.el
|
||||
|
||||
(autoload 'hl-todo-mode "../contrib/hl-todo" "\
|
||||
Highlight TODO tags in comments.
|
||||
|
||||
\(fn &optional ARG)" t nil)
|
||||
|
||||
(defvar global-hl-todo-mode nil "\
|
||||
Non-nil if Global-Hl-Todo mode is enabled.
|
||||
See the command `global-hl-todo-mode' for a description of this minor mode.
|
||||
Setting this variable directly does not take effect;
|
||||
either customize it (see the info node `Easy Customization')
|
||||
or call the function `global-hl-todo-mode'.")
|
||||
|
||||
(custom-autoload 'global-hl-todo-mode "../contrib/hl-todo" nil)
|
||||
|
||||
(autoload 'global-hl-todo-mode "../contrib/hl-todo" "\
|
||||
Toggle Hl-Todo mode in all buffers.
|
||||
With prefix ARG, enable Global-Hl-Todo mode if ARG is positive;
|
||||
otherwise, disable it. If called from Lisp, enable the mode if
|
||||
ARG is omitted or nil.
|
||||
|
||||
Hl-Todo mode is enabled in all buffers where
|
||||
`turn-on-hl-todo-mode-if-desired' would do it.
|
||||
See `hl-todo-mode' for more information on Hl-Todo mode.
|
||||
|
||||
\(fn &optional ARG)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "../contrib/rotate-text" "../contrib/rotate-text.el"
|
||||
;;;;;; (21631 59390 0 0))
|
||||
;;; Generated autoloads from ../contrib/rotate-text.el
|
||||
|
||||
(autoload 'rotate-region "../contrib/rotate-text" "\
|
||||
Rotate all matches in `rotate-text-rotations' between point and mark.
|
||||
|
||||
\(fn BEG END)" t nil)
|
||||
|
||||
(autoload 'rotate-word-at-point "../contrib/rotate-text" "\
|
||||
Rotate word at point based on sets in `rotate-text-rotations'.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-buffers" "defuns-buffers.el" (21869
|
||||
;;;;;; 43589 0 0))
|
||||
;;; Generated autoloads from defuns-buffers.el
|
||||
|
||||
(autoload 'narf:narrow-to-region-indirect "defuns-buffers" "\
|
||||
Restrict editing in this buffer to the current region, indirectly.
|
||||
|
||||
\(fn START END)" t nil)
|
||||
|
||||
(autoload 'narf:widen "defuns-buffers" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:set-region-read-only "defuns-buffers" "\
|
||||
See http://stackoverflow.com/questions/7410125
|
||||
|
||||
\(fn BEGIN END)" nil nil)
|
||||
|
||||
(autoload 'narf:set-region-writeable "defuns-buffers" "\
|
||||
See http://stackoverflow.com/questions/7410125
|
||||
|
||||
\(fn BEGIN END)" nil nil)
|
||||
|
||||
(autoload 'narf/living-buffer-list "defuns-buffers" "\
|
||||
|
||||
|
||||
\(fn &optional BUFFER-LIST)" nil nil)
|
||||
|
||||
(autoload 'narf/add-throwaway-buffer "defuns-buffers" "\
|
||||
|
||||
|
||||
\(fn REGEXP)" nil nil)
|
||||
|
||||
(autoload 'narf:cleanup-buffers "defuns-buffers" "\
|
||||
Kill left-over temporary, dired or buried special buffers
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:cleanup-processes "defuns-buffers" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:kill-matching-buffers "defuns-buffers" "\
|
||||
|
||||
|
||||
\(fn REGEXP &optional BUFFER-LIST)" t nil)
|
||||
|
||||
(autoload 'narf:next-real-buffer "defuns-buffers" "\
|
||||
Switch to the next buffer and avoid special buffers.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:previous-real-buffer "defuns-buffers" "\
|
||||
Switch to the previous buffer and avoid special buffers.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:kill-real-buffer "defuns-buffers" "\
|
||||
Kill buffer (but only bury scratch buffer)
|
||||
|
||||
\(fn)" t nil)
|
||||
(autoload 'narf::save-session "defuns-buffers")
|
||||
(autoload 'narf::load-session "defuns-buffers")
|
||||
(autoload 'narf::new-workgroup "defuns-buffers")
|
||||
(autoload 'narf::rename-workgroup "defuns-buffers")
|
||||
(autoload 'narf::rename-this-file "defuns-buffers")
|
||||
(autoload 'narf::delete-this-file "defuns-buffers")
|
||||
(autoload 'narf::create-file "defuns-buffers")
|
||||
(autoload 'narf::scratch-buffer "defuns-buffers")
|
||||
(autoload 'narf::kill-buried-buffers "defuns-buffers")
|
||||
(autoload 'narf::kill-buffers "defuns-buffers")
|
||||
(autoload 'narf::cd "defuns-buffers")
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-code" "defuns-code.el" (21871 23781
|
||||
;;;;;; 0 0))
|
||||
;;; Generated autoloads from defuns-code.el
|
||||
|
||||
(autoload 'narf/set-build-command "defuns-code" "\
|
||||
|
||||
|
||||
\(fn COMMAND &optional FILE)" nil nil)
|
||||
(autoload 'narf::build "defuns-code")
|
||||
(autoload 'narf::eval "defuns-code")
|
||||
(autoload 'narf::eval-region "defuns-code")
|
||||
(autoload 'narf::eval-buffer "defuns-code")
|
||||
(autoload 'narf::eval-region-and-replace "defuns-code")
|
||||
|
||||
(autoload 'narf/get-interpreter "defuns-code" "\
|
||||
|
||||
|
||||
\(fn)" nil nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-debug" "defuns-debug.el" (21867 64619
|
||||
;;;;;; 0 0))
|
||||
;;; Generated autoloads from defuns-debug.el
|
||||
|
||||
(autoload 'what-face "defuns-debug" "\
|
||||
Tells you the name of the face (point) is on.
|
||||
|
||||
\(fn POS)" t nil)
|
||||
|
||||
(autoload 'what-col "defuns-debug" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'what-bindings "defuns-debug" "\
|
||||
|
||||
|
||||
\(fn KEY)" nil nil)
|
||||
(autoload 'narf::echo "defuns-debug")
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-edit" "defuns-edit.el" (21869 43444
|
||||
;;;;;; 0 0))
|
||||
;;; Generated autoloads from defuns-edit.el
|
||||
|
||||
(autoload 'narf:replace-ms-word-chars "defuns-edit" "\
|
||||
Replace smart quotes and other MS Word verbiage into plain text
|
||||
|
||||
\(fn BEG END)" t nil)
|
||||
|
||||
(autoload 'narf:replace-email2mailto "defuns-edit" "\
|
||||
Email address with mailto link
|
||||
|
||||
\(fn BEG END)" t nil)
|
||||
|
||||
(autoload 'narf:replace-url2anchor "defuns-edit" "\
|
||||
Link with anchor
|
||||
|
||||
\(fn BEG END)" t nil)
|
||||
|
||||
(autoload 'narf:goto-line "defuns-edit" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
(autoload 'narf::align "defuns-edit")
|
||||
(autoload 'narf::retab "defuns-edit")
|
||||
(autoload 'narf::narrow-indirect-or-widen "defuns-edit")
|
||||
|
||||
(autoload 'narf:toggle-delete-trailing-whitespace "defuns-edit" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-extern" "defuns-extern.el" (21869 43359
|
||||
;;;;;; 0 0))
|
||||
;;; Generated autoloads from defuns-extern.el
|
||||
|
||||
(autoload 'narf/tmux-send "defuns-extern" "\
|
||||
|
||||
|
||||
\(fn COMMAND)" nil nil)
|
||||
(autoload 'narf::tmux-run "defuns-extern")
|
||||
(autoload 'narf::tmux-chdir "defuns-extern")
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-mouse" "defuns-mouse.el" (21865 57645
|
||||
;;;;;; 0 0))
|
||||
;;; Generated autoloads from defuns-mouse.el
|
||||
|
||||
(autoload 'narf/mouse-line-at-click "defuns-mouse" "\
|
||||
Determine the line number at click
|
||||
|
||||
\(fn)" nil nil)
|
||||
|
||||
(autoload 'narf/mouse-select-line "defuns-mouse" "\
|
||||
Set point as *linum-mdown-line*
|
||||
|
||||
\(fn EVENT)" t nil)
|
||||
|
||||
(autoload 'narf/mouse-select-block "defuns-mouse" "\
|
||||
Select the current block of text between blank lines.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-org" "defuns-org.el" (21869 43512 0
|
||||
;;;;;; 0))
|
||||
;;; Generated autoloads from defuns-org.el
|
||||
|
||||
(autoload 'narf/project-org-filename "defuns-org" "\
|
||||
|
||||
|
||||
\(fn CAT)" t nil)
|
||||
|
||||
(autoload 'narf--org-in-list-p "defuns-org" "\
|
||||
|
||||
|
||||
\(fn)" nil nil)
|
||||
|
||||
(autoload 'narf/org-insert-item-after "defuns-org" "\
|
||||
Inserts a new heading or item, depending on the context.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf/org-insert-item-before "defuns-org" "\
|
||||
Inserts a new heading or item, depending on the context.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf/org-toggle-checkbox "defuns-org" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf/org-surround "defuns-org" "\
|
||||
|
||||
|
||||
\(fn DELIM)" nil nil)
|
||||
(autoload 'narf::org-insert-image-url "defuns-org")
|
||||
(autoload 'narf::org-insert-image "defuns-org")
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-search" "defuns-search.el" (21869 45131
|
||||
;;;;;; 0 0))
|
||||
;;; Generated autoloads from defuns-search.el
|
||||
|
||||
(autoload 'narf:ido-find-file "defuns-search" "\
|
||||
|
||||
|
||||
\(fn &optional DIR)" t nil)
|
||||
|
||||
(autoload 'narf:ido-find-file-other-window "defuns-search" "\
|
||||
|
||||
|
||||
\(fn &optional DIR)" t nil)
|
||||
|
||||
(autoload 'narf:ido-find-project-file "defuns-search" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
(autoload 'narf::initfiles "defuns-search")
|
||||
(autoload 'narf::notes "defuns-search")
|
||||
(autoload 'narf::recentf "defuns-search")
|
||||
(autoload 'narf::ag-search "defuns-search")
|
||||
(autoload 'narf::ag-regex-search "defuns-search")
|
||||
(autoload 'narf::ag-regex-cwd "defuns-search")
|
||||
(autoload 'narf::ag-regex-search-cwd "defuns-search")
|
||||
(autoload 'narf::swoop "defuns-search")
|
||||
(autoload 'narf::snippets "defuns-search")
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-text" "defuns-text.el" (21869 14495
|
||||
;;;;;; 0 0))
|
||||
;;; Generated autoloads from defuns-text.el
|
||||
|
||||
(autoload 'narf--point-at-bol-non-blank "defuns-text" "\
|
||||
|
||||
|
||||
\(fn)" nil nil)
|
||||
|
||||
(autoload 'narf/surrounded-p "defuns-text" "\
|
||||
|
||||
|
||||
\(fn)" nil nil)
|
||||
|
||||
(autoload 'narf:backward-kill-to-bol-and-indent "defuns-text" "\
|
||||
Kill line to the first non-blank character. If invoked again
|
||||
afterwards, kill line to column 1.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:move-to-bol "defuns-text" "\
|
||||
Moves cursor to the first non-blank character on the line. If
|
||||
already there, move it to the true bol.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:move-to-eol "defuns-text" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:backward-delete-whitespace-to-column "defuns-text" "\
|
||||
Delete back to the previous column of whitespace, or as much
|
||||
whitespace as possible, or just one char if that's not possible.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:dumb-indent "defuns-text" "\
|
||||
Inserts a tab character (or spaces x tab-width). Checks if the
|
||||
auto-complete window is open.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:inflate-space-maybe "defuns-text" "\
|
||||
Checks if point is surrounded by {} [] () delimiters and adds a
|
||||
space on either side of the point if so.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:deflate-space-maybe "defuns-text" "\
|
||||
Checks if point is surrounded by {} [] () delimiters, and deletes
|
||||
spaces on either side of the point if so. Resorts to
|
||||
`narf:backward-delete-whitespace-to-column' otherwise.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:newline-and-indent "defuns-text" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "defuns-ui" "defuns-ui.el" (21865 64034 0 0))
|
||||
;;; Generated autoloads from defuns-ui.el
|
||||
|
||||
(autoload 'narf:toggle-transparency "defuns-ui" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:toggle-fullscreen "defuns-ui" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload 'narf:toggle-big-mode "defuns-ui" "\
|
||||
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil nil ("../contrib/evil-ex-registers.el" "../contrib/flycheck-objc.el"
|
||||
;;;;;; "../contrib/ruby-mode-indent-fix.el" "../contrib/shaderlab-mode.el"
|
||||
;;;;;; "../contrib/unityjs-mode.el" "../init/autoloads.el" "../init/init-auto-insert.el"
|
||||
;;;;;; "../init/init-cc.el" "../init/init-cscope.el" "../init/init-csharp.el"
|
||||
;;;;;; "../init/init-data.el" "../init/init-eshell.el" "../init/init-fly.el"
|
||||
;;;;;; "../init/init-go.el" "../init/init-helm.el" "../init/init-ido.el"
|
||||
;;;;;; "../init/init-java.el" "../init/init-js.el" "../init/init-lisp.el"
|
||||
;;;;;; "../init/init-lua.el" "../init/init-org.el" "../init/init-php.el"
|
||||
;;;;;; "../init/init-project.el" "../init/init-python.el" "../init/init-r.el"
|
||||
;;;;;; "../init/init-regex.el" "../init/init-ruby.el" "../init/init-rust.el"
|
||||
;;;;;; "../init/init-scss.el" "../init/init-sh.el" "../init/init-swift.el"
|
||||
;;;;;; "../init/init-text.el" "../init/init-vc.el" "../init/init-vim.el"
|
||||
;;;;;; "../init/init-web.el" "../init/init-workgroups.el" "../init/init-yasnippet.el"
|
||||
;;;;;; "../init/narf-bindings.el" "../init/narf-commands.el" "../init/narf-settings.el"
|
||||
;;;;;; "benchmark.el" "core-company.el" "core-editor.el" "core-evil.el"
|
||||
;;;;;; "core-linux.el" "core-osx.el" "core-splash.el" "core-ui.el"
|
||||
;;;;;; "core.el" "defuns.el" "startup.el") (21873 3804 549513 0))
|
||||
|
||||
;;;***
|
||||
|
||||
(provide 'autoloads)
|
||||
;; Local Variables:
|
||||
;; version-control: never
|
||||
;; no-byte-compile: t
|
||||
;; no-update-autoloads: t
|
||||
;; coding: utf-8
|
||||
;; End:
|
||||
;;; autoloads.el ends here
|
|
@ -1,44 +0,0 @@
|
|||
(defvar require-times nil
|
||||
"A list of (FEATURE . LOAD-DURATION).
|
||||
LOAD-DURATION is the time taken in milliseconds to load FEATURE.")
|
||||
|
||||
(defadvice require
|
||||
(around build-require-times (feature &optional filename noerror) activate)
|
||||
"Note in `require-times' the time taken to require each feature."
|
||||
(let* ((already-loaded (memq feature features))
|
||||
(require-start-time (and (not already-loaded) (current-time))))
|
||||
(prog1
|
||||
ad-do-it
|
||||
(when (and (not already-loaded) (memq feature features))
|
||||
(add-to-list 'require-times
|
||||
(cons feature
|
||||
(float-time (time-subtract (current-time) require-start-time)))
|
||||
t)))))
|
||||
|
||||
(defun list-times ()
|
||||
(interactive)
|
||||
(let ((temp-buffer (get-buffer-create "*benchmark*"))
|
||||
(sum 0.0))
|
||||
(popwin:popup-buffer temp-buffer :stick t)
|
||||
(erase-buffer)
|
||||
(org-mode)
|
||||
(dolist (feature require-times)
|
||||
(if (eq feature 'null)
|
||||
(progn
|
||||
(insert "|----+----+----|\n")
|
||||
(insert (format "| %6f | Subtotal |\n" sum))
|
||||
(insert "|----+----+----|\n"))
|
||||
(let ((time (cdr feature)))
|
||||
(insert (format "| %6f | %s | %s |\n" time (car feature) (cond ((>= time 0.4) "XXX")
|
||||
((>= time 0.1) "X")
|
||||
((>= time 0.05) ".")
|
||||
(t " "))))
|
||||
(setq sum (+ sum time)))))
|
||||
(save-excursion
|
||||
(insert "|----+----+----|\n")
|
||||
(insert (format "| %6f | Total |\n" sum))
|
||||
(insert (format "| %s | On Init |\n" (emacs-init-time))))
|
||||
(org-table-align)))
|
||||
|
||||
|
||||
(provide 'benchmark)
|
|
@ -1,95 +0,0 @@
|
|||
(use-package company
|
||||
:diminish (company-mode . "=")
|
||||
:init
|
||||
(progn
|
||||
(defvar company-dictionary-alist '())
|
||||
(defvar company-dictionary-major-minor-modes '())
|
||||
(defvar company-dictionary-dir (concat BASE-DIR "dict/")))
|
||||
|
||||
(after "abbrev" (diminish 'abbrev-mode "A"))
|
||||
:config
|
||||
(progn
|
||||
(global-company-mode +1)
|
||||
(setq company-idle-delay nil
|
||||
company-minimum-prefix-length 1
|
||||
company-show-numbers nil
|
||||
company-tooltip-limit 20
|
||||
company-dabbrev-downcase nil
|
||||
company-dabbrev-ignore-case nil
|
||||
company-tooltip-align-annotations t
|
||||
company-require-match 'never
|
||||
company-global-modes
|
||||
'(not eshell-mode comint-mode org-mode erc-mode message-mode help-mode))
|
||||
|
||||
;; sort candidates by
|
||||
(setq-default company-frontends
|
||||
'(company-pseudo-tooltip-unless-just-one-frontend
|
||||
company-echo-metadata-frontend
|
||||
company-preview-if-just-one-frontend))
|
||||
|
||||
(progn ; Rewrite evil-complete to use company-dabbrev
|
||||
(setq company-dabbrev-code-other-buffers t)
|
||||
(setq company-dabbrev-code-buffers nil)
|
||||
(setq evil-complete-next-func
|
||||
(lambda(arg)
|
||||
(call-interactively 'company-dabbrev)
|
||||
(if (eq company-candidates-length 1)
|
||||
(company-complete))))
|
||||
(setq evil-complete-previous-func
|
||||
(lambda (arg)
|
||||
(let ((company-selection-wrap-around t))
|
||||
(call-interactively 'company-dabbrev)
|
||||
(if (eq company-candidates-length 1)
|
||||
(company-complete)
|
||||
(call-interactively 'company-select-previous))))))
|
||||
|
||||
(progn ; backends
|
||||
(setq-default company-backends (append '(company-dictionary company-keywords) company-backends))
|
||||
(add-to-list 'company-transformers 'company-sort-by-occurrence)
|
||||
(after "yasnippet"
|
||||
(setq-default company-backends (append '(company-capf company-yasnippet) company-backends)))
|
||||
|
||||
(defmacro narf/add-company-backend (hook backends)
|
||||
"Register a company backend for a mode."
|
||||
(let ((def-name (intern (format "narf--init-%s" hook))))
|
||||
`(progn
|
||||
(defun ,def-name ()
|
||||
(set (make-local-variable 'company-backends)
|
||||
(append '((,@backends company-semantic)) company-backends)))
|
||||
(add-hook ',(intern (format "%s-hook" hook)) ',def-name))))
|
||||
(narf/add-company-backend nxml-mode (company-nxml company-yasnippet))
|
||||
(narf/add-company-backend emacs-lisp-mode (company-elisp company-yasnippet))
|
||||
|
||||
|
||||
;; Simulates ac-source-dictionary (without global dictionary)
|
||||
(defun company-dictionary (command &optional arg &rest ignored)
|
||||
"`company-mode' back-end for user-provided dictionaries."
|
||||
(interactive (list 'interactive))
|
||||
(unless company-dictionary-alist
|
||||
;; initialize dictionary
|
||||
(dolist (file (f-files company-dictionary-dir))
|
||||
(add-to-list 'company-dictionary-alist `(,(intern (f-base file)) ,@(s-split "\n" (f-read file) t)))))
|
||||
(let ((dict (let ((minor-modes (-filter (lambda (mode) (when (boundp mode) (symbol-value mode)))
|
||||
company-dictionary-major-minor-modes))
|
||||
(dicts (cdr (assq major-mode company-dictionary-alist))))
|
||||
(dolist (mode minor-modes)
|
||||
(setq dicts (append dicts (cdr (assq mode company-dictionary-alist)))))
|
||||
dicts)))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-dictionary))
|
||||
(prefix (and dict (or (company-grab-symbol) 'stop)))
|
||||
(candidates
|
||||
(let ((completion-ignore-case nil)
|
||||
(symbols dict))
|
||||
(all-completions arg symbols)))
|
||||
(sorted t)))))
|
||||
|
||||
(use-package company-statistics
|
||||
:config
|
||||
(shut-up
|
||||
(setq company-statistics-file (expand-file-name "company-statistics-cache.el" TMP-DIR))
|
||||
(company-statistics-mode)))))
|
||||
|
||||
|
||||
(provide 'core-company)
|
||||
;;; core-company.el ends here
|
0
core/core-completion.el
Normal file
0
core/core-completion.el
Normal file
371
core/core-defuns.el
Normal file
371
core/core-defuns.el
Normal file
|
@ -0,0 +1,371 @@
|
|||
(! (defalias '@--concat-forms 'use-package-concat)
|
||||
(defalias '@--normalize-symbols 'use-package-normalize-symlist)
|
||||
(defalias '@--normalize-paths 'use-package-normalize-paths)
|
||||
|
||||
|
||||
;; Backwards compatible `with-eval-after-load'
|
||||
(unless (fboundp 'with-eval-after-load)
|
||||
(defmacro with-eval-after-load (file &rest body)
|
||||
`(eval-after-load ,file
|
||||
`(funcall (function ,(lambda () ,@body))))))
|
||||
|
||||
(defmacro @after (feature &rest forms)
|
||||
(declare (indent 1))
|
||||
`(,(if (or (not (boundp 'byte-compile-current-file))
|
||||
(not byte-compile-current-file)
|
||||
(if (symbolp feature)
|
||||
(require feature nil :no-error)
|
||||
(load feature :no-message :no-error)))
|
||||
'progn
|
||||
(message "after: cannot find %s" feature)
|
||||
'with-no-warnings)
|
||||
(with-eval-after-load ',feature ,@forms)))
|
||||
|
||||
(defmacro @shut-up (&rest body)
|
||||
"Silence message output from code."
|
||||
(declare (indent defun))
|
||||
`(let (message-log-max) ,@body (message "")))
|
||||
|
||||
(defmacro @ (args &rest body)
|
||||
"A shortcut for: `(lambda ,args ,@body)"
|
||||
`(lambda ,args ,@body))
|
||||
|
||||
(defmacro λ (&rest body)
|
||||
"A shortcut for: `(lambda () (interactive) ,@body)"
|
||||
`(lambda () (interactive) ,@body))
|
||||
|
||||
(defmacro @add-hook (hook &rest func-or-forms)
|
||||
"A convenience macro for `add-hook'.
|
||||
|
||||
HOOK can be one hook or a list of hooks. If the hook(s) are not quoted, -hook is
|
||||
appended to them automatically. If they are quoted, they are used verbatim.
|
||||
|
||||
FUNC-OR-FORMS can be one quoted symbol, a list of quoted symbols, or a series of
|
||||
forms. Forms will be wrapped in one lambda. A list of symbols will expand into a
|
||||
series of add-hook calls.
|
||||
|
||||
Examples:
|
||||
(@add-hook 'some-mode-hook 'enable-something)
|
||||
=> (add-hook 'some-mode-hook 'enable-something)
|
||||
|
||||
(@add-hook some-mode '(enable-something and-another))
|
||||
=> (add-hook 'some-mode-hook 'enable-something)
|
||||
(add-hook 'some-mode-hook 'and-another)
|
||||
|
||||
(@add-hook '(one-mode-hook second-mode-hook) 'enable-something)
|
||||
=> (add-hook 'one-mode-hook 'enable-something)
|
||||
(add-hook 'second-mode-hook 'enable-something)
|
||||
|
||||
(@add-hook (one-mode second-mode) 'enable-something)
|
||||
=> (add-hook 'one-mode-hook 'enable-something)
|
||||
(add-hook 'second-mode-hook 'enable-something)
|
||||
|
||||
(@add-hook (one-mode second-mode) (setq v 5) (setq a 2))
|
||||
=> (add-hook 'one-mode-hook (lambda () (setq v 5) (setq a 2)))
|
||||
(add-hook 'second-mode-hook (lambda () (setq v 5) (setq a 2)))"
|
||||
(declare (indent 1))
|
||||
(unless func-or-forms
|
||||
(error "@add-hook: FUNC-OR-FORMS is empty"))
|
||||
(let* ((val (car func-or-forms))
|
||||
(quoted (eq (car-safe hook) 'quote))
|
||||
(hook (if quoted (cadr hook) hook))
|
||||
(funcs (if (eq (car-safe val) 'quote)
|
||||
(if (cdr-safe (cadr val))
|
||||
(cadr val)
|
||||
(list (cadr val)))
|
||||
(list func-or-forms)))
|
||||
(forms '()))
|
||||
(mapc (@ (f)
|
||||
(let ((func (cond ((symbolp f) `(quote ,f))
|
||||
(t `(lambda () ,@func-or-forms)))))
|
||||
(mapc (@ (h)
|
||||
(push `(add-hook ',(if quoted h (intern (format "%s-hook" h))) ,func) forms))
|
||||
(if (listp hook) hook (list hook))))) funcs)
|
||||
`(progn ,@forms)))
|
||||
|
||||
(cl-defmacro @associate (mode &key in
|
||||
&key match
|
||||
&key files
|
||||
&allow-other-keys)
|
||||
"Associate a major or minor mode to certain patterns and project files."
|
||||
(let* ((minor-p (memq mode minor-mode-alist))
|
||||
(modes (@--normalize-symbols ":in" in)))
|
||||
(@--concat-forms
|
||||
(when match
|
||||
`(add-to-list ,(if minor-p 'narf-auto-minor-mode-alist 'auto-mode-alist)
|
||||
(cons ,match ,mode)))
|
||||
(when files
|
||||
`(defun ,(intern (format "narf|init-mode-%s" 'lb6-mode)) ()
|
||||
(when (and (assq major-mode '(,@(@--normalize-paths ":in" in)))
|
||||
(narf-project-has-files ,@(@--normalize-paths ":files" files)))
|
||||
(,mode 1)))))))
|
||||
|
||||
(@after evil
|
||||
;; Placeholders to correct binding indentation. Don't use these.
|
||||
(defmacro :leader (key &rest rest) (declare (indent 1)))
|
||||
(defmacro :localleader (key &rest rest) (declare (indent 1)))
|
||||
(defmacro :map (key &rest rest) (declare (indent 1)))
|
||||
(defmacro :after (key &rest rest) (declare (indent 1)))
|
||||
(defmacro :when (key &rest rest) (declare (indent 1)))
|
||||
|
||||
(macroexpand `(@map (:map my-map "C-k" 'hello :n "C-p" 'goodbye)))
|
||||
|
||||
(defmacro @map (&rest rest)
|
||||
(declare (indent defun))
|
||||
(let ((i 0)
|
||||
key def
|
||||
first-set
|
||||
prefix
|
||||
(default-keymaps '(narf-mode-map))
|
||||
(keymaps (if (boundp 'keymaps) keymaps))
|
||||
(states (if (boundp 'states) states '()))
|
||||
(forms (if (boundp 'forms) forms))
|
||||
(state-map '(("n" . normal)
|
||||
("v" . visual)
|
||||
("i" . insert)
|
||||
("e" . emacs)
|
||||
("o" . operator)
|
||||
("m" . motion)
|
||||
("r" . replace)
|
||||
("I" . iedit))))
|
||||
(unless keymaps
|
||||
(setq keymaps default-keymaps))
|
||||
(while rest
|
||||
(setq key (pop rest))
|
||||
(message ">>> KEY: %s" key)
|
||||
(add-to-list
|
||||
'forms
|
||||
(cond ((eq key '-)) ; skip this
|
||||
|
||||
((listp key) ; it's a sub exp
|
||||
(macroexpand `(@map ,@key)))
|
||||
|
||||
((keywordp key)
|
||||
(pcase key
|
||||
;; TODO: Data checks
|
||||
(:leader (setq prefix (kbd (pop rest))) nil)
|
||||
(:localleader (setq prefix (kbd (pop rest))) nil)
|
||||
(:prefix (setq prefix (kbd (pop rest)))
|
||||
(if (= i 0) (setq first-set `(:prefix . ,prefix)))
|
||||
nil)
|
||||
(:map (setq keymaps (-list (pop rest)))
|
||||
(if (= i 0) (setq first-set `(:map . ,keymaps)))
|
||||
nil)
|
||||
(:unset (prog1 `(@map ,(kbd (pop rest)) nil)))
|
||||
(:after (prog1 `(@after ,(pop rest) ,(macroexp-progn `(@map ,@rest))) (setq rest '())))
|
||||
(:when (prog1 `(when ,(pop rest) ,(macroexp-progn `(@map ,@rest))) (setq rest '())))
|
||||
(:unless (prog1 `(unless ,(pop rest) ,(macroexp-progn `(@map ,@rest))) (setq rest '())))
|
||||
(otherwise ; might be a state prefix
|
||||
(mapc (lambda (letter)
|
||||
(when (assoc letter state-map)
|
||||
(add-to-list 'states (cdr (assoc letter state-map)))))
|
||||
(s-split "" (substring (symbol-name key) 1) t)) nil)))
|
||||
|
||||
;; It's a key-def pair
|
||||
((or (stringp key)
|
||||
(characterp key)
|
||||
(vectorp key))
|
||||
|
||||
(when (stringp key)
|
||||
(setq key (kbd key)))
|
||||
(when prefix
|
||||
(cond ((vectorp key)
|
||||
(setq key (vconcat prefix key)))
|
||||
(t
|
||||
(setq key (concat prefix key)))))
|
||||
|
||||
(unless (car rest)
|
||||
(user-error "Map has no definition for %s" key))
|
||||
|
||||
(setq def (pop rest))
|
||||
(let ((first-key (car first-set))
|
||||
(first-value (cdr first-set))
|
||||
out-forms)
|
||||
(dolist (keymap keymaps)
|
||||
(if (not states)
|
||||
(add-to-list 'out-forms `(define-key ,keymap ,key ,def) t)
|
||||
(dolist (state states)
|
||||
(add-to-list 'out-forms `(define-key (evil-get-auxiliary-keymap ,keymap ,state t) ,key ,def) t))))
|
||||
|
||||
(setq prefix (if (eq first-key :prefix) first-value))
|
||||
(setq keymaps (if (eq first-key :map) first-value default-keymaps))
|
||||
(setq states '())
|
||||
out-forms))
|
||||
|
||||
(t (user-error "" key)))
|
||||
t)
|
||||
(cl-incf i))
|
||||
`(progn ,@(apply #'nconc (delete nil (delete (list nil) forms))))))
|
||||
|
||||
;; (defmacro @map (&rest keys)
|
||||
;; "A minimalistic and evil-centric way of binding keys. KEYS is
|
||||
;;made up of either:
|
||||
;;
|
||||
;;1. Any of the following keywords:
|
||||
;;
|
||||
;;:when CONDITION
|
||||
;;:unless CONDITION
|
||||
;;:prefix PREFIX Key(s) to prefix keymappings with
|
||||
;;:map KEYMAP Keymaps to bind keys to. Can be a list.
|
||||
;;:global Tags these keymaps for the global keymap
|
||||
;;:local Ditto, but for local keymap
|
||||
;;
|
||||
;;
|
||||
;;2. A key (as a vector e.g. [escape], a string \"<escape>\", or
|
||||
;;character ?\^?).
|
||||
;;
|
||||
;;3. A key definition: a symbol or a lambda function. "
|
||||
;; (declare (indent defun))
|
||||
;; (let* ((keymaps (-list map))
|
||||
;; (states (-list in))
|
||||
;; (forms '())
|
||||
;; item def)
|
||||
;; (while keys
|
||||
;; (setq item (pop keys))
|
||||
;; (cond ((keywordp item)
|
||||
;; (let ((val (pop keys)))
|
||||
;; (pcase item
|
||||
;; (:after)
|
||||
;; (:when)
|
||||
;; (:unless)
|
||||
;; (:keymap)
|
||||
;; (:in)
|
||||
;; (otherwise)
|
||||
;; )
|
||||
;; ))
|
||||
;;
|
||||
;; ((or (and (symbolp item)
|
||||
;; (evil-state-p item))
|
||||
;; (and (listp item)
|
||||
;; (--all? (evil-state-p it) item)))
|
||||
;; (setq states (-list item)))
|
||||
;;
|
||||
;; ;; item-definition pairs
|
||||
;; ((consp item)
|
||||
;; (let ((def (cdr item))
|
||||
;; (item (car item)))
|
||||
;; (message "k %s : d %s" item def)
|
||||
;;
|
||||
;; ;;(or (stringp item)
|
||||
;; ;; (vectorp item)
|
||||
;; ;; (characterp item))
|
||||
;; ;;(unless items (signal 'bind-no-definition item))
|
||||
;; ;;(setq def (pop items))
|
||||
;; (when condition
|
||||
;; ;; Process the item
|
||||
;; (cond ((stringp item) (setq item (kbd item)))
|
||||
;; ((characterp item) (setq item (string item))))
|
||||
;; (when prefix
|
||||
;; (setq item (if (vectorp item)
|
||||
;; (vconcat prefix item)
|
||||
;; (concat (kbd prefix) item))))
|
||||
;; ;; Do the binding
|
||||
;; `(,@(if (null states)
|
||||
;; (push (mapcar
|
||||
;; (lambda (keymap) `(define-key ,keymap ,item ,def)) keymaps)
|
||||
;; forms)
|
||||
;; (push (mapcar (lambda (state)
|
||||
;; (mapcar (lambda (keymap)
|
||||
;; `(define-key (evil-get-auxiliary-keymap ,keymap ',state t) ,item ,def))
|
||||
;; keymaps))
|
||||
;; states) forms))))))
|
||||
;;
|
||||
;; ;; fallback
|
||||
;; (t (signal 'bind-invalid-key key)))
|
||||
;; `(progn ,@forms))))
|
||||
|
||||
(defmacro @exmap (command func)
|
||||
(evil-ex-define-cmd
|
||||
,command
|
||||
,(cond ((autoloadp (symbol-function `,func))
|
||||
`(lambda () (interactive) (call-interactively ,func)))
|
||||
((symbolp `,func) func)
|
||||
(t (user-error "Command for %s is invalid" command)))))))
|
||||
|
||||
|
||||
;; Hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defun narf|enable-comment-hard-wrap ()
|
||||
(set (make-local-variable 'comment-auto-fill-only-comments) t)
|
||||
(turn-on-auto-fill))
|
||||
|
||||
(defun narf|enable-hard-wrap ()
|
||||
(turn-on-auto-fill))
|
||||
|
||||
(defun narf|enable-tab-width-2 ()
|
||||
(setq tab-width 2 evil-shift-width 2))
|
||||
|
||||
(defun narf|enable-tab-width-4 ()
|
||||
(setq tab-width 4 evil-shift-width 4))
|
||||
|
||||
(defun narf|disable-final-newline ()
|
||||
(set (make-local-variable 'require-final-newline) nil))
|
||||
|
||||
(defun narf|enable-tabs ()
|
||||
(setq indent-tabs-mode t))
|
||||
|
||||
(defun narf|disable-tabs ()
|
||||
(setq indent-tabs-mode nil))
|
||||
|
||||
(defun narf|disable-delete-trailing-whitespace ()
|
||||
(remove-hook 'before-save-hook 'delete-trailing-whitespace))
|
||||
|
||||
(defun narf|update-scratch-buffer-cwd () ; see core-editor.el
|
||||
"Make sure scratch buffer is always 'in a project.'"
|
||||
(let ((dir (narf-project-root)))
|
||||
(with-current-buffer (get-buffer-create "*scratch*")
|
||||
(cd dir))))
|
||||
|
||||
|
||||
;;;; Global Defuns ;;;;;;;;;;;;;;;;;;;;;
|
||||
(defun narf-minibuffer-quit ()
|
||||
"Abort recursive edit. In Delete Selection mode, if the mark is
|
||||
active, just deactivate it; then it takes a second \\[keyboard-quit]
|
||||
to abort the minibuffer."
|
||||
(interactive)
|
||||
(let (message-log-max)
|
||||
(if (and delete-selection-mode transient-mark-mode mark-active)
|
||||
(setq deactivate-mark t)
|
||||
(when (get-buffer "*Completions*")
|
||||
(delete-windows-on "*Completions*"))
|
||||
(abort-recursive-edit))))
|
||||
|
||||
|
||||
;;;; Project defuns ;;;;;;;;;;;;;;;;;;;;
|
||||
(defun narf-project-root (&optional strict-p)
|
||||
"Get the path to the root of your project. Uses `narf-project-root-files' to
|
||||
determine if a directory is a project."
|
||||
(let ((home (file-truename "~")))
|
||||
(catch 'found
|
||||
(f-traverse-upwards
|
||||
(lambda (path)
|
||||
(let ((path (file-truename path)))
|
||||
(if (file-equal-p home path)
|
||||
(throw 'found (if strict-p nil default-directory))
|
||||
(dolist (file narf-project-root-files)
|
||||
(when (file-exists-p (expand-file-name file path))
|
||||
(throw 'found path)))))) default-directory)
|
||||
default-directory)))
|
||||
|
||||
(defun narf-project-has-files (files &optional root)
|
||||
"Return non-nil if `file' exists in the project root."
|
||||
(let ((root (or root (narf-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 (file-exists-p (narf-project-path-to file root))))
|
||||
found-p))
|
||||
|
||||
(defun narf-project-path-to (file &optional root)
|
||||
(let ((root (or root (narf-project-root))))
|
||||
(expand-file-name file root)))
|
||||
|
||||
(defun narf-project-name (&optional root)
|
||||
(file-name-nondirectory (directory-file-name (or root (narf-project-root)))))
|
||||
|
||||
(defun narf-project-p ()
|
||||
(not (null (narf-project-root t))))
|
||||
|
||||
|
||||
(provide 'core-defuns)
|
||||
;;; core-defuns.el ends here
|
|
@ -1,62 +1,193 @@
|
|||
;;; Global editor behavior
|
||||
|
||||
(electric-indent-mode -1)
|
||||
(setq electric-indent-chars '(? ?: ?{))
|
||||
(add-hook 'python-mode-hook 'electric-indent-local-mode)
|
||||
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
|
||||
(add-hook! 'eldoc-mode-hook (diminish 'eldoc-mode " ?"))
|
||||
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
||||
(setq-default
|
||||
;; spaces instead of tabs
|
||||
indent-tabs-mode nil
|
||||
tab-always-indent t
|
||||
tab-width 4
|
||||
|
||||
(setq-default fill-column 80)
|
||||
(diminish 'auto-fill-function)
|
||||
;; Sane scroll settings
|
||||
(setq scroll-margin 5
|
||||
scroll-conservatively 9999
|
||||
scroll-preserve-screen-position t)
|
||||
;; I'll use visual mode, kthxbai
|
||||
(setq shift-select-mode nil)
|
||||
require-final-newline t
|
||||
delete-trailing-lines 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)
|
||||
fill-column 80
|
||||
|
||||
(add-hook 'help-mode-hook 'visual-line-mode)
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
(add-hook 'makefile-mode-hook 'narf|enable-tabs) ; Use normal tabs in makefiles
|
||||
;; Sane scroll settings
|
||||
scroll-margin 5
|
||||
scroll-conservatively 9999
|
||||
scroll-preserve-screen-position t
|
||||
|
||||
(after "isearch" (diminish 'isearch-mode))
|
||||
shift-select-mode nil
|
||||
|
||||
whitespace-style '(trailing face tabs tab-mark)
|
||||
whitespace-display-mappings
|
||||
'((tab-mark ?\t [?| ?\t] [?\\ ?\t])
|
||||
(newline-mark 10 [36 10]))
|
||||
|
||||
truncate-lines t ; do not soft-wrap lines
|
||||
truncate-partial-width-windows nil)
|
||||
|
||||
|
||||
;; Modes 'n hooks ;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(@associate text-mode :match "/LICENSE[^/]*$")
|
||||
(@associate sh-mode :match "zsh\\(env\\|rc\\)?$")
|
||||
(@associate sh-mode :match "z\\(profile\\|login\\|logout\\)?$")
|
||||
(@associate sh-mode :match "zsh/")
|
||||
(@associate applescript-mode :match "\\.applescript$")
|
||||
(@associate emacs-lisp-mode :match "Cask$")
|
||||
(@associate emacs-lisp-mode :match "\\.el\\.gz$")
|
||||
(@associate makefile-gmake-mode :match "/Makefile$")
|
||||
(@associate nxml-mode :match "\\.plist$")
|
||||
|
||||
(@add-hook help-mode 'visual-line-mode)
|
||||
(@add-hook python-mode 'electric-indent-local-mode)
|
||||
(@add-hook emacs-lisp-mode 'turn-on-eldoc-mode)
|
||||
(@add-hook eldoc-mode (diminish 'eldoc-mode " ?"))
|
||||
(@add-hook makefile-mode 'narf|enable-tabs) ; Use normal tabs in makefiles
|
||||
|
||||
;; Fix code folding
|
||||
;; (defun narf|init-hs-minor-mode-maybe ()
|
||||
;; (unless (bound-and-true-p hs-minor-mode)
|
||||
;; (hs-minor-mode 1)
|
||||
;; (diminish 'hs-minor-mode)))
|
||||
;; (add-hook 'prog-mode-hook 'narf|init-hs-minor-mode-maybe)
|
||||
;; (@add-hook prog-mode (unless (bound-and-true-p hs-minor-mode)
|
||||
;; (hs-minor-mode 1)
|
||||
;; (diminish 'hs-minor-mode)))
|
||||
|
||||
(@add-hook find-file 'narf|update-scratch-buffer-cwd)
|
||||
;; (add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
|
||||
;; If file is oversized...
|
||||
(@add-hook find-file (when (> (buffer-size) (* 1024 1024))
|
||||
(setq buffer-read-only t)
|
||||
(buffer-disable-undo)
|
||||
(fundamental-mode)
|
||||
(visual-line-mode)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; (global-whitespace-mode 1) ; Show whitespace
|
||||
(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)
|
||||
(winner-mode 1) ; window config undo/redo
|
||||
|
||||
|
||||
;; Automatic minor modes ;;;;;;;;;;;
|
||||
|
||||
(defvar narf/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 narf|enable-minor-mode-maybe ()
|
||||
"Check file name against `narf/auto-minor-mode-alist'."
|
||||
(when buffer-file-name
|
||||
(let ((name buffer-file-name)
|
||||
(remote-id (file-remote-p buffer-file-name))
|
||||
(alist narf/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 'narf|enable-minor-mode-maybe)
|
||||
|
||||
|
||||
;; Plugins ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-package ace-jump-mode
|
||||
:functions (ace-jump-char-category ace-jump-do)
|
||||
:commands (ace-jump-line-mode ace-jump-char-mode
|
||||
ace-jump-word-mode ace-jump-two-chars-mode)
|
||||
:init (setq ace-jump-mode-scope 'window
|
||||
ace-jump-mode-gray-background t)
|
||||
:config
|
||||
(defun ace-jump-two-chars-mode (&optional query-char query-char-2)
|
||||
"AceJump two chars mode"
|
||||
(interactive)
|
||||
|
||||
(evil-half-cursor)
|
||||
(setq query-char (or query-char (read-char ">")))
|
||||
(setq query-char-2 (or query-char-2 (read-char (concat ">" (string query-char)))))
|
||||
(if (eq (ace-jump-char-category query-char) 'other)
|
||||
(error "[AceJump] Non-printable character"))
|
||||
|
||||
;; others : digit , alpha, punc
|
||||
(setq ace-jump-query-char query-char)
|
||||
(setq ace-jump-current-mode 'ace-jump-char-mode)
|
||||
(ace-jump-do (regexp-quote (concat (char-to-string query-char)
|
||||
(char-to-string query-char-2))))))
|
||||
|
||||
(use-package ace-link
|
||||
:commands
|
||||
(ace-link-info ace-link-help ace-link-compilation ace-link-custom ace-link-org)
|
||||
:init
|
||||
(after "help-mode"
|
||||
(bind motion :map help-mode-map "go" 'ace-link-help))
|
||||
(after "compile"
|
||||
(bind motion :map compilation-mode-map "go" 'ace-link-compilation))
|
||||
(after "info"
|
||||
(bind motion :map Info-mode-map "go" 'ace-link-info))
|
||||
(after "org"
|
||||
(bind motion :map org-mode-map "go" 'ace-link-org)))
|
||||
|
||||
(use-package ace-window
|
||||
:commands ace-window
|
||||
:config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
||||
aw-scope 'frame
|
||||
aw-background nil))
|
||||
|
||||
;; (use-package emr
|
||||
;; :commands (emr-initialize emr-show-refactor-menu emr-declare-command)
|
||||
;; :bind (:map popup-menu-keymap [escape] 'keyboard-quit))
|
||||
|
||||
(use-package expand-region
|
||||
:commands (er/expand-region er/contract-region er/mark-symbol er/mark-word))
|
||||
|
||||
(use-package goto-last-change :defer 3)
|
||||
|
||||
(use-package hl-todo
|
||||
:commands hl-todo-mode
|
||||
:init
|
||||
(@add-hook prog-mode 'hl-todo-mode)
|
||||
(defvar hl-todo-keyword-faces)
|
||||
'(("\\(\\bTODO\\((.*)\\)?:?\\)" . "#cc9393")
|
||||
("\\(\\bNOTE\\((.*)\\)?:?\\)" . "#d0bf8f")
|
||||
("\\(\\bFIXME\\((.*)\\)?:?\\)" . "#cc9393")))
|
||||
|
||||
(use-package hideshow
|
||||
:diminish hs-minor-mode
|
||||
:init (@add-hook (prog-mode org-mode) 'hs-minor-mode))
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:commands rainbow-delimiters-mode
|
||||
:init (@add-hook (emacs-lisp-mode js2-mode scss-mode) 'rainbow-delimiters-mode)
|
||||
:config (setq rainbow-delimiters-outermost-only-face-count 1))
|
||||
|
||||
(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 smartparens
|
||||
:diminish smartparens-mode
|
||||
:commands smartparens-global-mode
|
||||
:init (@add-init-hook evil-insert-state-entry 'smartparens-global-mode)
|
||||
:config
|
||||
(progn
|
||||
(use-package smartparens-config)
|
||||
(smartparens-global-mode 1)
|
||||
|
||||
(setq blink-matching-paren t
|
||||
sp-autowrap-region nil ; let evil-surround handle this
|
||||
sp-autowrap-region nil ; let evil-surround handle this
|
||||
sp-highlight-pair-overlay nil
|
||||
sp-show-pair-delay 0)
|
||||
|
||||
(use-package smartparens-config)
|
||||
|
||||
;; 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))
|
||||
|
@ -73,89 +204,19 @@
|
|||
(sp-with-modes '(c-mode c++-mode php-mode java-mode)
|
||||
(sp-local-pair "/*" "" :post-handlers '((" ||\n[i]*/" "RET"))))
|
||||
|
||||
(after "yasnippet" (advice-add 'yas-expand :before 'sp-remove-active-pair-overlay))))
|
||||
(after "yasnippet"
|
||||
(advice-add 'yas-expand :before '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 er/mark-symbol er/mark-word))
|
||||
|
||||
(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 emr-declare-command)
|
||||
:config (bind :map popup-menu-keymap [escape] 'keyboard-quit))
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:commands rainbow-delimiters-mode
|
||||
:init (add-to-hooks 'rainbow-delimiters-mode '(emacs-lisp-mode js2-mode scss-mode))
|
||||
:config (setq rainbow-delimiters-outermost-only-face-count 1))
|
||||
|
||||
(use-package ace-window
|
||||
:commands ace-window
|
||||
(use-package smex
|
||||
:commands (smex smex-major-mode-commands smex-initialize smex-update)
|
||||
:init (setq smex-save-file (! (expand-file-name "smex-items" TMP-DIR)))
|
||||
:config
|
||||
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
||||
aw-scope 'frame
|
||||
aw-background nil))
|
||||
(smex-initialize)
|
||||
|
||||
(use-package ace-jump-mode
|
||||
:functions (ace-jump-char-category ace-jump-do)
|
||||
:commands (ace-jump-line-mode
|
||||
ace-jump-char-mode
|
||||
ace-jump-word-mode
|
||||
ace-jump-two-chars-mode)
|
||||
:config
|
||||
(progn
|
||||
(defun ace-jump-two-chars-mode (&optional query-char query-char-2)
|
||||
"AceJump two chars mode"
|
||||
(interactive)
|
||||
|
||||
(evil-half-cursor)
|
||||
(setq query-char (or query-char (read-char ">")))
|
||||
(setq query-char-2 (or query-char-2 (read-char (concat ">" (string query-char)))))
|
||||
|
||||
(if (eq (ace-jump-char-category query-char) 'other)
|
||||
(error "[AceJump] Non-printable character"))
|
||||
|
||||
;; others : digit , alpha, punc
|
||||
(setq ace-jump-query-char query-char)
|
||||
(setq ace-jump-current-mode 'ace-jump-char-mode)
|
||||
(ace-jump-do (regexp-quote (concat (char-to-string query-char)
|
||||
(char-to-string query-char-2)))))
|
||||
(setq ace-jump-mode-scope 'window
|
||||
ace-jump-mode-gray-background t)))
|
||||
|
||||
(use-package ace-link
|
||||
:commands (ace-link-info
|
||||
ace-link-help
|
||||
ace-link-compilation
|
||||
ace-link-custom
|
||||
ace-link-org)
|
||||
:init
|
||||
(progn
|
||||
(after "help-mode"
|
||||
(bind motion :map help-mode-map "go" 'ace-link-help))
|
||||
(after "compile"
|
||||
(bind motion :map compilation-mode-map "go" 'ace-link-compilation))
|
||||
(after "info"
|
||||
(bind motion :map Info-mode-map "go" 'ace-link-info))
|
||||
(after "org"
|
||||
(bind motion :map org-mode-map "go" 'ace-link-org))))
|
||||
|
||||
(use-package quickrun
|
||||
:commands (quickrun
|
||||
quickrun-region
|
||||
quickrun-with-arg
|
||||
quickrun-shell
|
||||
quickrun-compile-only
|
||||
quickrun-replace-region
|
||||
helm-quickrun))
|
||||
;; 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))
|
||||
|
||||
|
||||
(provide 'core-editor)
|
||||
|
|
|
@ -1,303 +1,261 @@
|
|||
;;;; Eeeeeeevil ;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; core-evil.el --- the root of all evil
|
||||
|
||||
(use-package evil
|
||||
:init
|
||||
(progn
|
||||
(use-package goto-last-change)
|
||||
;; highlight matching delimiters where it's important
|
||||
(defun show-paren-mode-off () (show-paren-mode -1))
|
||||
(@add-hook evil-insert-state-entry 'show-paren-mode)
|
||||
(@add-hook evil-insert-state-exit 'show-paren-mode-off)
|
||||
(@add-hook evil-visual-state-entry 'show-paren-mode)
|
||||
(@add-hook evil-visual-state-exit 'show-paren-mode-off)
|
||||
(@add-hook evil-motion-state-entry 'show-paren-mode)
|
||||
(@add-hook evil-motion-state-exit 'show-paren-mode-off)
|
||||
(@add-hook evil-operator-state-entry 'show-paren-mode)
|
||||
(@add-hook evil-operator-state-exit 'show-paren-mode-off)
|
||||
|
||||
;; highlight matching delimiters where it's important
|
||||
(defun show-paren-mode-off () (show-paren-mode -1))
|
||||
(add-hook 'evil-insert-state-entry-hook 'show-paren-mode)
|
||||
(add-hook 'evil-insert-state-exit-hook 'show-paren-mode-off)
|
||||
(add-hook 'evil-visual-state-entry-hook 'show-paren-mode)
|
||||
(add-hook 'evil-visual-state-exit-hook 'show-paren-mode-off)
|
||||
(add-hook 'evil-motion-state-entry-hook 'show-paren-mode)
|
||||
(add-hook 'evil-motion-state-exit-hook 'show-paren-mode-off)
|
||||
(add-hook 'evil-operator-state-entry-hook 'show-paren-mode)
|
||||
(add-hook 'evil-operator-state-exit-hook 'show-paren-mode-off)
|
||||
;; Disable highlights on insert-mode
|
||||
(@add-hook evil-insert-state-entry 'evil-ex-nohighlight)
|
||||
|
||||
;; Disable highlights on insert-mode
|
||||
(add-hook 'evil-insert-state-entry-hook 'evil-ex-nohighlight)
|
||||
|
||||
(add-hook! 'undo-tree-mode-hook (diminish 'undo-tree-mode))
|
||||
;; Always ensure evil-shift-width is consistent with tab-width
|
||||
(add-hook! 'evil-local-mode-hook (setq evil-shift-width tab-width)))
|
||||
(@add-hook undo-tree-mode (diminish 'undo-tree-mode))
|
||||
;; Always ensure evil-shift-width is consistent with tab-width
|
||||
(@add-hook evil-local-mode (setq evil-shift-width tab-width))
|
||||
:config
|
||||
(progn
|
||||
(progn ; open/close fold mods
|
||||
;; Instead of `evil-open-folds'. Accepts COUNT for dictating fold level.
|
||||
(evil-define-command narf:open-folds (count)
|
||||
(interactive "P")
|
||||
(if count (hs-hide-level count) (evil-open-folds)))
|
||||
(setq evil-magic t
|
||||
evil-want-C-u-scroll t ; enable C-u for scrolling
|
||||
evil-ex-visual-char-range t ; column range for ex commands
|
||||
evil-want-fine-undo nil
|
||||
evil-want-visual-char-semi-exclusive nil
|
||||
evil-ex-search-vim-style-regexp t
|
||||
evil-ex-interactive-search-highlight 'selected-window
|
||||
|
||||
;; Instead of `evil-close-folds'. Accepts COUNT for dictating fold level.
|
||||
(evil-define-command narf:close-folds (count)
|
||||
(interactive "P")
|
||||
(if count (hs-hide-level count) (evil-close-folds))))
|
||||
;; Color-coded state cursors
|
||||
evil-normal-state-cursor '("white" box)
|
||||
evil-emacs-state-cursor '("cyan" bar)
|
||||
evil-insert-state-cursor '("white" bar)
|
||||
evil-visual-state-cursor '("white" hollow)
|
||||
evil-iedit-state-cursor '("orange" box))
|
||||
|
||||
(setq evil-magic t
|
||||
evil-want-C-u-scroll t ; enable C-u for scrolling
|
||||
evil-ex-visual-char-range t ; column range for ex commands
|
||||
evil-want-fine-undo nil
|
||||
evil-want-visual-char-semi-exclusive nil
|
||||
evil-ex-search-vim-style-regexp t
|
||||
evil-ex-interactive-search-highlight 'selected-window
|
||||
(evil-mode 1)
|
||||
(evil-select-search-module 'evil-search-module 'evil-search)
|
||||
(add-to-list 'evil-overriding-maps 'narf-mode-map)
|
||||
|
||||
;; Color-coded state cursors
|
||||
evil-normal-state-cursor '("white" box)
|
||||
evil-emacs-state-cursor '("cyan" bar)
|
||||
evil-insert-state-cursor '("white" bar)
|
||||
evil-visual-state-cursor '("white" hollow)
|
||||
evil-iedit-state-cursor '("orange" box))
|
||||
(defadvice evil-ex-hl-do-update-highlight (around evil-ex-hl-shut-up activate)
|
||||
"Silence 'Error running timer `evil-ex-hl-do-update-highlight': (error
|
||||
\"Invalid use of `\\' in replacement text\") errors.
|
||||
|
||||
(add-to-list 'evil-overriding-maps '(narf-mode-map))
|
||||
(evil-mode 1)
|
||||
(evil-select-search-module 'evil-search-module 'evil-search)
|
||||
See `https://bitbucket.org/lyro/evil/issue/527'"
|
||||
(ignore-errors ad-do-it))
|
||||
|
||||
(defadvice evil-ex-hl-do-update-highlight (around evil-ex-hl-shut-up activate)
|
||||
(ignore-errors ad-do-it))
|
||||
;; modes to map to different default states
|
||||
(dolist (mode-map '((cider-repl-mode . emacs)
|
||||
(comint-mode . emacs)
|
||||
(term-mode . emacs)
|
||||
(fundamental-mode . normal)
|
||||
(help-mode . normal)
|
||||
(message-mode . normal)
|
||||
(compilation-mode . normal)))
|
||||
(evil-set-initial-state `,(car mode-map) `,(cdr mode-map)))
|
||||
|
||||
;; modes to map to different default states
|
||||
(dolist (mode-map '((cider-repl-mode . emacs)
|
||||
(comint-mode . emacs)
|
||||
(fundamental-mode . normal)
|
||||
(help-mode . normal)
|
||||
(term-mode . emacs)
|
||||
(message-mode . normal)
|
||||
(compilation-mode . normal)))
|
||||
(evil-set-initial-state `,(car mode-map) `,(cdr mode-map)))
|
||||
(progn ; evil plugins
|
||||
(use-package evil-anzu)
|
||||
|
||||
;; Ace Jump
|
||||
;; https://github.com/winterTTr/ace-jump-mode/issues/23
|
||||
(evil-define-motion evil-ace-jump-two-chars-mode (count)
|
||||
:type exclusive
|
||||
:repeat abort
|
||||
(evil-without-repeat
|
||||
(evil-enclose-ace-jump-for-motion
|
||||
(call-interactively 'ace-jump-two-chars-mode))))
|
||||
(use-package evil-commentary
|
||||
:diminish evil-commentary-mode
|
||||
:commands (evil-commentary
|
||||
evil-commentary-mode
|
||||
evil-commentary-yank
|
||||
evil-commentary-line)
|
||||
:config (evil-commentary-mode 1))
|
||||
|
||||
(progn ; evil helpers
|
||||
(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))))
|
||||
(use-package evil-ex-registers
|
||||
:commands (evil-get-spec-register
|
||||
evil-ex-paste-from-register))
|
||||
|
||||
(progn ; evil plugins
|
||||
(use-package evil-anzu)
|
||||
(use-package evil-exchange
|
||||
:commands evil-exchange
|
||||
:config
|
||||
(defadvice evil-force-normal-state (before evil-esc-quit-exchange activate)
|
||||
"Remove `evil-exchange' overlays on ESC"
|
||||
(when evil-exchange--overlays (evil-exchange-cancel))))
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(if (iedit-current-occurrence-string)
|
||||
(progn
|
||||
(save-excursion (iedit-restrict-region (region-beginning) (region-end)))
|
||||
(evil-previous-line)
|
||||
(evil-iedit-state/iedit-mode))
|
||||
(call-interactively 'evil-ret)))
|
||||
(use-package evil-iedit-state
|
||||
:functions (iedit-current-occurrence-string iedit-restrict-region)
|
||||
:commands (evil-iedit-state evil-iedit-state/iedit-mode)
|
||||
:config
|
||||
(@map ; Don't interfere with evil-snipe
|
||||
:I :unset "s"
|
||||
:I :unset "S"
|
||||
|
||||
(use-package evil-iedit-state
|
||||
:functions (iedit-current-occurrence-string iedit-restrict-region)
|
||||
:commands (evil-iedit-state evil-iedit-state/iedit-mode)
|
||||
:config
|
||||
(progn
|
||||
(bind :map evil-iedit-state-map ; Don't interfere with evil-snipe
|
||||
"s" nil
|
||||
"S" nil)
|
||||
(bind iedit
|
||||
"V" 'evil-visual-line
|
||||
"C" 'evil-iedit-state/substitute ; instead of s/S
|
||||
"za" 'iedit-toggle-unmatched-lines-visible
|
||||
:I "V" 'evil-visual-line
|
||||
:I "C" 'evil-iedit-state/substitute ; instead of s/S
|
||||
:I "za" 'iedit-toggle-unmatched-lines-visible
|
||||
|
||||
visual "SPC" (λ (if (iedit-current-occurrence-string)
|
||||
(let ((current-prefix-arg '(4)))
|
||||
(iedit-done)
|
||||
(call-interactively 'iedit-mode)
|
||||
(save-excursion (iedit-restrict-region (region-beginning) (region-end)))
|
||||
(evil-previous-line))
|
||||
(call-interactively 'evil-ret))))))
|
||||
:v "SPC" (λ (if (iedit-current-occurrence-string)
|
||||
(progn
|
||||
(save-excursion (iedit-restrict-region (region-beginning) (region-end)))
|
||||
(evil-previous-line)
|
||||
(evil-iedit-state/iedit-mode))
|
||||
(call-interactively 'evil-ret)))))
|
||||
|
||||
(use-package evil-indent-textobject
|
||||
:commands (evil-indent-i-indent
|
||||
evil-indent-a-indent
|
||||
evil-indent-a-indent-lines)
|
||||
:init
|
||||
(@map :map evil-inner-text-objects-map
|
||||
"i" 'evil-indent-i-indent
|
||||
"i" 'evil-indent-a-indent
|
||||
"I" 'evil-indent-a-indent-lines))
|
||||
|
||||
(use-package evil-search-highlight-persist
|
||||
:config (global-evil-search-highlight-persist t))
|
||||
(use-package evil-jumper
|
||||
:init
|
||||
(setq evil-jumper-file (! (expand-file-name "jumplist" narf-temp-dir))
|
||||
evil-jumper-auto-center t
|
||||
evil-jumper-auto-save-interval 3600))
|
||||
|
||||
(use-package evil-indent-textobject ; vii/vai/vaI
|
||||
:commands (evil-indent-i-indent
|
||||
evil-indent-a-indent
|
||||
evil-indent-a-indent-lines)
|
||||
:init
|
||||
(bind :map evil-inner-text-objects-map
|
||||
"i" 'evil-indent-i-indent
|
||||
"i" 'evil-indent-a-indent
|
||||
"I" 'evil-indent-a-indent-lines))
|
||||
(use-package evil-matchit
|
||||
:commands (evilmi-jump-items global-evil-matchit-mode)
|
||||
:config (global-evil-matchit-mode 1))
|
||||
|
||||
(use-package evil-ex-registers
|
||||
:commands (evil-get-spec-register
|
||||
evil-ex-paste-from-register))
|
||||
(use-package evil-numbers
|
||||
:commands (evil-numbers/inc-at-pt
|
||||
evil-numbers/dec-at-pt))
|
||||
|
||||
(use-package evil-surround
|
||||
:commands (global-evil-surround-mode
|
||||
evil-surround-edit
|
||||
evil-Surround-edit
|
||||
evil-surround-region)
|
||||
:config
|
||||
(progn
|
||||
(evil-define-motion evil-surround-line (count)
|
||||
"Move COUNT - 1 lines down but return exclusive character motion."
|
||||
:type exclusive
|
||||
(let ((beg (line-beginning-position)))
|
||||
(evil-line count)
|
||||
(end-of-line)
|
||||
(let ((range (evil-range beg (point) 'exclusive)))
|
||||
(evil-expand-range range)
|
||||
range)))
|
||||
(use-package evil-search-highlight-persist
|
||||
:config (global-evil-search-highlight-persist t))
|
||||
|
||||
;; Escaped surround characters
|
||||
(defun evil-surround-escaped ()
|
||||
(let* ((char (string (read-char "\\")))
|
||||
(pair (cond ((string-match "[]})[{(]" char)
|
||||
(let ((-pair (cdr (assoc (string-to-char char) evil-surround-pairs-alist))))
|
||||
`(,(car -pair) . ,(cdr -pair))))
|
||||
(t
|
||||
`(,char . ,char))))
|
||||
(format (if (sp-point-in-string) "\\\\%s" "\\%s")))
|
||||
(cons (format format (car pair))
|
||||
(format format (cdr pair)))))
|
||||
(use-package evil-snipe
|
||||
:diminish evil-snipe-mode
|
||||
:commands (evil-snipe-s evil-snipe-S
|
||||
evil-snipe-x evil-snipe-X
|
||||
evil-snipe-f evil-snipe-F
|
||||
evil-snipe-t evil-snipe-T)
|
||||
:init
|
||||
(setq-default
|
||||
evil-snipe-smart-case t
|
||||
evil-snipe-scope 'line
|
||||
evil-snipe-repeat-scope 'buffer
|
||||
evil-snipe-override-evil-repeat-keys nil
|
||||
evil-snipe-symbol-groups '((?\[ "[[{(]")
|
||||
(?\] "[]})]")))
|
||||
:config
|
||||
(evil-snipe-mode 1)
|
||||
(evil-snipe-override-mode 1))
|
||||
|
||||
(global-evil-surround-mode 1)
|
||||
(use-package evil-space
|
||||
:diminish (evil-space-mode . "_")
|
||||
:config
|
||||
(progn
|
||||
(add-to-list 'evil-overriding-maps 'evil-space-mode-map)
|
||||
|
||||
(push '(?\C-\[ . ("" . "")) evil-surround-pairs-alist)))
|
||||
(evil-space-setup "/" "n" "N")
|
||||
(evil-space-setup "?" "N" "n")
|
||||
|
||||
(use-package evil-numbers
|
||||
:commands (evil-numbers/inc-at-pt
|
||||
evil-numbers/dec-at-pt))
|
||||
(@after evil-numbers
|
||||
(let ((map (evil-get-auxiliary-keymap narf-mode-map 'normal)))
|
||||
(evil-space-setup "g=" "g=" "g-" map)
|
||||
(evil-space-setup "g-" "g-" "g=" map)))
|
||||
|
||||
(use-package evil-matchit
|
||||
:commands (evilmi-jump-items global-evil-matchit-mode)
|
||||
:config (global-evil-matchit-mode 1))
|
||||
(@after evil-snipe
|
||||
(let ((map (evil-get-auxiliary-keymap evil-snipe-override-mode-map 'motion)))
|
||||
(evil-space-setup "t" "C-;" "C-," map)
|
||||
(evil-space-setup "f" "C-;" "C-," map)
|
||||
(evil-space-setup "T" "C-," "C-;" map)
|
||||
(evil-space-setup "F" "C-," "C-;" map))
|
||||
(let ((map (evil-get-auxiliary-keymap evil-snipe-mode-map 'motion)))
|
||||
(evil-space-setup "s" "C-;" "C-," map)
|
||||
(evil-space-setup "S" "C-," "C-;" map)))
|
||||
|
||||
(use-package evil-commentary
|
||||
:diminish evil-commentary-mode
|
||||
:commands (evil-commentary
|
||||
evil-commentary-mode
|
||||
evil-commentary-yank
|
||||
evil-commentary-line)
|
||||
:config (evil-commentary-mode 1))
|
||||
(@after evil-visualstar
|
||||
(let ((map (evil-get-auxiliary-keymap evil-visualstar-mode-map 'visual)))
|
||||
(evil-space-setup "*" "n" "N" map)
|
||||
(evil-space-setup "#" "n" "N" map)))
|
||||
|
||||
(use-package evil-jumper
|
||||
:init (setq evil-jumper-file (expand-file-name "jumplist" TMP-DIR))
|
||||
:config
|
||||
(setq evil-jumper-auto-center t
|
||||
evil-jumper-auto-save-interval 3600))
|
||||
(evil-space-mode)))
|
||||
|
||||
(use-package evil-exchange
|
||||
:commands evil-exchange
|
||||
:config
|
||||
(defadvice evil-force-normal-state (before evil-esc-quit-exchange activate)
|
||||
(when evil-exchange--overlays (evil-exchange-cancel))))
|
||||
(use-package evil-surround
|
||||
:commands (global-evil-surround-mode
|
||||
evil-surround-edit
|
||||
evil-Surround-edit
|
||||
evil-surround-region)
|
||||
:config
|
||||
(global-evil-surround-mode 1)
|
||||
|
||||
(use-package evil-visualstar
|
||||
:commands (global-evil-visualstar-mode
|
||||
evil-visualstar/begin-search-forward
|
||||
evil-visualstar/begin-search-backward)
|
||||
:config
|
||||
(global-evil-visualstar-mode 1))
|
||||
;; Escaped surround characters
|
||||
(defun evil-surround-escaped ()
|
||||
(let* ((char (string (read-char "\\")))
|
||||
(pair (cond ((string-match "[]})[{(]" char)
|
||||
(let ((-pair (cdr (assoc (string-to-char char) evil-surround-pairs-alist))))
|
||||
`(,(car -pair) . ,(cdr -pair))))
|
||||
(t
|
||||
`(,char . ,char))))
|
||||
(format (if (sp-point-in-string) "\\\\%s" "\\%s")))
|
||||
(cons (format format (car pair))
|
||||
(format format (cdr pair)))))
|
||||
|
||||
(use-package evil-snipe
|
||||
:diminish evil-snipe-mode
|
||||
:init
|
||||
(setq evil-snipe-smart-case t
|
||||
evil-snipe-scope 'line
|
||||
evil-snipe-repeat-scope 'buffer
|
||||
evil-snipe-symbol-groups '((?\[ "[[{(]")
|
||||
(?\] "[]})]")))
|
||||
:config
|
||||
(progn
|
||||
(evil-snipe-mode 1)
|
||||
(evil-snipe-override-mode 1)
|
||||
(push '(?\\ . evil-surround-escaped) evil-surround-pairs-alist))
|
||||
|
||||
(bind motion :map evil-snipe-mode-map
|
||||
"C-;" 'evil-snipe-repeat
|
||||
"C-," 'evil-snipe-repeat-reverse)))
|
||||
(use-package evil-visualstar
|
||||
:commands (global-evil-visualstar-mode
|
||||
evil-visualstar/begin-search
|
||||
evil-visualstar/begin-search-forward
|
||||
evil-visualstar/begin-search-backward)
|
||||
:config
|
||||
;; I cut this down because the original visualstar wouldn't remember
|
||||
;; the last search if evil-search-module was 'evil-search.
|
||||
(defun narf/evil-visualstar/begin-search (beg end direction)
|
||||
(when (evil-visual-state-p)
|
||||
(evil-exit-visual-state)
|
||||
(let ((selection (regexp-quote (buffer-substring-no-properties beg end))))
|
||||
(setq isearch-forward direction)
|
||||
(evil-search selection direction t))))
|
||||
(advice-add 'evil-visualstar/begin-search :override 'narf/evil-visualstar/begin-search)
|
||||
|
||||
(use-package evil-space
|
||||
:diminish (evil-space-mode . "_")
|
||||
:config
|
||||
(progn
|
||||
(evil-space-mode 1)
|
||||
(global-evil-visualstar-mode 1)))
|
||||
|
||||
(evil-space-setup "/" "n" "N")
|
||||
(evil-space-setup "?" "n" "N")
|
||||
(progn ; evil hacks
|
||||
(defadvice evil-force-normal-state (before evil-esc-quit activate)
|
||||
(ignore-errors
|
||||
(popwin:close-popup-window) ; close popups, if any
|
||||
(evil-search-highlight-persist-remove-all) ; turn off highlights
|
||||
(evil-ex-nohighlight)
|
||||
;; Exit minibuffer if alive
|
||||
(if (minibuffer-window-active-p (minibuffer-window))
|
||||
(narf/minibuffer-quit))))
|
||||
|
||||
(after "evil-snipe"
|
||||
(evil-space-setup evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(evil-space-setup evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(evil-space-setup evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(evil-space-setup evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(evil-space-setup evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(evil-space-setup evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse))
|
||||
;; Jump to new splits
|
||||
(defadvice evil-window-split (after evil-window-split-jump activate)
|
||||
(evil-window-down 1))
|
||||
(defadvice evil-window-vsplit (after evil-window-vsplit-jump activate)
|
||||
(evil-window-right 1))
|
||||
|
||||
(after "evil-numbers"
|
||||
(let ((map (evil-get-auxiliary-keymap narf-mode-map 'normal)))
|
||||
(evil-space-setup "g=" "g=" "g-" map)
|
||||
(evil-space-setup "g-" "g-" "g=" map)))
|
||||
(@after isearch ; Restore vimmish ex-mode keymaps to isearch
|
||||
;; Hide keystroke display while isearch is active
|
||||
(@add-hook isearch-mode (setq echo-keystrokes 0))
|
||||
(@add-hook isearch-mode-end (setq echo-keystrokes 0.02))
|
||||
(@map :map isearch-mode-map
|
||||
:unset "C-r"
|
||||
|
||||
(after "evil-visualstar"
|
||||
(let ((map (evil-get-auxiliary-keymap evil-visualstar-mode-map 'visual)))
|
||||
(evil-space-setup "*" "*" "#" map)
|
||||
(evil-space-setup "#" "#" "*" map))))))
|
||||
"C-r %" (λ (narf:isearch-paste-from-register ?%))
|
||||
"C-r #" (λ (narf:isearch-paste-from-register ?#))
|
||||
"C-r /" (λ (narf:isearch-paste-from-register ?/))
|
||||
"C-r :" (λ (narf:isearch-paste-from-register ?:))
|
||||
"C-r ." (λ (narf:isearch-paste-from-register ?.))
|
||||
"C-r -" (λ (narf:isearch-paste-from-register ?-))
|
||||
"C-r _" (λ (narf:isearch-paste-from-register ?_))
|
||||
"C-r =" (λ (narf:isearch-paste-from-register ?=))
|
||||
"C-r +" 'narf:isearch-paste-from-clipboard
|
||||
|
||||
(progn ; evil hacks
|
||||
(defadvice evil-force-normal-state (before evil-esc-quit activate)
|
||||
(ignore-errors
|
||||
(popwin:close-popup-window) ; close popups, if any
|
||||
(evil-search-highlight-persist-remove-all) ; turn off highlights
|
||||
(evil-ex-nohighlight)
|
||||
;; Exit minibuffer if alive
|
||||
(if (minibuffer-window-active-p (minibuffer-window))
|
||||
(narf/minibuffer-quit))))
|
||||
|
||||
;; Jump to new splits
|
||||
(defadvice evil-window-split (after evil-window-split-jump activate)
|
||||
(evil-window-down 1))
|
||||
(defadvice evil-window-vsplit (after evil-window-vsplit-jump activate)
|
||||
(evil-window-right 1))
|
||||
|
||||
(progn ; Restore vimmish ex-mode keymaps to isearch
|
||||
(defun narf:isearch-delete-word ()
|
||||
(interactive)
|
||||
(let ((num (length isearch-string))
|
||||
(string (s-reverse isearch-string)))
|
||||
(when (string-match "[^a-zA-Z0-9]" string 1)
|
||||
(setq num (match-beginning 0)))
|
||||
(dotimes (i num)
|
||||
(isearch-pop-state))
|
||||
(isearch-update)))
|
||||
|
||||
(defun narf:isearch-delete-line ()
|
||||
(interactive)
|
||||
(let ((num (length isearch-string)))
|
||||
(dotimes (i num) (isearch-pop-state))
|
||||
(isearch-update)))
|
||||
|
||||
(defun narf:isearch-paste-from-register (reg)
|
||||
(interactive)
|
||||
(let ((str (evil-get-register reg t)))
|
||||
(when (> (length str) 0)
|
||||
(isearch-yank-string str))))
|
||||
|
||||
(defun narf:isearch-paste-from-clipboard ()
|
||||
(interactive)
|
||||
(narf:isearch-paste-from-register ?+))
|
||||
|
||||
;; Hide keystroke display while isearch is active
|
||||
(add-hook! 'isearch-mode-hook (setq echo-keystrokes 0))
|
||||
(add-hook! 'isearch-mode-end-hook (setq echo-keystrokes 0.02))
|
||||
|
||||
(bind :map isearch-mode-map
|
||||
"C-r" nil
|
||||
|
||||
"C-r %" (λ (narf:isearch-paste-from-register ?%))
|
||||
"C-r #" (λ (narf:isearch-paste-from-register ?#))
|
||||
"C-r /" (λ (narf:isearch-paste-from-register ?/))
|
||||
"C-r :" (λ (narf:isearch-paste-from-register ?:))
|
||||
"C-r ." (λ (narf:isearch-paste-from-register ?.))
|
||||
"C-r -" (λ (narf:isearch-paste-from-register ?-))
|
||||
"C-r _" (λ (narf:isearch-paste-from-register ?_))
|
||||
"C-r =" (λ (narf:isearch-paste-from-register ?=))
|
||||
"C-r +" 'narf:isearch-paste-from-clipboard
|
||||
|
||||
"C-w" 'narf:isearch-delete-word
|
||||
"C-u" 'narf:isearch-delete-line
|
||||
"M-v" 'narf:isearch-paste-from-clipboard)))))
|
||||
"C-w" 'narf:isearch-delete-word
|
||||
"C-u" 'narf:isearch-delete-line
|
||||
"M-v" 'narf:isearch-paste-from-clipboard))))
|
||||
|
||||
|
||||
(provide 'core-evil)
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
(provide 'core-linux)
|
||||
|
||||
;; Nothing here yet
|
9
core/core-os-linux.el
Normal file
9
core/core-os-linux.el
Normal file
|
@ -0,0 +1,9 @@
|
|||
;;; core-os-linux.el --- Debian-specific settings
|
||||
|
||||
(defun narf-open-with (&optional app-name path)
|
||||
(interactive)
|
||||
(error "Not yet implemented"))
|
||||
|
||||
|
||||
(provide 'core-os-linux)
|
||||
;;; core-os-linux.el ends here
|
|
@ -1,4 +1,4 @@
|
|||
;; Mac-specific settings
|
||||
;;; core-os-osx.el --- Mac-specific settings
|
||||
|
||||
;; Use a shared clipboard
|
||||
(setq x-select-enable-clipboard t
|
||||
|
@ -13,18 +13,15 @@
|
|||
;; fix emacs PATH on OSX (GUI only)
|
||||
(when window-system
|
||||
(setenv "SHELL" "/usr/local/bin/zsh")
|
||||
(setenv "EMACS" "1")
|
||||
(setenv "EMACS" "1") ; make sure the world knows
|
||||
|
||||
(defmacro narf/init-exec-path ()
|
||||
"Initialize shell path via `exec-path-from-shell'."
|
||||
(require 'exec-path-from-shell)
|
||||
(exec-path-from-shell-initialize)
|
||||
`(setq exec-path ',exec-path))
|
||||
(setq exec-path (! (require 'exec-path-from-shell)
|
||||
(exec-path-from-shell-initialize)
|
||||
exec-path)))
|
||||
|
||||
(narf/init-exec-path))
|
||||
;; OSX Related Plugins ;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-package applescript-mode
|
||||
:mode "\\.applescript$")
|
||||
(use-package applescript-mode :mode "\\.applescript$")
|
||||
|
||||
(use-package dash-at-point
|
||||
:commands (dash-at-point dash-at-point-with-docset)
|
||||
|
@ -32,7 +29,9 @@
|
|||
(add-to-list 'dash-at-point-mode-alist
|
||||
'(java-mode . "java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc")))
|
||||
|
||||
(after "evil"
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(@after evil
|
||||
(when (featurep 'ns)
|
||||
;; On OSX, stop copying each visual state move to the clipboard:
|
||||
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
|
||||
|
@ -42,7 +41,7 @@
|
|||
(unless (featurep 'ns) ad-do-it))))
|
||||
|
||||
;; Send current file to OSX apps
|
||||
(defun narf:osx-open-with (&optional app-name path)
|
||||
(defun narf-open-with (&optional app-name path)
|
||||
(interactive)
|
||||
(let* ((path (f-full (s-replace "'" "\\'" (or path (if (eq major-mode 'dired-mode) (dired-get-file-for-visit) (buffer-file-name))))))
|
||||
(command (concat "open " (when app-name (concat "-a " (shell-quote-argument app-name))) " '" path "'")))
|
||||
|
@ -50,5 +49,5 @@
|
|||
(shell-command command)))
|
||||
|
||||
|
||||
(provide 'core-osx)
|
||||
;;; core-osx.el ends here
|
||||
(provide 'core-os-osx)
|
||||
;;; core-os-osx.el ends here
|
9
core/core-os-win32.el
Normal file
9
core/core-os-win32.el
Normal file
|
@ -0,0 +1,9 @@
|
|||
;;; core-os-win32.el --- Windows-specific settings
|
||||
|
||||
(defun narf-open-with (&optional app-name path)
|
||||
(interactive)
|
||||
(error "Not yet implemented"))
|
||||
|
||||
|
||||
(provide 'core-os-win32)
|
||||
;;; core-os-win32.el ends here
|
|
@ -1,145 +0,0 @@
|
|||
|
||||
(define-derived-mode narf-splash-mode special-mode "NARF"
|
||||
"Splash screen for Narf emacs.")
|
||||
|
||||
(defun narf/splash-init ()
|
||||
)
|
||||
|
||||
(defun narf/random-comeback ()
|
||||
(let ((replies '("I think so, Brain, but where are we going to find a duck and a hose at this hour?"
|
||||
"I think so, but where will we find an open tattoo parlor at this time of night?"
|
||||
"Wuh, I think so, Brain, but if we didn't have ears, we'd look like weasels."
|
||||
"Uh... yeah, Brain, but where are we going to find rubber pants our size?"
|
||||
"Uh, I think so, Brain, but balancing a family and a career ... ooh, it's all too much for me."
|
||||
"Wuh, I think so, Brain, but isn't Regis Philbin already married?"
|
||||
"Wuh, I think so, Brain, but burlap chafes me so."
|
||||
"Sure, Brain, but how are we going to find chaps our size?"
|
||||
"Uh, I think so, Brain, but we'll never get a monkey to use dental floss."
|
||||
"Are you pondering cheesesticks?"
|
||||
"Uh, I think so Brain, but this time, you wear the tutu."
|
||||
"I think so, Brain, but culottes have a tendency to ride up so."
|
||||
"I think so, Brain, but if we covered the world in salad dressing wouldn't the aspargus feel left out?"
|
||||
"I think so, Brain, but if they called them 'Sad Meals', kids wouldn't buy them!"
|
||||
"I think so, Brain, but me and Pippi Longstocking -- I mean, what would the children look like?"
|
||||
"I think so, Brain, but what would Pippi Longstocking look like with her hair straight?"
|
||||
"I think so, Brain, but this time you put the trousers on the chimp."
|
||||
"Well, I think so, Brain, but I can't memorize a whole opera in Yiddish."
|
||||
"I think so, Brain, but there's still a bug stuck in here from last time."
|
||||
"Uh, I think so, Brain, but I get all clammy inside the tent."
|
||||
"I think so, Brain, but I don't think Kaye Ballard's in the union."
|
||||
"I think so, Brain, but, the Rockettes? I mean, it's mostly girls, isn't it?"
|
||||
"I think so, Brain, but pants with horizontal stripes make me look chubby."
|
||||
"Well, I think so -POIT- but where do you stick the feather and call it macaroni?"
|
||||
"Well, I think so, Brain, but pantyhose are so uncomfortable in the summertime."
|
||||
"Well, I think so, Brain, but it's a miracle that this one grew back."
|
||||
"Well, I think so, Brain, but first you'd have to take that whole bridge apart, wouldn't you?"
|
||||
"Well, I think so, Brain, but 'apply North Pole' to what?"
|
||||
"I think so, Brain, but 'Snowball for Windows'?"
|
||||
"Well, I think so, Brain, but snort no, no, it's too stupid!"
|
||||
"Umm, I think so, Don Cerebro, but, umm, why would Sophia Loren do a musical?"
|
||||
"Umm, I think so, Brain, but what if the chicken won't wear the nylons?"
|
||||
"I think so, Brain, but isn't that why they invented tube socks?"
|
||||
"Well, I think so Brain, but what if we stick to the seat covers?"
|
||||
"I think so Brain, but if you replace the 'P' with an 'O', my name would be Oinky, wouldn't it?"
|
||||
"Oooh, I think so Brain, but I think I'd rather eat the Macarena."
|
||||
"Well, I think so hiccup, but Kevin Costner with an English accent?"
|
||||
"I think so, Brain, but don't you need a swimming pool to play Marco Polo?"
|
||||
"Well, I think so, Brain, but do I really need two tongues?"
|
||||
"I think so, Brain, but we're already naked."
|
||||
"Well, I think so, Brain, but if Jimmy cracks corn, and no one cares, why does he keep doing it?"
|
||||
"I think so, Brain NARF, but don't camels spit a lot?"
|
||||
"I think so, Brain, but how will we get a pair of Abe Vigoda's pants?"
|
||||
"I think so, Brain, but Pete Rose? I mean, can we trust him?"
|
||||
"I think so, Brain, but why would Peter Bogdanovich?"
|
||||
"I think so, Brain, but isn't a cucumber that small called a gherkin?"
|
||||
"I think so, Brain, but if we get Sam Spade, we'll never have any puppies."
|
||||
"I think so, Larry, and um, Brain, but how can we get seven dwarves to shave their legs?"
|
||||
"I think so, Brain, but calling it pu-pu platter? Huh, what were they thinking?"
|
||||
"I think so, Brain, but how will we get the Spice Girls into the paella?"
|
||||
"I think so, Brain, but if we give peas a chance, won't the lima beans feel left out?"
|
||||
"I think so, Brain, but I am running for mayor of Donkeytown and Tuesdays are booked."
|
||||
"I think so, Brain, but if we had a snowmobile, wouldn't it melt before summer?"
|
||||
"I think so, Brain, but what kind of rides do they have in Fabioland?"
|
||||
"I think so, Brain, but can the Gummi Worms really live in peace with the Marshmallow Chicks?"
|
||||
"Wuh, I think so, Brain, but wouldn't anything lose its flavor on the bedpost overnight?"
|
||||
"I think so, Brain, but three round meals a day wouldn't be as hard to swallow."
|
||||
"I think so, Brain, but if the plural of mouse is mice, wouldn't the plural of spouse be spice?"
|
||||
"Umm, I think so, Brain, but three men in a tub? Ooh, that's unsanitary!"
|
||||
"Yes, but why does the chicken cross the road, huh, if not for love? I do not know."
|
||||
"Wuh, I think so, Brain, but I prefer Space Jelly."
|
||||
"Yes Brain, but if our knees bent the other way, how would we ride a bicycle?"
|
||||
"Wuh, I think so, Brain, but how will we get three pink flamingos into one pair of Capri pants?"
|
||||
"I think so, Brain, but Tuesday Weld isn't a complete sentence."
|
||||
"I think so, Brain, but why would anyone want to see Snow White and the Seven Samurai?"
|
||||
"I think so, Brain, but wouldn't mustard make it sting?"
|
||||
"I think so, Brain, but can you use the word 'asphalt' in polite society?"
|
||||
"I think so, Mr. Brain, but if the sun'll come out tomorrow, what's it doing right now?"
|
||||
"I think so, Brain, but aren't we out of shaving cream?"
|
||||
"Oh yes, Brain! Remind me to tape all our phone calls!"
|
||||
"Um, I think so, Brain, but I hear Hillary is the jealous type."
|
||||
"I think so, Brain, but Madonna's stock is sinking."
|
||||
"I think so, Brain. But does 'Chunk o' Cheesy's' deliver packing material?"
|
||||
"I think so, Brainwulf, but if we're Danish, where's the cream cheese? Narf!"
|
||||
"I think so, Bwain, but I don't think newspaper will fit in my underoos."
|
||||
"Uh, I think so, Brain--but after eating newspaper all day, do I really need the extra fiber?"
|
||||
"I think so, Brain! But isn't a dreadlock hair extension awfully expensive?"
|
||||
"I think so, Brain. But will anyone other than Eskimos buy blubber-flavored chewing gum?"
|
||||
"I think so, Brain, but the ointment expired weeks ago!"
|
||||
"Uh, I think so Brain, but how are we gonna teach a goat to dance with flippers on?"
|
||||
"Wuhh... I think so, Brain! But let's use safflower oil this time! It's ever so much healthier!"
|
||||
"Wuh... I think so, Brain. But Cream of Gorilla Soup—well, we'd have to sell it in awfully big cans, wouldn't we?"
|
||||
"I think so, Brain. But if he left chocolate bullets instead of silver, they'd get all runny and gooey!"
|
||||
"Yes, Brain, I think so, but do nuts go with pudding?"
|
||||
"I think so, Brain, but a codpiece made from a real fish would get smelly after a while, wouldn’t it?"
|
||||
"I think... so, Brain... *gag* ...but I didn't know Annette used peanut butter in that way."
|
||||
"I think so, Brain, but do those roost in this neighborhood?"
|
||||
"I think so, Brain, but is the world ready for angora bellbottoms? I mean I can see wearing them inside out, but that would--"
|
||||
"I think so, Commander Brain from Outer Space! But do we have time to grease the rockets?"
|
||||
"I think so, Doctor. But are these really the legs of a show girl?"
|
||||
"Whuh... I think so, Brain. But this time I get to play the dishwasher repairman!"
|
||||
"I think so, Brainius. But what if a sudden wind were to blow up my toga?"
|
||||
"I think so, Brain. But Trojans won’t arrive on the scene for another 300 years."
|
||||
"I think so, Brain... but where would a yak put PVC tubing?"
|
||||
"Whuh... I think so, Brain, but... but if Charlton Heston doesn't eat Soylent Green, what will he eat?"
|
||||
"I think so, Brain, but would Danish flies work just as well?"
|
||||
"We think so, Brain! But dressing like twins is so tacky."
|
||||
"I think so, Brain, but practicing docking procedures with a goat at zero G's—it's never been done!"
|
||||
"I think so, Brain! But shouldn't we let the silk worms finish the boxer shorts before we put them on?"
|
||||
"I think so, Brain! You draw the bath and I'll fetch the alka-seltzers and candles!"
|
||||
"I think so, Brain. But the real trick will be getting Demi Moore out of the creamed corn!"
|
||||
"Wuhhh... I think so, Brain, but if a ham can operate a radio, why can't a pig set a VCR?"
|
||||
"I think so, Brain, you'd think [Lyndon Johnson would] have left room for baby-kissing, wouldn't you?"
|
||||
"I think so, Brain! But won't Mr. Hoover notice a missing evening gown?"
|
||||
"I think so, Brain! But what's the use of having a heart-shaped tattoo if it's going to be covered by hair?"
|
||||
"I think so, Brain, but couldn't the constant use of a henna rinse lead to premature baldness?"
|
||||
"I think so, Brain. Just make sure we don't swallow each other's bubbles!"
|
||||
"I think so, Brain! But ruby-studded stockings would be mighty uncomfortable wouldn't they?"
|
||||
"I think so, Brain, but if I have my portrait drawn, will we have time to make it to the lifeboats?"
|
||||
"I think so, Brain! But is Chippendale's ready for 'The Full Pinky?'"
|
||||
"I think so, Brain! But do I have what it take to be the 'Lord of the Dance'?"
|
||||
"I think so, Brain! How much deeper would the ocean be if there weren't sponges down there?"
|
||||
"Oh, I think so, Brain! But doing a clog dance in actual clogs will give me awful blisters."
|
||||
"I think so, Brain, but nose rings are kinda passé by now."
|
||||
"I think so, Brain, but where are we going to get a trained octopus at this time of night?"
|
||||
"I think so, Brain! But no more eels in jelly for me, thanks—I like my gelatin after lunch."
|
||||
"I think so, Brain, but I didn’t know 90210 was a real zip code! Will Tori be there?"
|
||||
"I think so, Brain. But if Pinocchio were carved out of bacon it wouldn't be the same story, would it?"
|
||||
"Um, I think so, Brain, but wasn't Dicky Ducky released on his own recognaissance?"
|
||||
"I think so, Brain, but Pepper Ann makes me sneeze."
|
||||
"I think so, Brain. But suppose we do the hokey pokey and turn ourselves around, is that what it's really all about?"
|
||||
"I think so, Brain, but just how will we get the weasel to hold still?"
|
||||
"I think so, Brain, but how are we going to get the bacon flavoring into the pencils?"
|
||||
"I think so, Brain, but instant karma's always so lumpy."
|
||||
)))
|
||||
(nth (random (length replies)) replies)))
|
||||
|
||||
;; TODO: Move this to external file
|
||||
(add-hook 'after-init-hook
|
||||
(lambda () (setq initial-scratch-message
|
||||
(format "\n\n\n\n NARF!\n Emacs: %s\n\n >> Loaded in %s\n >>> %s"
|
||||
emacs-version
|
||||
(emacs-init-time)
|
||||
(narf/random-comeback)))))
|
||||
|
||||
(provide 'core-splash)
|
||||
;;; core-splash.el ends here
|
336
core/core-ui.el
336
core/core-ui.el
|
@ -1,6 +1,9 @@
|
|||
;;; core-ui.el -- User interface layout & behavior
|
||||
;;; core-ui.el --- interface settings
|
||||
|
||||
(when (fboundp 'fringe-mode) (fringe-mode '(2 . 8)))
|
||||
(when window-system ; more informative window title
|
||||
(setq frame-title-format '(buffer-file-name "%f" ("%b"))))
|
||||
|
||||
|
||||
;; theme and GUI elements are loaded in init.el early
|
||||
(setq show-paren-delay 0)
|
||||
|
@ -18,199 +21,180 @@
|
|||
(setq-default
|
||||
cursor-in-non-selected-windows nil
|
||||
visible-bell nil ; silence of the bells
|
||||
use-dialog-box nil ; avoid GUI
|
||||
use-dialog-box nil ; avoid GUI
|
||||
redisplay-dont-pause t
|
||||
;; do not soft-wrap lines
|
||||
truncate-lines t
|
||||
truncate-partial-width-windows nil
|
||||
indicate-buffer-boundaries nil
|
||||
indicate-empty-lines nil
|
||||
fringes-outside-margins t)
|
||||
fringes-outside-margins t) ; fringes on the other side of line numbers
|
||||
|
||||
(use-package nlinum
|
||||
:commands nlinum-mode
|
||||
:init
|
||||
(progn
|
||||
(defface linum '((t (:inherit default)))
|
||||
"Face for line numbers"
|
||||
:group 'nlinum-mode)
|
||||
(defface linum-highlight-face '((t (:inherit linum)))
|
||||
"Face for line highlights"
|
||||
:group 'nlinum-mode)
|
||||
|
||||
;; Preset width nlinum
|
||||
(add-hook! 'nlinum-mode-hook
|
||||
(setq nlinum--width (length (number-to-string (count-lines (point-min)
|
||||
(point-max))))))
|
||||
|
||||
;; Highlight line number
|
||||
(defvar narf--hl-nlinum-overlay nil)
|
||||
(defvar narf--hl-nlinum-line nil)
|
||||
(defun narf/nlinum-unhl-line ()
|
||||
(when narf--hl-nlinum-overlay
|
||||
(let* ((ov narf--hl-nlinum-overlay)
|
||||
(disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
||||
(str (nth 1 disp)))
|
||||
(put-text-property 0 (length str) 'face 'linum str)
|
||||
(setq narf--hl-nlinum-overlay nil
|
||||
narf--hl-nlinum-line nil))))
|
||||
|
||||
(defun narf/nlinum-hl-line (&optional line)
|
||||
(let ((line-no (or line (line-number-at-pos (point)))))
|
||||
(when (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
||||
(let* ((pbol (if line (save-excursion (goto-char (point-min))
|
||||
(forward-line line-no)
|
||||
(point-at-bol))
|
||||
(point-at-bol)))
|
||||
(peol (1+ pbol)))
|
||||
;; Handle EOF case
|
||||
(when (>= peol (point-max))
|
||||
(setq peol (point-max)))
|
||||
(jit-lock-fontify-now pbol peol)
|
||||
(let* ((overlays (overlays-in pbol peol))
|
||||
(ov (-first (lambda (item) (overlay-get item 'nlinum)) overlays)))
|
||||
(when ov
|
||||
(narf/nlinum-unhl-line)
|
||||
(let* ((disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
||||
(str (nth 1 disp)))
|
||||
(put-text-property 0 (length str) 'face 'linum-highlight-face str)
|
||||
(put-text-property 0 (length str) 'face 'linum-highlight-face str)
|
||||
(setq narf--hl-nlinum-overlay ov
|
||||
narf--hl-nlinum-line line-no))))))))
|
||||
|
||||
(defun narf:nlinum-toggle ()
|
||||
(interactive)
|
||||
(if nlinum-mode
|
||||
(narf/nlinum-disable)
|
||||
(narf/nlinum-enable)))
|
||||
(defun narf/nlinum-enable ()
|
||||
(nlinum-mode +1)
|
||||
(add-hook 'post-command-hook 'narf/nlinum-hl-line))
|
||||
(defun narf/nlinum-disable ()
|
||||
(nlinum-mode -1)
|
||||
(remove-hook 'post-command-hook 'narf/nlinum-hl-line)
|
||||
(narf/nlinum-unhl-line))
|
||||
|
||||
(add-hook 'prog-mode-hook 'narf/nlinum-enable)
|
||||
(add-hook 'org-mode-hook 'narf/nlinum-disable))
|
||||
:config
|
||||
(setq-default nlinum-format " %4d "))
|
||||
|
||||
(when window-system
|
||||
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
|
||||
(if (string-equal (system-name) "io")
|
||||
(set-frame-size (selected-frame) 326 119)))
|
||||
|
||||
(add-hook! 'after-init-hook
|
||||
(@add-hook after-init
|
||||
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
|
||||
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
||||
(flet ((process-list ())) ad-do-it)))
|
||||
|
||||
|
||||
;;;; Line numbers ;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-package nlinum
|
||||
:defines nlinum--width
|
||||
:commands nlinum-mode
|
||||
:preface
|
||||
(defface linum '((t (:inherit default)))
|
||||
"Face for line numbers" :group 'nlinum-mode)
|
||||
(defface linum-highlight-face '((t (:inherit linum)))
|
||||
"Face for line highlights" :group 'nlinum-mode)
|
||||
(defvar narf--hl-nlinum-overlay nil)
|
||||
(defvar narf--hl-nlinum-line nil)
|
||||
(defvar nlinum-format " %4d ")
|
||||
:init
|
||||
;; Highlight line number
|
||||
(defun narf|nlinum-unhl-line ()
|
||||
(when narf--hl-nlinum-overlay
|
||||
(let* ((ov narf--hl-nlinum-overlay)
|
||||
(disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
||||
(str (nth 1 disp)))
|
||||
(put-text-property 0 (length str) 'face 'linum str)
|
||||
(setq narf--hl-nlinum-overlay nil
|
||||
narf--hl-nlinum-line nil))))
|
||||
|
||||
(defun narf|nlinum-hl-line (&optional line)
|
||||
(let ((line-no (or line (line-number-at-pos (point)))))
|
||||
(when (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
||||
(let* ((pbol (if line (save-excursion (goto-char (point-min))
|
||||
(forward-line line-no)
|
||||
(point-at-bol))
|
||||
(point-at-bol)))
|
||||
(peol (1+ pbol)))
|
||||
;; Handle EOF case
|
||||
(when (>= peol (point-max))
|
||||
(setq peol (point-max)))
|
||||
(jit-lock-fontify-now pbol peol)
|
||||
(let* ((overlays (overlays-in pbol peol))
|
||||
(ov (-first (lambda (item) (overlay-get item 'nlinum)) overlays)))
|
||||
(when ov
|
||||
(narf|nlinum-unhl-line)
|
||||
(let* ((disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
||||
(str (nth 1 disp)))
|
||||
(put-text-property 0 (length str) 'face 'linum-highlight-face str)
|
||||
(put-text-property 0 (length str) 'face 'linum-highlight-face str)
|
||||
(setq narf--hl-nlinum-overlay ov
|
||||
narf--hl-nlinum-line line-no))))))))
|
||||
|
||||
(defun narf|nlinum-enable ()
|
||||
(nlinum-mode +1)
|
||||
(add-hook 'post-command-hook 'narf|nlinum-hl-line))
|
||||
|
||||
(defun narf|nlinum-disable ()
|
||||
(nlinum-mode -1)
|
||||
(remove-hook 'post-command-hook 'narf|nlinum-hl-line)
|
||||
(narf|nlinum-unhl-line))
|
||||
|
||||
(@add-hook text-mode 'narf|nlinum-enable)
|
||||
(@add-hook prog-mode 'narf|nlinum-enable)
|
||||
(@add-hook org-mode 'narf|nlinum-disable)
|
||||
;; Preset width nlinum
|
||||
(@add-hook nlinum-mode
|
||||
(setq nlinum--width (length (number-to-string (count-lines (point-min) (point-max)))))))
|
||||
|
||||
|
||||
;;;; Modeline ;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-package smart-mode-line
|
||||
:init (setq-default
|
||||
sml/no-confirm-load-theme t
|
||||
sml/mode-width 'full
|
||||
sml/extra-filler -7
|
||||
sml/show-remote nil
|
||||
sml/encoding-format nil
|
||||
sml/modified-char "*"
|
||||
sml/numbers-separator "/"
|
||||
sml/line-number-format "%3l"
|
||||
sml/col-number-format "%2c"
|
||||
sml/pre-modes-separator " : "
|
||||
sml/pre-minor-modes-separator " "
|
||||
sml/pos-minor-modes-separator ": "
|
||||
sml/replacer-regexp-list '(("^~/Dropbox/Projects/" "PROJECTS:")
|
||||
("^~/.emacs.d/" "EMACS.D:")
|
||||
("^~/Dropbox/notes/" "NOTES:")
|
||||
("^/usr/local/Cellar/" "HOMEBREW:"))
|
||||
mode-line-misc-info
|
||||
'((which-func-mode ("" which-func-format ""))
|
||||
(global-mode-string ("" global-mode-string ""))))
|
||||
:config
|
||||
(progn
|
||||
(setq sml/no-confirm-load-theme t
|
||||
sml/mode-width 'full
|
||||
sml/extra-filler -7
|
||||
sml/show-remote nil
|
||||
sml/modified-char "*"
|
||||
sml/encoding-format nil
|
||||
sml/replacer-regexp-list '(("^~/Dropbox/Projects/" "PROJECTS:")
|
||||
("^~/.emacs.d/" "EMACS.D:")
|
||||
("^~/Dropbox/notes/" "NOTES:")
|
||||
("^/usr/local/Cellar/" "HOMEBREW:"))
|
||||
sml/pre-modes-separator " : "
|
||||
sml/pre-minor-modes-separator " "
|
||||
sml/pos-minor-modes-separator ": "
|
||||
sml/numbers-separator "/"
|
||||
sml/line-number-format "%3l"
|
||||
sml/col-number-format "%2c")
|
||||
;; Hide evil state indicator
|
||||
(@after evil (setq evil-mode-line-format nil))
|
||||
|
||||
;; Hide evil state indicator
|
||||
(after "evil" (setq evil-mode-line-format nil))
|
||||
(sml/setup)
|
||||
(sml/apply-theme 'respectful)
|
||||
|
||||
(setq-default mode-line-misc-info
|
||||
'((which-func-mode ("" which-func-format ""))
|
||||
(global-mode-string ("" global-mode-string ""))))
|
||||
;; Hack modeline to be more vim-like, and right-aligned
|
||||
(defun sml/generate-minor-modes ()
|
||||
(if sml/simplified
|
||||
""
|
||||
(let* ((nameList (rm--mode-list-as-string-list))
|
||||
(last nil)
|
||||
(concatList (mapconcat (lambda (mode)
|
||||
(setq mode (s-trim mode))
|
||||
(if (> (length mode) 1)
|
||||
(prog1 (concat (if last " ") mode " ")
|
||||
(setq last nil))
|
||||
(prog1 mode
|
||||
(setq last t))))
|
||||
nameList ""))
|
||||
(size (sml/fill-width-available))
|
||||
(finalNameList concatList)
|
||||
needs-removing filling)
|
||||
(when (and sml/shorten-modes (> (length finalNameList) size))
|
||||
(setq needs-removing
|
||||
(1+ (sml/count-occurrences-starting-at
|
||||
" " finalNameList
|
||||
(- size (string-width sml/full-mode-string))))))
|
||||
(when needs-removing
|
||||
(setcdr (last nameList (1+ needs-removing))
|
||||
(list t sml/propertized-full-mode-string)))
|
||||
(unless sml/shorten-modes
|
||||
(add-to-list 'nameList sml/propertized-shorten-mode-string t))
|
||||
(setq filling (- size (+ (length (format-mode-line concatList)) (length mode-name) (length vc-mode))))
|
||||
(setq filling (make-string (max 0 filling) sml/fill-char))
|
||||
(list (propertize filling 'face 'sml/modes)
|
||||
(propertize (or vc-mode "") 'face 'sml/vc)
|
||||
(propertize sml/pre-modes-separator 'face 'font-lock-comment-delimiter-face)
|
||||
(propertize mode-name)
|
||||
'sml/pre-minor-modes-separator
|
||||
concatList
|
||||
(propertize sml/pos-minor-modes-separator 'face
|
||||
'font-lock-comment-delimiter-face)))))
|
||||
|
||||
(sml/setup)
|
||||
(sml/apply-theme 'respectful)
|
||||
;; Remove extra spaces in format lists
|
||||
(pop mode-line-modes)
|
||||
(nbutlast mode-line-modes)
|
||||
|
||||
;; Hack modeline to be more vim-like, and right-aligned
|
||||
(defun sml/generate-minor-modes ()
|
||||
(if sml/simplified
|
||||
""
|
||||
(let* ((nameList (rm--mode-list-as-string-list))
|
||||
(last nil)
|
||||
(concatList (mapconcat (lambda (mode)
|
||||
(setq mode (s-trim mode))
|
||||
(if (> (length mode) 1)
|
||||
(prog1 (concat (if last " ") mode " ")
|
||||
(setq last nil))
|
||||
(prog1 mode
|
||||
(setq last t))))
|
||||
nameList ""))
|
||||
(size (sml/fill-width-available))
|
||||
(finalNameList concatList)
|
||||
needs-removing filling)
|
||||
(when (and sml/shorten-modes (> (length finalNameList) size))
|
||||
(setq needs-removing
|
||||
(1+ (sml/count-occurrences-starting-at
|
||||
" " finalNameList
|
||||
(- size (string-width sml/full-mode-string))))))
|
||||
(when needs-removing
|
||||
(setcdr (last nameList (1+ needs-removing))
|
||||
(list t sml/propertized-full-mode-string)))
|
||||
(unless sml/shorten-modes
|
||||
(add-to-list 'nameList sml/propertized-shorten-mode-string t))
|
||||
;; Remove spacing in mode-line position so we can put it elsewhere
|
||||
(setq mode-line-position
|
||||
'((sml/position-percentage-format
|
||||
(-3 (:propertize (:eval sml/position-percentage-format)
|
||||
face sml/position-percentage help-echo "Buffer Relative Position\nmouse-1: Display Line and Column Mode Menu")))))
|
||||
|
||||
;; Padding
|
||||
(setq filling (- size (+ (length (format-mode-line concatList)) (length mode-name) (length vc-mode))))
|
||||
(setq filling (make-string (max 0 filling) sml/fill-char))
|
||||
(@after anzu ; Add small gap for anzu
|
||||
(defun narf--anzu-update-mode-line (here total)
|
||||
(concat (anzu--update-mode-line-default here total) " "))
|
||||
(setq anzu-mode-line-update-function 'narf--anzu-update-mode-line))
|
||||
|
||||
(list (propertize filling 'face 'sml/modes)
|
||||
(propertize (or vc-mode "") 'face 'sml/vc)
|
||||
(propertize sml/pre-modes-separator 'face 'font-lock-comment-delimiter-face)
|
||||
(propertize mode-name)
|
||||
'sml/pre-minor-modes-separator
|
||||
concatList
|
||||
(propertize sml/pos-minor-modes-separator 'face
|
||||
'font-lock-comment-delimiter-face)))))
|
||||
|
||||
;; Remove extra spaces in format lists
|
||||
(pop mode-line-modes)
|
||||
(nbutlast mode-line-modes)
|
||||
|
||||
;; Remove spacing in mode-line position so we can put it elsewhere
|
||||
(setq mode-line-position
|
||||
'((sml/position-percentage-format
|
||||
(-3 (:propertize (:eval sml/position-percentage-format)
|
||||
face sml/position-percentage help-echo "Buffer Relative Position\nmouse-1: Display Line and Column Mode Menu")))))
|
||||
|
||||
(after "anzu"
|
||||
;; Add small gap for anzu
|
||||
(defun narf/anzu-update-mode-line (here total)
|
||||
(concat (anzu--update-mode-line-default here total) " "))
|
||||
(setq anzu-mode-line-update-function 'narf/anzu-update-mode-line))
|
||||
|
||||
;; Rearrange and cleanup
|
||||
(setq-default mode-line-format
|
||||
'("%e "
|
||||
mode-line-mule-info
|
||||
mode-line-client
|
||||
mode-line-remote
|
||||
mode-line-frame-identification
|
||||
mode-line-buffer-identification
|
||||
mode-line-modified
|
||||
mode-line-misc-info
|
||||
mode-line-modes
|
||||
mode-line-front-space
|
||||
mode-line-end-spaces
|
||||
" "
|
||||
":" mode-line-position
|
||||
))))
|
||||
;; Rearrange and cleanup
|
||||
(setq-default mode-line-format
|
||||
'("%e "
|
||||
mode-line-mule-info
|
||||
mode-line-client
|
||||
;; mode-line-remote
|
||||
mode-line-frame-identification
|
||||
mode-line-buffer-identification
|
||||
mode-line-modified
|
||||
mode-line-misc-info
|
||||
mode-line-modes
|
||||
mode-line-front-space
|
||||
mode-line-end-spaces
|
||||
" "
|
||||
":" mode-line-position)))
|
||||
|
||||
|
||||
(provide 'core-ui)
|
||||
|
|
44
core/core-vars.el
Normal file
44
core/core-vars.el
Normal file
|
@ -0,0 +1,44 @@
|
|||
;;; core-vars.el --- narf emacs configuration
|
||||
|
||||
(defgroup narf nil
|
||||
"Narf variables."
|
||||
:group 'convenience
|
||||
:prefix 'narf-)
|
||||
|
||||
(defcustom narf-leader-key "," "The prefix for leader keybindings."
|
||||
:group 'narf :type 'string)
|
||||
|
||||
(defcustom narf-localleader-key "\\" "The prefix for localleader keybindings."
|
||||
:group 'narf)
|
||||
|
||||
|
||||
;; Buffers/Files ;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defconst narf--splash-buffer-name "*narf*")
|
||||
|
||||
(defvar narf-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
|
||||
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
|
||||
"*Buffer List*" "*Ibuffer*" "*esh command on file*")
|
||||
"List of buffer names to ignore when using `switch-to-next-buffer',
|
||||
`switch-to-previous-buffer', `winner-undo', `winner-redo', or
|
||||
`narf:cleanup-buffers'")
|
||||
|
||||
(defvar narf-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
|
||||
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
|
||||
"*Buffer List*" "*Ibuffer*" "*esh command on file*")
|
||||
"List of buffer names to ignore when using `switch-to-next-buffer',
|
||||
`switch-to-previous-buffer', `winner-undo', `winner-redo', or
|
||||
`narf:cleanup-buffers'")
|
||||
|
||||
(defvar narf-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.")
|
||||
|
||||
|
||||
(provide 'core-vars)
|
||||
;;; core-vars.el ends here
|
473
core/core.el
473
core/core.el
|
@ -1,319 +1,234 @@
|
|||
;;; The core of Narfy Emacs
|
||||
;;; core.el --- The heart of the beast
|
||||
;;
|
||||
;;; Naming Conventions
|
||||
;;; Naming conventions:
|
||||
;;
|
||||
;; narf/* public defun/variable
|
||||
;; narf--* private defun/variable
|
||||
;; narf|* hook defuns
|
||||
;; narf:* interactive/keybind defuns
|
||||
;; :* ex commands
|
||||
;; narf-* A public variable/constant or function
|
||||
;; narf--* A private variable or function (non-interactive)
|
||||
;; narf/* An autoloaded interactive function
|
||||
;; narf:* An ex command
|
||||
;; narf|* A hook
|
||||
;; @* Macro call
|
||||
;;
|
||||
;;; Bootstrap:
|
||||
|
||||
(setq package-enable-at-startup nil
|
||||
debug-on-quit DEBUG-MODE)
|
||||
(cd "~") ; instead of /
|
||||
(require 'core-splash)
|
||||
(fset '! 'eval-when-compile)
|
||||
|
||||
;; This is kept separate so it can jumpstart emacs; this prevents the unstyled
|
||||
;; flash of emacs pre-makeover.
|
||||
(load-theme (if window-system DEFAULT-THEME TERM-THEME) t)
|
||||
(when window-system
|
||||
(set-frame-font DEFAULT-FONT)
|
||||
(scroll-bar-mode -1) ; no scrollbar
|
||||
(tool-bar-mode -1) ; no toolbar
|
||||
(menu-bar-mode -1)) ; no menubar
|
||||
(defconst narf-emacs-dir user-emacs-directory)
|
||||
(defconst narf-core-dir (! (concat narf-emacs-dir "core/")))
|
||||
(defconst narf-modules-dir (! (concat narf-emacs-dir "modules/")))
|
||||
(defconst narf-contrib-dir (! (concat narf-emacs-dir "contrib/")))
|
||||
(defconst narf-private-dir (! (concat narf-emacs-dir "private/")))
|
||||
(defconst narf-elpa-dir (! (concat narf-emacs-dir ".cask/" emacs-version "/elpa/")))
|
||||
(defconst narf-temp-dir (concat narf-private-dir "cache/" (system-name) "/"))
|
||||
(defconst narf-snippet-dirs (! (list (concat narf-private-dir "snippets/")
|
||||
(concat narf-private-dir "templates/"))))
|
||||
|
||||
(! (defun --subdirs (path)
|
||||
(let ((result '())
|
||||
(paths (ignore-errors (directory-files path t "^[^.]" t))))
|
||||
(dolist (file paths)
|
||||
(when (file-directory-p file)
|
||||
(add-to-list 'result file)))
|
||||
result)))
|
||||
|
||||
;; Scan various folders to populate the load-dirs
|
||||
(setq custom-theme-load-path
|
||||
(! (append (--subdirs (concat narf-private-dir "themes/"))
|
||||
custom-theme-load-path)))
|
||||
(setq load-path
|
||||
(! (setq load-path (append (list narf-core-dir narf-contrib-dir narf-modules-dir narf-private-dir)
|
||||
(list (concat narf-core-dir "defuns"))
|
||||
load-path
|
||||
(--subdirs narf-contrib-dir)
|
||||
(--subdirs narf-contrib-dir)))
|
||||
(require 'cask)
|
||||
(cask-initialize)
|
||||
load-path))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(message ">> %s" "Are you pondering what I'm pondering, Pinky?")
|
||||
(message "-----------------------------------------------------------------------------------")
|
||||
|
||||
(defun display-startup-echo-area-message ()
|
||||
(message "-----------------------------------------------------------------------------------")
|
||||
(message ">> %s\n>> Loaded in %s" (narf/random-comeback) (emacs-init-time)))
|
||||
;; (require 'benchmark) ; records load times in `require-times'; also see `list-times'
|
||||
(require 'autoloads nil t) ; generate autoloads with `make autoloads`
|
||||
(require 'core-vars)
|
||||
(require 'core-defuns)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(! (require 's)
|
||||
(require 'dash)
|
||||
(require 'f)
|
||||
|
||||
(add-to-list 'load-path (concat narf-core-dir "macros/"))
|
||||
|
||||
(setq use-package-verbose narf-debug-mode)
|
||||
;; (setq use-package-expand-minimally (not narf-debug-mode))
|
||||
(require 'use-package)
|
||||
|
||||
(defun use-package--add-keyword (keyword after)
|
||||
(setq use-package-keywords
|
||||
(-insert-at (-find-index (lambda (key) (eq key after)) use-package-keywords)
|
||||
keyword use-package-keywords)))
|
||||
|
||||
(progn ; add :after to use-package
|
||||
(use-package--add-keyword :after :load-path)
|
||||
(setq use-package-keywords
|
||||
(-insert-at (--find-index (eq it :load-path) use-package-keywords)
|
||||
:after use-package-keywords))
|
||||
|
||||
(defalias 'use-package-normalize/:after 'use-package-normalize-symlist)
|
||||
|
||||
(defun use-package-handler/:after (name-symbol keyword arg rest state)
|
||||
(let ((body (use-package-process-keywords name-symbol rest state)))
|
||||
(if (null arg)
|
||||
body
|
||||
(use-package-concat
|
||||
(use-package-process-keywords name-symbol
|
||||
(use-package-sort-keywords (use-package-plist-maybe-put rest :defer t)) state)
|
||||
(apply #'nconc
|
||||
(mapcar (lambda (feature)
|
||||
`(,(macroexpand `(@after ,feature (require ',name-symbol)))))
|
||||
(delete-dups arg))))))))
|
||||
|
||||
(progn ; add :map for in-house key binding macro
|
||||
(use-package--add-keyword :map :bind)
|
||||
|
||||
(defalias 'use-package-normalize/:map 'use-package-normalize-forms)
|
||||
|
||||
;; TODO: Write :map
|
||||
(defun use-package-handler/:map (name-symbol keyword arg rest state)
|
||||
(use-package-process-keywords name-symbol rest state))
|
||||
)
|
||||
)
|
||||
(require 'diminish)
|
||||
|
||||
;; Emacs configuration ;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defconst IS-MAC (eq system-type 'darwin))
|
||||
(defconst IS-LINUX (eq system-type 'gnu/linux))
|
||||
(defconst IS-WINDOWS (eq system-type 'windows-nt))
|
||||
|
||||
(require 'defuns)
|
||||
|
||||
;; NARF!
|
||||
(defvar narf-mode-map (make-sparse-keymap))
|
||||
(define-minor-mode narf-mode
|
||||
"Narf, yoink, poit."
|
||||
:global t :init-value t :lighter "NARF" :keymap narf-mode-map)
|
||||
|
||||
(defvar narf/leader-key ",")
|
||||
(defvar narf/localleader-key "\\")
|
||||
|
||||
;; Make sure undo/backup folders exist
|
||||
(defconst TMP-DIR-UNDO (expand-file-name "undo" TMP-DIR))
|
||||
(defconst TMP-DIR-BACKUP (expand-file-name "backup" TMP-DIR))
|
||||
(defconst TMP-DIR-AUTOSAVE (expand-file-name "autosave" TMP-DIR))
|
||||
(unless (file-directory-p TMP-DIR)
|
||||
(make-directory TMP-DIR-UNDO t)
|
||||
(make-directory TMP-DIR-BACKUP t)
|
||||
(make-directory TMP-DIR-AUTOSAVE t))
|
||||
|
||||
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||
|
||||
;;;; Sane defaults ;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(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)
|
||||
|
||||
;;; 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
|
||||
(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
|
||||
|
||||
;;; 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
|
||||
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||
|
||||
;; avoid garbage collection (default is 400k)
|
||||
(setq-default
|
||||
gc-cons-threshold 20000000
|
||||
confirm-kill-emacs nil
|
||||
;; minibufferception? Yay!
|
||||
enable-recursive-minibuffers t)
|
||||
confirm-kill-emacs (lambda (prompt) (y-or-n-p ">> Gee, I dunno Brain... Are you sure?"))
|
||||
|
||||
;; Show me those keystrokes
|
||||
(setq echo-keystrokes 0.02
|
||||
gc-cons-threshold 20000000 ; avoid garbage collection
|
||||
enable-recursive-minibuffers t ; minibufferception
|
||||
echo-keystrokes 0.02 ; show me those keystrokes
|
||||
ring-bell-function 'ignore ; silence of the bells!
|
||||
|
||||
ring-bell-function 'ignore
|
||||
inhibit-startup-screen t ; don't show emacs start screen
|
||||
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
|
||||
initial-major-mode 'text-mode ; initial scratch buffer mode
|
||||
initial-scratch-message nil
|
||||
|
||||
inhibit-startup-screen t ; don't show EMACs start screen
|
||||
inhibit-splash-screen t
|
||||
;; inhibit-startup-message t
|
||||
inhibit-startup-echo-area-message "hlissner"
|
||||
;; inhibit-startup-buffer-menu t
|
||||
compilation-always-kill t
|
||||
compilation-ask-about-save nil
|
||||
compilation-scroll-output t
|
||||
|
||||
initial-major-mode 'text-mode ; initial scratch buffer mode
|
||||
initial-scratch-message nil
|
||||
sentence-end-double-space nil ; sentences end with periods. period.
|
||||
|
||||
compilation-always-kill t
|
||||
compilation-ask-about-save nil
|
||||
compilation-scroll-output t
|
||||
ediff-diff-options "-w"
|
||||
ediff-split-window-function 'split-window-horizontally ; side-by-side diffs
|
||||
ediff-window-setup-function 'ediff-setup-windows-plain ; no extra frames
|
||||
|
||||
sentence-end-double-space nil ; sentences end with periods. Period.
|
||||
;; Don't save clipboard contents into kill-ring before replacing them
|
||||
save-interprogram-paste-before-kill nil
|
||||
|
||||
ediff-diff-options "-w"
|
||||
ediff-split-window-function 'split-window-horizontally ; side-by-side diffs
|
||||
ediff-window-setup-function 'ediff-setup-windows-plain) ; no extra frames
|
||||
;; Don't let the cursor go into minibuffer prompt
|
||||
;; from Xah Lee: http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
||||
minibuffer-prompt-properties
|
||||
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
||||
|
||||
;; Don't save clipboard contents into kill-ring before replacing them
|
||||
(setq save-interprogram-paste-before-kill nil)
|
||||
;; remove annoying ellipsis when printing sexp in message buffer
|
||||
eval-expression-print-length nil
|
||||
eval-expression-print-level 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))
|
||||
history-length 1000
|
||||
|
||||
;; remove annoying ellipsis when printing sexp in message buffer
|
||||
(setq eval-expression-print-length nil
|
||||
eval-expression-print-level nil)
|
||||
;; Backups ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Disable all backups (that's what git/dropbox are for)
|
||||
bookmark-save-flag t
|
||||
bookmark-default-file (! (concat narf-temp-dir "bookmarks"))
|
||||
auto-save-default nil
|
||||
auto-save-list-file-name (! (concat narf-temp-dir "autosave"))
|
||||
;; In case I want to reactivate backup files
|
||||
make-backup-files nil
|
||||
create-lockfiles nil
|
||||
backup-directory-alist `((".*" . ,(! (concat narf-temp-dir "backup/"))))
|
||||
|
||||
;; Remember undo history
|
||||
undo-tree-auto-save-history t
|
||||
undo-tree-history-directory-alist `(("." . ,(! (concat narf-temp-dir "undo/")))))
|
||||
|
||||
;; Make any folders needed
|
||||
(! (dolist (file '("" "undo" "backup"))
|
||||
(let ((path (concat narf-temp-dir file)))
|
||||
(unless (file-exists-p path)
|
||||
(make-directory path t)))))
|
||||
|
||||
;; Save cursor location across sessions. Only save for files that exist.
|
||||
(use-package saveplace
|
||||
:init (defvar save-place-file (concat TMP-DIR "saveplace"))
|
||||
:config (add-hook! 'find-file-hook (if (file-exists-p (buffer-file-name)) (setq save-place t))))
|
||||
(require 'saveplace)
|
||||
(setq save-place-file (! (concat narf-temp-dir "saveplace")))
|
||||
(@add-hook find-file (if (file-exists-p (buffer-file-name)) (setq save-place t)))
|
||||
|
||||
;; Save history across sessions
|
||||
(use-package savehist
|
||||
:config
|
||||
(progn
|
||||
(setq savehist-file (concat 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)))
|
||||
(require 'savehist)
|
||||
(setq savehist-file (! (concat narf-temp-dir "savehist"))
|
||||
savehist-additional-variables
|
||||
'(kill-ring global-mark-ring search-ring regexp-search-ring extended-command-history))
|
||||
(savehist-mode 1)
|
||||
|
||||
(use-package recentf
|
||||
:config
|
||||
(progn
|
||||
(setq recentf-save-file (concat TMP-DIR "recentf")
|
||||
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
||||
"/\\.cache/.+" "emacs\\.d/workgroups/.+$" ".emacs.workgroup"
|
||||
"/company-statistics-cache.el$")
|
||||
recentf-max-menu-items 0
|
||||
recentf-max-saved-items 250
|
||||
recentf-auto-cleanup 600)
|
||||
(recentf-mode 1)))
|
||||
|
||||
|
||||
;;;; Backup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Disable all backups (that's what git/dropbox are for)
|
||||
(setq bookmark-save-flag t
|
||||
bookmark-default-file (concat TMP-DIR "bookmarks")
|
||||
auto-save-default nil
|
||||
auto-save-list-file-name (concat TMP-DIR-AUTOSAVE "auto-save")
|
||||
auto-save-file-name-transforms `((".*" ,TMP-DIR-AUTOSAVE t))
|
||||
;; In case I want to reactivate backup files
|
||||
make-backup-files nil
|
||||
create-lockfiles nil
|
||||
backup-directory-alist `((".*" . ,TMP-DIR-BACKUP)))
|
||||
|
||||
|
||||
;;;; Undo Tree ;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(setq-default ; Remember undo history
|
||||
undo-tree-auto-save-history t
|
||||
undo-tree-history-directory-alist `(("." . ,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))
|
||||
|
||||
;; Shut up undo-tree's constant complaining: http://youtu.be/Z6woIRLnbmE
|
||||
(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, \.\.\.
|
||||
(defadvice undo-tree-position (around undo-tree-position-silence-type-error activate)
|
||||
(when (listp (ad-get-args 1)) ad-do-it))
|
||||
|
||||
;;;; Editor behavior ;;;;;;;;;;;;;;;;
|
||||
(setq-default ; spaces instead of tabs
|
||||
indent-tabs-mode nil
|
||||
tab-always-indent t
|
||||
tab-width 4)
|
||||
|
||||
(setq require-final-newline t
|
||||
delete-trailing-lines nil)
|
||||
|
||||
;; Automatic minor modes ;;;;;;;;;;;
|
||||
(defvar narf/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 narf|enable-minor-mode-maybe ()
|
||||
"Check file name against `narf/auto-minor-mode-alist'."
|
||||
(when buffer-file-name
|
||||
(let ((name buffer-file-name)
|
||||
(remote-id (file-remote-p buffer-file-name))
|
||||
(alist narf/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 'narf|enable-minor-mode-maybe)
|
||||
|
||||
|
||||
;;;; Utility plugins ;;;;;;;;;;;;;;;;;;
|
||||
(use-package smex
|
||||
:functions (smex-initialize smex-update)
|
||||
:commands (smex smex-major-mode-commands)
|
||||
:config
|
||||
(progn
|
||||
(setq smex-save-file (expand-file-name "smex-items" TMP-DIR))
|
||||
(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
|
||||
popwin:special-display-config
|
||||
(append '(("\\`\\*helm.*?\\*\\'" :regexp t :position bottom :height 15)
|
||||
("^\\*Flycheck.*\\*$" :regexp t :position bottom :height 0.25 :noselect t)
|
||||
(inf-enh-ruby-mode :position bottom :stick t)
|
||||
(snippet-mode :position bottom :stick t)
|
||||
("^\\*eclim.*\\*" :regexp t :position bottom :height 0.25)
|
||||
("*ansi-term*" :position bottom :height 0.45 :stick t)
|
||||
("*terminal*" :position bottom :height 0.45 :stick t)
|
||||
("*Async Shell Command*" :position bottom)
|
||||
("*Shell Command Output*" :position bottom :stick t :height 15)
|
||||
("* Regexp Explain *" :position top :height 0.35)
|
||||
("*anaconda-doc*" :position bottom :height 15 :noselect t)
|
||||
("*anaconda-nav*" :position bottom :height 15 :stick t)
|
||||
("^\\*Python.+\\*$" :regexp t :position bottom :height 20 :noselect t)
|
||||
("*Pp Eval Output*" :position bottom :height 10 :noselect t)
|
||||
("*eval*" :position bottom :noselect t)
|
||||
(help-mode :height 25 :position bottom :stick t)
|
||||
(compilation-mode :height 0.5 :position bottom :noselect t)
|
||||
(diff-mode :position bottom :stick t)
|
||||
("*Backtrace*")
|
||||
("*Warnings*")
|
||||
("*Process List*")
|
||||
("*Compile-Log*" :height 0.3 :position bottom :noselect t)
|
||||
(" *undo-tree*" :width 0.3 :position right)
|
||||
("^\\*scratch\\*.*" :regexp t :stick t)
|
||||
(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)))))
|
||||
|
||||
(use-package semantic
|
||||
:commands semantic-mode
|
||||
:init
|
||||
(progn
|
||||
(add-hook 'c-mode-common-hook 'semantic-mode)
|
||||
(defvar semanticdb-default-system-save-directory (concat TMP-DIR "semanticdb"))
|
||||
(defvar semanticdb-default-save-directory (concat TMP-DIR "semanticdb")))
|
||||
:config
|
||||
(semantic-mode 1))
|
||||
|
||||
;; Improved help commands
|
||||
(use-package help-fns+
|
||||
:commands (describe-buffer
|
||||
describe-command
|
||||
describe-file
|
||||
describe-keymap
|
||||
describe-option
|
||||
describe-option-of-type))
|
||||
|
||||
(use-package server
|
||||
:config (unless (server-running-p) (server-start)))
|
||||
(require 'recentf)
|
||||
(setq recentf-save-file (! (concat narf-temp-dir "recentf"))
|
||||
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
||||
"/\\.cache/.+" "emacs\\.d/workgroups/.+$" ".emacs.workgroup"
|
||||
"/company-statistics-cache.el$")
|
||||
recentf-max-menu-items 0
|
||||
recentf-max-saved-items 250
|
||||
recentf-auto-cleanup 600)
|
||||
(recentf-mode 1)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(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 help-fns+ ; Improved help commands
|
||||
:commands (describe-buffer describe-command describe-file
|
||||
describe-keymap describe-option describe-option-of-type))
|
||||
|
||||
(use-package popwin :config (popwin-mode 1))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(cond (IS-MAC (require 'core-os-osx))
|
||||
(IS-LINUX (require 'core-os-linux))
|
||||
(IS-WINDOWS (require 'core-os-win32)))
|
||||
|
||||
(require 'core-ui)
|
||||
(require 'core-evil)
|
||||
;; (require 'core-editor)
|
||||
;; (require 'core-completion)
|
||||
;; (require 'core-syntax-checker)
|
||||
;; (require 'core-snippets)
|
||||
;; (require 'core-templates)
|
||||
;; (require 'core-project)
|
||||
;; (require 'core-vcs)
|
||||
;; (require 'core-sessions)
|
||||
;; (require 'core-quickrun)
|
||||
|
||||
;; (@add-hook after-init
|
||||
;; (use-package my-bindings)
|
||||
;; (use-package my-commands))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-package server :config (unless (server-running-p) (server-start)))
|
||||
|
||||
|
||||
(provide 'core)
|
||||
|
|
|
@ -1,289 +0,0 @@
|
|||
;; Inspired by http://demonastery.org/2013/04/emacs-evil-narrow-region/
|
||||
;;;###autoload
|
||||
(defun narf:narrow-to-region-indirect (start end)
|
||||
"Restrict editing in this buffer to the current region, indirectly."
|
||||
(interactive "r")
|
||||
(deactivate-mark)
|
||||
(let ((buf (clone-indirect-buffer nil nil)))
|
||||
(with-current-buffer buf
|
||||
(narrow-to-region start end))
|
||||
(switch-to-buffer buf)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:widen ()
|
||||
(interactive)
|
||||
(when (buffer-narrowed-p)
|
||||
(widen)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:set-region-read-only (begin end)
|
||||
"See http://stackoverflow.com/questions/7410125"
|
||||
(let ((modified (buffer-modified-p)))
|
||||
(add-text-properties begin end '(read-only t))
|
||||
(set-buffer-modified-p modified)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:set-region-writeable (begin end)
|
||||
"See http://stackoverflow.com/questions/7410125"
|
||||
(let ((modified (buffer-modified-p))
|
||||
(inhibit-read-only t))
|
||||
(remove-text-properties begin end '(read-only t))
|
||||
(set-buffer-modified-p modified)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/living-buffer-list (&optional buffer-list)
|
||||
(-remove 'get-buffer-window (or buffer-list (buffer-list))))
|
||||
|
||||
|
||||
;; Killing Buffers ;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Buffer defuns
|
||||
(defvar narf/cleanup-buffers-list '("^ \\*"
|
||||
"^\\*Backtrace\\*$"
|
||||
"^\\*Warnings\\*$"
|
||||
"^\\*Compile-Log\\*$"
|
||||
"^\\*Ediff.*\\*$"
|
||||
help-mode
|
||||
image-mode
|
||||
dired-mode
|
||||
reb-mode)
|
||||
"A list of buffer name regexps or major-mode symbols. If buried buffers
|
||||
match/have that mode active, `narf:cleanup-buffers' will kill them.")
|
||||
|
||||
(defvar narf/cleanup-processes-alist '(("pry" . ruby-mode)
|
||||
("irb" . ruby-mode)
|
||||
("ipython" . python-mode))
|
||||
"An alist of (process-name . major-mode), that `narf:cleanup-processes' checks
|
||||
before killing processes. If there are no buffers with matching major-modes, it
|
||||
gets killed.")
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/add-throwaway-buffer (regexp)
|
||||
(add-to-list 'narf/cleanup-buffers-list regexp))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:cleanup-buffers ()
|
||||
"Kill left-over temporary, dired or buried special buffers"
|
||||
(interactive)
|
||||
(let* ((this-frame (selected-frame))
|
||||
(kill-list (buffer-list this-frame)))
|
||||
(setq kill-list
|
||||
(-filter (lambda (b)
|
||||
(unless (get-buffer-window b) ; don't kill if visible
|
||||
(-any? (lambda (pred)
|
||||
(cond ((stringp pred)
|
||||
(s-matches? pred (buffer-name b)))
|
||||
((symbolp pred)
|
||||
(eq (buffer-local-value 'major-mode b) pred))))
|
||||
narf/cleanup-buffers-list)))
|
||||
kill-list))
|
||||
(message "Cleaned up %s buffers" (length kill-list))
|
||||
(mapc 'kill-buffer kill-list)
|
||||
(narf:cleanup-processes)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:cleanup-processes ()
|
||||
(interactive)
|
||||
(let ((buffer-list (buffer-list)))
|
||||
(dolist (p (process-list))
|
||||
(let* ((process-name (process-name p))
|
||||
(assoc (assoc process-name narf/cleanup-processes-alist)))
|
||||
(when (and assoc
|
||||
(not (string= process-name "server"))
|
||||
(process-live-p p)
|
||||
(not (-any? (lambda (b)
|
||||
(let ((mode (buffer-local-value 'major-mode b)))
|
||||
(eq mode (cdr assoc))))
|
||||
buffer-list)))
|
||||
(message "Cleanup: killing %s" process-name)
|
||||
(delete-process p))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:kill-matching-buffers (regexp &optional buffer-list)
|
||||
(interactive)
|
||||
(mapc (lambda (b)
|
||||
(if (string-match-p regexp (buffer-name b))
|
||||
(kill-buffer b)))
|
||||
(if buffer-list buffer-list (buffer-list))))
|
||||
|
||||
(defun narf--cycle-real-buffer (&optional n)
|
||||
"Switch to the previous buffer and avoid special buffers."
|
||||
(interactive)
|
||||
(let ((start-buffer (current-buffer))
|
||||
(move-func (if (< n 0) 'switch-to-next-buffer 'switch-to-prev-buffer)))
|
||||
(funcall move-func)
|
||||
(let ((i 0))
|
||||
(while (let ((current-buffer (current-buffer)))
|
||||
(and (not (eq current-buffer start-buffer))
|
||||
(not (eq current-buffer narf--project-scratch-buffer))
|
||||
(< i 15)
|
||||
(string-equal "*" (substring (buffer-name) 0 1))))
|
||||
(cl-incf i)
|
||||
(funcall move-func)))))
|
||||
|
||||
;; From spacemacs <https://github.com/syl20bnr/spacemacs/blob/master/spacemacs/funcs.el>
|
||||
;;;###autoload
|
||||
(defun narf:next-real-buffer ()
|
||||
"Switch to the next buffer and avoid special buffers."
|
||||
(interactive)
|
||||
(narf--cycle-real-buffer +1))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:previous-real-buffer ()
|
||||
"Switch to the previous buffer and avoid special buffers."
|
||||
(interactive)
|
||||
(narf--cycle-real-buffer -1))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:kill-real-buffer ()
|
||||
"Kill buffer (but only bury scratch buffer)"
|
||||
(interactive)
|
||||
(let ((bname (buffer-name)))
|
||||
(cond ((string-match-p "^\\*scratch\\*" bname)
|
||||
(erase-buffer)
|
||||
(bury-buffer))
|
||||
((string-equal "*" (substring bname 0 1))
|
||||
(previous-buffer))
|
||||
(t (kill-this-buffer)))))
|
||||
|
||||
;;;###autoload (autoload 'narf::save-session "defuns-buffers")
|
||||
(evil-define-command narf::save-session (&optional bang session-name)
|
||||
(interactive "<!><a>")
|
||||
(if session-name
|
||||
(wg-save-session-as (concat wg-workgroup-directory session-name) (not bang))
|
||||
(wg-save-session)))
|
||||
|
||||
;;;###autoload (autoload 'narf::load-session "defuns-buffers")
|
||||
(evil-define-command narf::load-session (&optional bang session-name)
|
||||
(interactive "<!><a>")
|
||||
(wg-open-session (if session-name
|
||||
(concat wg-workgroup-directory session-name)
|
||||
wg-session-file)))
|
||||
|
||||
;;;###autoload (autoload 'narf::new-workgroup "defuns-buffers")
|
||||
(evil-define-command narf::new-workgroup (bang name)
|
||||
(interactive "<!><a>")
|
||||
(unless name
|
||||
(user-error "No name specified for new workgroup"))
|
||||
(if bang
|
||||
(wg-clone-workgroup (wg-current-workgroup) name)
|
||||
(wg-create-workgroup name t)))
|
||||
|
||||
;;;###autoload (autoload 'narf::rename-workgroup "defuns-buffers")
|
||||
(evil-define-command narf::rename-workgroup (new-name)
|
||||
(interactive "<a>")
|
||||
(wg-rename-workgroup new-name))
|
||||
|
||||
;;;###autoload (autoload 'narf::rename-this-file "defuns-buffers")
|
||||
(evil-define-command narf::rename-this-file (new-name)
|
||||
"Renames current buffer and file it is visiting. Replaces %, # and other
|
||||
variables (see `evil-ex-replace-special-filenames')"
|
||||
:repeat nil
|
||||
(interactive "<f>")
|
||||
(let ((name (buffer-name))
|
||||
(filename (buffer-file-name)))
|
||||
(if (not (and filename (file-exists-p filename)))
|
||||
(error "Buffer '%s' is not visiting a file!" name)
|
||||
(let ((new-name
|
||||
(expand-file-name
|
||||
(evil-ex-replace-special-filenames (if new-name
|
||||
new-name
|
||||
(read-file-name "New name: " filename)))
|
||||
(f-dirname filename))))
|
||||
(if (get-buffer new-name)
|
||||
(error "A buffer named '%s' already exists!" new-name)
|
||||
(rename-file filename new-name 1)
|
||||
(rename-buffer new-name)
|
||||
(set-visited-file-name new-name)
|
||||
(set-buffer-modified-p nil)
|
||||
(save-place-forget-unreadable-files)
|
||||
(message "File '%s' successfully renamed to '%s'"
|
||||
name (file-name-nondirectory new-name)))))))
|
||||
|
||||
;;;###autoload (autoload 'narf::delete-this-file "defuns-buffers")
|
||||
(evil-define-command narf::delete-this-file (&optional bang)
|
||||
"Delete current buffer's file. If bang, then kill the buffer afterwards as well."
|
||||
:repeat nil
|
||||
(interactive "<!>")
|
||||
(let ((filename (file-truename (buffer-file-name))))
|
||||
(if (not (file-exists-p filename))
|
||||
(error "File doesn't exist: %s" filename)
|
||||
(delete-file filename)
|
||||
(when bang (kill-this-buffer))
|
||||
(save-place-forget-unreadable-files)
|
||||
(message "File successfully deleted: %s" filename))))
|
||||
|
||||
(defun narf--save-exit() (save-buffer) (kill-buffer) (remove-hook 'yas-after-exit-snippet-hook '--save-exit))
|
||||
;;;###autoload (autoload 'narf::create-file "defuns-buffers")
|
||||
(evil-define-command narf::create-file (path &optional bang)
|
||||
"Deploy files (and their associated templates) quickly. Will prompt
|
||||
you to fill in each snippet field before buffer closes unless BANG is
|
||||
provided."
|
||||
:repeat nil
|
||||
(interactive "<f><!>")
|
||||
(let ((dir (f-dirname path))
|
||||
(fullpath (f-full path))
|
||||
(is-auto t))
|
||||
(when (and bang (not (file-exists-p dir))) (f-mkdir dir))
|
||||
(if (file-exists-p dir)
|
||||
(if (file-exists-p fullpath)
|
||||
(error "File already exists: %s" path)
|
||||
(find-file fullpath)
|
||||
(add-hook 'yas-after-exit-snippet-hook 'narf--save-exit)
|
||||
(if bang (--save-exit)))
|
||||
(error "Directory doesn't exist: %s" dir))))
|
||||
|
||||
;;;###autoload (autoload 'narf::scratch-buffer "defuns-buffers")
|
||||
(evil-define-operator narf::scratch-buffer (&optional beg end bang)
|
||||
"Send a selection to the scratch buffer. If BANG, then send it to org-capture
|
||||
instead."
|
||||
:move-point nil
|
||||
:type inclusive
|
||||
(interactive "<r><!>")
|
||||
(let ((mode major-mode)
|
||||
(text (when (and (evil-visual-state-p) beg end)
|
||||
(buffer-substring beg end))))
|
||||
(if bang
|
||||
;; use org-capture with bang
|
||||
(if text
|
||||
(org-capture-string text)
|
||||
(org-capture))
|
||||
;; or scratch buffer by default
|
||||
(let* ((project-dir (narf/project-root t))
|
||||
(buffer-name (if project-dir
|
||||
(format "*scratch* (%s)" (narf/project-name))
|
||||
"*scratch*")))
|
||||
(popwin:popup-buffer (get-buffer-create buffer-name))
|
||||
(when (eq (get-buffer buffer-name) (current-buffer))
|
||||
(when project-dir
|
||||
(cd project-dir))
|
||||
(if text (insert text))
|
||||
(funcall mode))))))
|
||||
|
||||
;;;###autoload (autoload 'narf::kill-buried-buffers "defuns-buffers")
|
||||
(evil-define-command narf::kill-buried-buffers (&optional bang)
|
||||
:repeat nil
|
||||
(interactive "<!>")
|
||||
(mapc 'kill-buffer
|
||||
(narf/living-buffer-list (if bang (projectile-project-buffers) (buffer-list)))))
|
||||
|
||||
;;;###autoload (autoload 'narf::kill-buffers "defuns-buffers")
|
||||
(evil-define-command narf::kill-buffers (&optional bang)
|
||||
:repeat nil
|
||||
(interactive "<!>")
|
||||
(if (and (not bang) (projectile-project-p))
|
||||
(projectile-kill-buffers)
|
||||
(mapc 'kill-buffer (buffer-list)))
|
||||
(delete-other-windows)
|
||||
(switch-to-buffer (if (buffer-live-p narf--project-scratch-buffer)
|
||||
narf--project-scratch-buffer
|
||||
(get-buffer-create "*scratch*"))))
|
||||
|
||||
;;;###autoload (autoload 'narf::cd "defuns-buffers")
|
||||
(evil-define-command narf::cd (dir)
|
||||
:repeat nil
|
||||
(interactive "<f>")
|
||||
(cd (if (zerop (length dir)) "~" dir)))
|
||||
|
||||
|
||||
(provide 'defuns-buffers)
|
||||
;;; defuns-buffers.el ends here
|
|
@ -1,83 +0,0 @@
|
|||
;;;; Code building ;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defvar narf--build-command '("make %s" . "Makefile"))
|
||||
(make-variable-buffer-local 'narf--build-command)
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/set-build-command (command &optional file)
|
||||
(when (or (null file)
|
||||
(narf/project-has-files file))
|
||||
(setq narf--build-command `(,command . ,file))))
|
||||
|
||||
;;;###autoload (autoload 'narf::build "defuns-code")
|
||||
(evil-define-command narf::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 narf--build-command)
|
||||
(user-error "No build command was set"))
|
||||
(let ((build-file (cdr narf--build-command))
|
||||
(build-cmd (car narf--build-command)))
|
||||
(if (narf/project-has-files build-file)
|
||||
(compile (format "cd '%s' && %s" build-file (format build-cmd (or arg ""))))
|
||||
(error "Could not find Makefile"))))
|
||||
|
||||
|
||||
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;###autoload (autoload 'narf::eval "defuns-code")
|
||||
(evil-define-operator narf::eval ()
|
||||
:move-point nil
|
||||
(interactive)
|
||||
(cond ((region-active-p)
|
||||
(narf::eval-region (region-beginning) (region-end)))
|
||||
(t (narf::eval-buffer))))
|
||||
|
||||
;;;###autoload (autoload 'narf::eval-region "defuns-code")
|
||||
(evil-define-operator narf::eval-region (beg end)
|
||||
:move-point nil
|
||||
(interactive "<r>")
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
(let* ((pp-escape-newlines nil)
|
||||
(out (s-trim (pp-to-string (eval (read (buffer-substring-no-properties beg end))))))
|
||||
(lines (length (s-lines out))))
|
||||
(if (< lines 5)
|
||||
(princ out t)
|
||||
(let ((buf (get-buffer-create "*eval*")))
|
||||
(with-current-buffer buf
|
||||
(read-only-mode -1)
|
||||
(emacs-lisp-mode)
|
||||
(setq-local scroll-margin 0)
|
||||
(erase-buffer)
|
||||
(insert out)
|
||||
(beginning-of-buffer)
|
||||
(read-only-mode 1)
|
||||
(popwin:popup-buffer buf :height (if (> lines 25) 25 (1+ lines))))))))
|
||||
(t (quickrun-region beg end))))
|
||||
|
||||
;;;###autoload (autoload 'narf::eval-buffer "defuns-code")
|
||||
(evil-define-command narf::eval-buffer ()
|
||||
:move-point nil
|
||||
(interactive)
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
(narf::eval-region (point-min) (point-max)))
|
||||
(t (quickrun))))
|
||||
|
||||
;;;###autoload (autoload 'narf::eval-region-and-replace "defuns-code")
|
||||
(evil-define-operator narf::eval-region-and-replace (beg end)
|
||||
(interactive "<r>")
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
(kill-region beg end)
|
||||
(condition-case nil
|
||||
(prin1 (eval (read (current-kill 0)))
|
||||
(current-buffer))
|
||||
(error (message "Invalid expression")
|
||||
(insert (current-kill 0)))))
|
||||
(t (quickrun-replace-region beg end))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-interpreter ()
|
||||
(car (--first (eq (cdr it) major-mode) interpreter-mode-alist)))
|
||||
|
||||
|
||||
(provide 'defuns-code)
|
||||
;;; defuns-code.el ends here
|
|
@ -1,30 +0,0 @@
|
|||
;; Misc Defuns ;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;###autoload
|
||||
(defun what-face (pos)
|
||||
"Tells you the name of the face (point) is on."
|
||||
(interactive "d")
|
||||
(let ((face (or (get-char-property (point) 'read-face-name)
|
||||
(get-char-property (point) 'face))))
|
||||
(if face (message "Face: %s" face) (message "No face at %d" pos))))
|
||||
|
||||
;;;###autoload
|
||||
(defun what-col ()
|
||||
(interactive)
|
||||
(message "Column %d" (current-column)))
|
||||
|
||||
;;;###autoload
|
||||
(defun what-bindings (key)
|
||||
(list
|
||||
(minor-mode-key-binding key)
|
||||
(local-key-binding key)
|
||||
(global-key-binding key)))
|
||||
|
||||
;;;###autoload (autoload 'narf::echo "defuns-debug")
|
||||
(evil-define-command narf::echo (message)
|
||||
"Display MSG in echo-area without logging it in *Messages* buffer."
|
||||
(interactive "<a>")
|
||||
(let (message-log-max)
|
||||
(message "%s" message)))
|
||||
|
||||
|
||||
(provide 'defuns-debug)
|
|
@ -1,126 +0,0 @@
|
|||
;;;; HTML ;;;;
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:replace-ms-word-chars (beg end)
|
||||
"Replace smart quotes and other MS Word verbiage into plain text"
|
||||
(interactive "r")
|
||||
(replace-regexp "…" "..." nil beg end)
|
||||
(replace-regexp "[‘’]" "'" nil beg end)
|
||||
(replace-regexp "[“”]" "\"" nil beg end))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:replace-email2mailto (beg end)
|
||||
"Email address with mailto link"
|
||||
(interactive "r")
|
||||
(replace-regexp "\\b\\([a-zA-Z0-9._+-%]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]+\\)\\b"
|
||||
"<a href=\"mailto:\\1\">\\1</a>"
|
||||
nil beg end))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:replace-url2anchor (beg end)
|
||||
"Link with anchor"
|
||||
(interactive "r")
|
||||
(replace-regexp "\\bhttps?://.+?\\b"
|
||||
"<a href=\"\\1\">\\1</a>"
|
||||
nil beg end))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; A hacky attempt to replace ace-jump line mode that incrementally shows where
|
||||
;; you will land as you type the line number.
|
||||
(defun narf--goto-line (line)
|
||||
(let ((lines (count-lines (point-min) (point-max))))
|
||||
(if (and (<= line (1+ lines))
|
||||
(> line 0))
|
||||
(narf/nlinum-hl-line line)
|
||||
(narf/nlinum-hl-line))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:goto-line ()
|
||||
(interactive)
|
||||
(let ((keys '())
|
||||
(orig-point (point))
|
||||
(echo-keystrokes 0))
|
||||
(evil-save-echo-area
|
||||
(catch 'abort
|
||||
(while t
|
||||
(let* ((keystr (concat keys))
|
||||
(key (read-event (concat ":" keystr))))
|
||||
(cond ((eq key 'escape)
|
||||
(message "%s" key)
|
||||
(throw 'abort t))
|
||||
((eq key 'return)
|
||||
(when keys
|
||||
(goto-line (string-to-number keystr)))
|
||||
(throw 'abort t))
|
||||
((eq key 'backspace)
|
||||
(let ((key-len (length keys)))
|
||||
(if (= key-len 0)
|
||||
(throw 'abort t)
|
||||
(if (> key-len 1)
|
||||
(progn
|
||||
(nbutlast keys)
|
||||
(narf--goto-line (string-to-number (concat keys))))
|
||||
(setq keys '())
|
||||
(narf/nlinum-hl-line)))))
|
||||
((and (characterp key)
|
||||
(s-numeric? (char-to-string key)))
|
||||
(setq keys (append keys (list key)))
|
||||
(narf--goto-line (string-to-number (concat keys))))
|
||||
(t
|
||||
(if (or (char-equal key ?\C-n)
|
||||
(char-equal key ?\C-j))
|
||||
(progn
|
||||
(setq keys (number-to-string (1+ (string-to-number (concat keys)))))
|
||||
(narf--goto-line (string-to-number (concat keys))))
|
||||
(when (or (char-equal key ?\C-p)
|
||||
(char-equal key ?\C-k))
|
||||
(setq keys (number-to-string (1- (string-to-number (concat keys)))))
|
||||
(narf--goto-line (string-to-number (concat keys)))))))))))))
|
||||
|
||||
;;;###autoload (autoload 'narf::align "defuns-edit")
|
||||
(evil-define-command narf::align (beg end &optional regexp bang)
|
||||
:repeat nil
|
||||
(interactive "<r><a><!>")
|
||||
(when regexp
|
||||
(align-regexp beg end
|
||||
(concat "\\(\\s-*\\)" (rxt-pcre-to-elisp regexp)) 1 1)))
|
||||
|
||||
;;;###autoload (autoload 'narf::retab "defuns-edit")
|
||||
(evil-define-operator narf::retab (beg end)
|
||||
"Akin to vim's narf::retab, this changes all tabs-to-spaces or spaces-to-tabs,
|
||||
depending on `indent-tab-mode'. Untested."
|
||||
:motion nil
|
||||
:move-point nil
|
||||
:type line
|
||||
(interactive "<r>")
|
||||
(unless (and beg end)
|
||||
(setq beg (point-min))
|
||||
(setq end (point-max)))
|
||||
(if indent-tabs-mode
|
||||
(tabify beg end)
|
||||
(untabify beg end)))
|
||||
|
||||
;;;###autoload (autoload 'narf::narrow-indirect-or-widen "defuns-edit")
|
||||
(evil-define-operator narf::narrow-indirect-or-widen (beg end)
|
||||
"Indirectly narrow the region from BEG to END."
|
||||
:move-point nil
|
||||
:type exclusive
|
||||
:repeat nil
|
||||
(interactive "<r>")
|
||||
(evil-normal-state)
|
||||
(if (buffer-narrowed-p)
|
||||
(narf:widen)
|
||||
(narf:narrow-to-region-indirect beg end)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:toggle-delete-trailing-whitespace ()
|
||||
(interactive)
|
||||
(if (-contains-p before-save-hook 'delete-trailing-whitespace)
|
||||
(progn (narf|disable-delete-trailing-whitespace)
|
||||
(message "delete-trailing-whitespaces OFF"))
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
(message "delete-trailing-whitespaces ON")))
|
||||
|
||||
|
||||
(provide 'defuns-edit)
|
||||
;;; defuns-edit.el ends here
|
|
@ -1,37 +0,0 @@
|
|||
;;; defuns-extern.el -- for external operations
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-send (command)
|
||||
(shell-command (format "tmux send-keys %s" command)))
|
||||
|
||||
(evil-define-interactive-code "<tmux>"
|
||||
"Ex tmux argument (a mix between <sh> <f> and <fsh>)"
|
||||
:ex-arg shell
|
||||
(list (when (evil-ex-p) (evil-ex-file-arg))))
|
||||
|
||||
;;;###autoload (autoload 'narf::tmux-run "defuns-extern")
|
||||
(evil-define-command narf::tmux-run (&optional command bang)
|
||||
"Sends input to tmux. Use `bang' to append to tmux"
|
||||
(interactive "<tmux><!>")
|
||||
(nerf/tmux-send (format (if bang "C-u %s Enter" "%s")
|
||||
(shell-quote-argument command)))
|
||||
(when (evil-ex-p)
|
||||
(message "[Tmux] %s" command)))
|
||||
|
||||
;;;###autoload (autoload 'narf::tmux-chdir "defuns-extern")
|
||||
(evil-define-command narf::tmux-chdir (&optional path bang)
|
||||
"CDs in tmux using `narf/project-root'"
|
||||
(interactive "<f><!>")
|
||||
(let ((dir (shell-quote-argument
|
||||
(if (and path (not (s-blank? path)))
|
||||
(if (file-directory-p path)
|
||||
(file-truename path)
|
||||
(error "Directory doesn't exist %s" path))
|
||||
(if bang default-directory (narf/project-root))))))
|
||||
(nerf/tmux-send (format "C-u cd Space %s Enter" (shell-quote-argument dir)))
|
||||
(when (evil-ex-p)
|
||||
(message "[Tmux] cd %s" dir))))
|
||||
|
||||
|
||||
(provide 'defuns-extern)
|
||||
;;; defuns-extern.el ends here
|
|
@ -1,39 +0,0 @@
|
|||
;;;###autoload
|
||||
(defun narf/mouse-line-at-click ()
|
||||
"Determine the line number at click"
|
||||
(save-excursion
|
||||
(let ((click-y (cddr (mouse-position)))
|
||||
(debug-on-error t)
|
||||
(line-move-visual t))
|
||||
(goto-char (window-start))
|
||||
(next-line (1- click-y))
|
||||
(1+ (line-number-at-pos)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/mouse-select-line (event)
|
||||
"Set point as *linum-mdown-line*"
|
||||
(interactive "e")
|
||||
(mouse-select-window event)
|
||||
(goto-line (narf/mouse-line-at-click))
|
||||
(evil-visual-line)
|
||||
(setq *linum-mdown-line* (line-number-at-pos)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/mouse-select-block ()
|
||||
"Select the current block of text between blank lines."
|
||||
(interactive)
|
||||
(let (p1 p2)
|
||||
(progn
|
||||
(if (re-search-backward "\n[ \t]*\n" nil "move")
|
||||
(progn (re-search-forward "\n[ \t]*\n")
|
||||
(setq p1 (point)))
|
||||
(setq p1 (point)))
|
||||
(if (re-search-forward "\n[ \t]*\n" nil "move")
|
||||
(progn (re-search-backward "\n[ \t]*\n")
|
||||
(setq p2 (point)))
|
||||
(setq p2 (point))))
|
||||
(set-mark p1)))
|
||||
|
||||
|
||||
(provide 'defuns-mouse)
|
||||
;;; defuns-mouse.el ends here
|
|
@ -1,92 +0,0 @@
|
|||
;;;###autoload
|
||||
(defun narf/project-org-filename (cat)
|
||||
(interactive (list (completing-read "Choose category:"
|
||||
(mapcar 'f-filename (f-directories org-project-directory)))))
|
||||
(expand-file-name (concat (file-name-nondirectory (directory-file-name (narf/project-root))) ".org")
|
||||
(expand-file-name cat org-project-directory)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf--org-in-list-p ()
|
||||
(and (save-excursion (search-backward-regexp "^ *\\([0-9]+[\.)]\\|[-*+]\\) "
|
||||
(line-beginning-position) t))
|
||||
(org-in-item-p)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-insert-item-after ()
|
||||
"Inserts a new heading or item, depending on the context."
|
||||
(interactive)
|
||||
(org-end-of-line)
|
||||
(cond ((org-at-item-checkbox-p)
|
||||
(org-insert-heading)
|
||||
(insert "[ ] "))
|
||||
((narf--org-in-list-p)
|
||||
(org-insert-heading))
|
||||
((org-on-heading-p)
|
||||
(org-insert-heading-after-current))
|
||||
(t
|
||||
(org-insert-heading-after-current)
|
||||
(delete-char 1)))
|
||||
(evil-insert-state))
|
||||
|
||||
;; TODO Check if this and -forward can be combined
|
||||
;;;###autoload
|
||||
(defun narf/org-insert-item-before ()
|
||||
"Inserts a new heading or item, depending on the context."
|
||||
(interactive)
|
||||
(evil-first-non-blank)
|
||||
(cond ((org-at-item-checkbox-p)
|
||||
(org-insert-heading)
|
||||
(insert "[ ] "))
|
||||
((narf--org-in-list-p)
|
||||
(org-insert-heading))
|
||||
(t (org-insert-heading)))
|
||||
(evil-insert-state))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-toggle-checkbox ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(org-end-of-line)
|
||||
(cond ((org-in-item-p)
|
||||
(if (search-backward-regexp "\\[[ +-]\\]" (line-beginning-position) t)
|
||||
(delete-char 4)
|
||||
(org-beginning-of-line)))
|
||||
(t (org-insert-heading)))
|
||||
(insert "[ ] ")))
|
||||
|
||||
;; Formatting shortcuts
|
||||
;;;###autoload
|
||||
(defun narf/org-surround (delim)
|
||||
(insert delim) (save-excursion (insert delim)))
|
||||
|
||||
;;;###autoload (autoload 'narf::org-insert-image-url "defuns-org")
|
||||
(evil-define-command narf::org-insert-image-url (&optional image-url)
|
||||
:repeat nil
|
||||
(interactive "<f>")
|
||||
(unless image-url
|
||||
(user-error "You must specify an image URL to insert"))
|
||||
(let ((dest (f-join org-directory "images/" (concat (format-time-string "%Y%m%d-") (f-filename image-url)))))
|
||||
(shell-command (format "wget '%s' -O '%s'" image-url dest))
|
||||
(insert (format "<%s>" (f-relative dest (f-dirname (buffer-file-name)))))
|
||||
(indent-according-to-mode)))
|
||||
|
||||
;;;###autoload (autoload 'narf::org-insert-image "defuns-org")
|
||||
(evil-define-command narf::org-insert-image (&optional filename bang)
|
||||
:repeat nil
|
||||
(interactive "<f><!>")
|
||||
(if bang
|
||||
(narf::org-insert-image-url filename)
|
||||
(unless filename
|
||||
(user-error "You must specify a file to attach"))
|
||||
(unless (file-exists-p filename)
|
||||
(user-error "File %s does not exist" filename))
|
||||
(let ((dest (f-join org-directory "images/" (concat (format-time-string "%Y%m%d-") (f-filename filename)))))
|
||||
(when (file-exists-p dest)
|
||||
(user-error "File %s already exists at destination!"))
|
||||
(copy-file filename dest)
|
||||
(insert (format "<file:%s>" (f-relative dest (f-dirname (buffer-file-name)))))
|
||||
(indent-according-to-mode))))
|
||||
|
||||
|
||||
(provide 'defuns-org)
|
||||
;;; defuns-org.el ends here
|
|
@ -1,106 +0,0 @@
|
|||
;;;###autoload
|
||||
(defun narf:ido-find-file (&optional dir)
|
||||
(interactive)
|
||||
(let ((default-directory (or dir default-directory)))
|
||||
(ido-find-file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:ido-find-file-other-window (&optional dir)
|
||||
(interactive)
|
||||
(let ((default-directory (or dir default-directory)))
|
||||
(ido-find-file-other-window)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:ido-find-project-file ()
|
||||
(interactive)
|
||||
(let ((default-directory (narf/project-root)))
|
||||
(ido-find-file)))
|
||||
|
||||
;;;###autoload (autoload 'narf::initfiles "defuns-search")
|
||||
(evil-define-command narf::initfiles (&optional bang) :repeat nil
|
||||
(interactive "<!>")
|
||||
(if bang
|
||||
(ido-find-file-in-dir MODULES-DIR)
|
||||
(ido-find-file-in-dir BASE-DIR)))
|
||||
|
||||
;;;###autoload (autoload 'narf::notes "defuns-search")
|
||||
(evil-define-command narf::notes () :repeat nil
|
||||
(interactive)
|
||||
(require 'org)
|
||||
(ido-find-file-in-dir org-directory))
|
||||
|
||||
;; Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
|
||||
;; `bang', then `search' is interpreted as regexp
|
||||
;;;###autoload (autoload 'narf::recentf "defuns-search")
|
||||
(evil-define-command narf::recentf (&optional bang)
|
||||
:repeat nil
|
||||
(interactive "<!>")
|
||||
(if bang (helm-recentf) (helm-projectile-recentf)))
|
||||
|
||||
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
|
||||
;; regexp.
|
||||
;;;###autoload (autoload 'narf::ag-search "defuns-search")
|
||||
(evil-define-operator narf::ag-search (beg end &optional search hidden-files-p pwd-p regex-p)
|
||||
:type inclusive
|
||||
:repeat nil
|
||||
(interactive "<r><a><!>")
|
||||
(helm-alive-p)
|
||||
(let* ((helm-ag-default-directory (if pwd-p default-directory (narf/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)))
|
||||
|
||||
;;;###autoload (autoload 'narf::ag-regex-search "defuns-search")
|
||||
(evil-define-operator narf::ag-regex-search (beg end &optional search bang)
|
||||
:type inclusive :repeat nil
|
||||
(interactive "<r><a><!>")
|
||||
(narf::ag-search beg end search bang nil t))
|
||||
|
||||
;;;###autoload (autoload 'narf::ag-regex-cwd "defuns-search")
|
||||
(evil-define-operator narf::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><!>")
|
||||
(narf::ag-search beg end search bang t nil))
|
||||
|
||||
;;;###autoload (autoload 'narf::ag-regex-search-cwd "defuns-search")
|
||||
(evil-define-operator narf::ag-regex-search-cwd (beg end &optional search bang)
|
||||
:type inclusive :repeat nil
|
||||
(interactive "<r><a><!>")
|
||||
(narf::ag-search beg end search bang t t))
|
||||
|
||||
;; 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'
|
||||
;;;###autoload (autoload 'narf::swoop "defuns-search")
|
||||
(evil-define-command narf::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))))
|
||||
|
||||
;; TODO: Implement helm-find-file
|
||||
;;;###autoload (autoload 'narf::snippets "defuns-search")
|
||||
(evil-define-command narf::snippets (&optional bang)
|
||||
(interactive "<!><a>")
|
||||
(if bang
|
||||
(narf:ido-find-file SNIPPETS-DIR)
|
||||
(helm-yas-visit-snippet-file)))
|
||||
|
||||
|
||||
(provide 'defuns-search)
|
||||
;;; defuns-search.el ends here
|
|
@ -1,135 +0,0 @@
|
|||
;;;###autoload
|
||||
(defun narf--point-at-bol-non-blank()
|
||||
(save-excursion (evil-first-non-blank) (point)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/surrounded-p ()
|
||||
(and (looking-back "[[{(]\\(\s+\\|\n\\)?\\(\s\\|\t\\)*")
|
||||
(let* ((whitespace (match-string 1))
|
||||
(match-str (concat whitespace (match-string 2) "[])}]")))
|
||||
(looking-at-p match-str))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:backward-kill-to-bol-and-indent ()
|
||||
"Kill line to the first non-blank character. If invoked again
|
||||
afterwards, kill line to column 1."
|
||||
(interactive)
|
||||
(let ((empty-line (sp-point-in-blank-line)))
|
||||
(evil-delete (point-at-bol) (point))
|
||||
(if (not empty-line)
|
||||
(indent-according-to-mode))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:move-to-bol ()
|
||||
"Moves cursor to the first non-blank character on the line. If
|
||||
already there, move it to the true bol."
|
||||
(interactive)
|
||||
(evil-save-goal-column
|
||||
(let ((point-at-bol (narf--point-at-bol-non-blank))
|
||||
(point (point)))
|
||||
(if (= point-at-bol point)
|
||||
(evil-move-beginning-of-line)
|
||||
(unless (= (point-at-bol) point)
|
||||
(evil-first-non-blank))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:move-to-eol ()
|
||||
(interactive)
|
||||
(evil-save-goal-column
|
||||
(let ((old-point (point)))
|
||||
(when (comment-search-forward (point-at-eol) t)
|
||||
(goto-char (match-beginning 0))
|
||||
(skip-syntax-backward " ^<*" (narf--point-at-bol-non-blank))
|
||||
|
||||
(if (eq old-point (point)) ;
|
||||
(evil-move-end-of-line))))))
|
||||
|
||||
;; Mimic expandtab in vim
|
||||
;;;###autoload
|
||||
(defun narf:backward-delete-whitespace-to-column ()
|
||||
"Delete back to the previous column of whitespace, or as much
|
||||
whitespace as possible, or just one char if that's not possible."
|
||||
(interactive)
|
||||
(cond ;; If in a string
|
||||
((sp-point-in-string)
|
||||
(call-interactively 'backward-delete-char-untabify))
|
||||
;; If using tabs (or at bol), just delete normally
|
||||
((or indent-tabs-mode
|
||||
(= (point-at-bol) (point)))
|
||||
(call-interactively 'backward-delete-char))
|
||||
;; Delete up to the nearest tab column IF only whitespace between point
|
||||
;; and bol.
|
||||
((looking-back "^[\\t ]*" (point-at-bol))
|
||||
(let ((movement (% (current-column) tab-width))
|
||||
(p (point)))
|
||||
(when (= movement 0)
|
||||
(setq movement tab-width))
|
||||
(save-match-data
|
||||
(if (string-match "\\w*\\(\\s-+\\)$"
|
||||
(buffer-substring-no-properties (- p movement) p))
|
||||
(sp-backward-delete-char (- (match-end 1) (match-beginning 1)))
|
||||
(backward-delete-char-untabify 1)))))
|
||||
;; Otherwise do a regular delete
|
||||
(t (backward-delete-char-untabify 1))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:dumb-indent ()
|
||||
"Inserts a tab character (or spaces x tab-width). Checks if the
|
||||
auto-complete window is open."
|
||||
(interactive)
|
||||
(if indent-tabs-mode
|
||||
(insert "\t")
|
||||
(let* ((movement (% (current-column) tab-width))
|
||||
(spaces (if (zerop movement) tab-width (- tab-width movement))))
|
||||
(insert (s-repeat spaces " ")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:inflate-space-maybe ()
|
||||
"Checks if point is surrounded by {} [] () delimiters and adds a
|
||||
space on either side of the point if so."
|
||||
(interactive)
|
||||
(if (narf/surrounded-p)
|
||||
(progn (call-interactively 'self-insert-command)
|
||||
(save-excursion (call-interactively 'self-insert-command)))
|
||||
(call-interactively 'self-insert-command)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:deflate-space-maybe ()
|
||||
"Checks if point is surrounded by {} [] () delimiters, and deletes
|
||||
spaces on either side of the point if so. Resorts to
|
||||
`narf:backward-delete-whitespace-to-column' otherwise."
|
||||
(interactive)
|
||||
(save-match-data
|
||||
(if (narf/surrounded-p)
|
||||
(let ((whitespace-match (match-string 1)))
|
||||
(cond ((not whitespace-match)
|
||||
(call-interactively 'sp-backward-delete-char))
|
||||
((string-match "\n" whitespace-match)
|
||||
(evil-delete (point-at-bol) (point))
|
||||
(delete-char -1)
|
||||
(save-excursion (delete-char 1)))
|
||||
(t
|
||||
(just-one-space 0))))
|
||||
(narf:backward-delete-whitespace-to-column))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:newline-and-indent ()
|
||||
(interactive)
|
||||
(cond
|
||||
((sp-point-in-string)
|
||||
(newline))
|
||||
((sp-point-in-comment)
|
||||
(cond ((eq major-mode 'js2-mode)
|
||||
(js2-line-break))
|
||||
((-contains? '(java-mode php-mode) major-mode)
|
||||
(c-indent-new-comment-line))
|
||||
((-contains? '(c-mode c++-mode objc-mode css-mode scss-mode) major-mode)
|
||||
(newline-and-indent)
|
||||
(insert "* ")
|
||||
(indent-according-to-mode))
|
||||
(t (indent-new-comment-line))))
|
||||
(t (newline-and-indent))))
|
||||
|
||||
|
||||
(provide 'defuns-text)
|
||||
;;; defuns-text.el ends here
|
|
@ -1,27 +0,0 @@
|
|||
(eval-when-compile (require 'cl))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:toggle-transparency ()
|
||||
(interactive)
|
||||
(let* ((alpha (frame-parameter nil 'alpha))
|
||||
(alpha-val (if (listp alpha) (car alpha) alpha)))
|
||||
(if (/= alpha-val 97)
|
||||
(set-frame-parameter nil 'alpha 100)
|
||||
(set-frame-parameter nil 'alpha 0))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:toggle-fullscreen ()
|
||||
(interactive)
|
||||
(set-frame-parameter nil 'fullscreen
|
||||
(when (not (frame-parameter nil 'fullscreen)) 'fullboth)))
|
||||
|
||||
(defconst BIG-FONT (font-spec :family "Inconsolata" :size 18 :antialias t))
|
||||
(defvar narf--big-mode nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:toggle-big-mode ()
|
||||
(interactive)
|
||||
(if narf--big-mode
|
||||
(set-frame-font DEFAULT-FONT)
|
||||
(set-frame-font BIG-FONT))
|
||||
(setq narf--big-mode (not narf--big-mode)))
|
299
core/defuns.el
299
core/defuns.el
|
@ -1,299 +0,0 @@
|
|||
(require 's)
|
||||
(require 'dash)
|
||||
(require 'f)
|
||||
|
||||
;; Compatibility ;;;;;;;;;;;;;;;;;;;
|
||||
;; Backwards compatible `with-eval-after-load'
|
||||
(unless (fboundp 'with-eval-after-load)
|
||||
(defmacro with-eval-after-load (file &rest body)
|
||||
`(eval-after-load ,file
|
||||
`(funcall (function ,(lambda () ,@body))))))
|
||||
|
||||
(defmacro after (feature &rest forms)
|
||||
(declare (indent defun))
|
||||
`(,(if (or (not (boundp 'byte-compile-current-file))
|
||||
(not byte-compile-current-file)
|
||||
(if (symbolp feature)
|
||||
(require feature nil :no-error)
|
||||
(load feature :no-message :no-error)))
|
||||
'progn
|
||||
(message "after: cannot find %s" feature)
|
||||
'with-no-warnings)
|
||||
(with-eval-after-load ',feature ,@forms)))
|
||||
|
||||
(defmacro shut-up (&rest body)
|
||||
"Silence message output from code."
|
||||
(declare (indent defun))
|
||||
`(let (message-log-max)
|
||||
,@body
|
||||
(message "")))
|
||||
|
||||
(eval-when-compile
|
||||
;; Convenience ;;;;;;;;;;;;;;;;;;;;;
|
||||
(defmacro λ (&rest body)
|
||||
"A shortcut for: `(lambda () (interactive) ,@body)"
|
||||
`(lambda () (interactive) ,@body))
|
||||
|
||||
(defmacro associate-mode (match mode)
|
||||
"Associate a major mode with a filepath through `auto-mode-alist'"
|
||||
`(add-to-list 'auto-mode-alist (cons ,match ,mode)))
|
||||
|
||||
(defmacro associate-minor-mode (match mode)
|
||||
"Associate a minor mode with a filepath through `auto-minor-mode-alist'"
|
||||
`(add-to-list 'narf/auto-minor-mode-alist (cons ,match ,mode)))
|
||||
|
||||
;; (defmacro add-to-mode (mode funcs))
|
||||
;; (defmacro add-to-modes (func modes)
|
||||
;; (add-to-hooks))
|
||||
|
||||
(defmacro add-to-hook (hook funcs)
|
||||
"Add a series of FUNCS to a hook. FUNCS can be a list."
|
||||
(declare (indent 1))
|
||||
`(progn ,@(mapcar (lambda (func) `(add-hook ',(eval hook) ',func)) (eval funcs))))
|
||||
|
||||
(defmacro add-to-hooks (func hooks)
|
||||
"Add one FUNC to a series of hooks. HOOKS can be a list."
|
||||
(declare (indent 1))
|
||||
`(progn ,@(mapcar (lambda (hook) `(add-hook ',hook ',(eval func))) (eval hooks))))
|
||||
|
||||
(defmacro add-hook! (hook &rest body)
|
||||
"A shortcut macro for `add-hook' that auto-wraps `body' in a lambda"
|
||||
(declare (indent 1))
|
||||
`(add-hook ,hook (lambda() ,@body)))
|
||||
|
||||
;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(after "evil"
|
||||
(defmacro excmd (command func)
|
||||
"An alternative to `evil-ex-define-cmd' that won't choke on autoload
|
||||
functions being registered as ex commands."
|
||||
`(evil-ex-define-cmd ,command ,func))
|
||||
|
||||
(defmacro excmd! (command func)
|
||||
`(evil-ex-define-cmd ,command (lambda () (interactive) (call-interactively ,func))))
|
||||
|
||||
(defmacro bind (&rest keys)
|
||||
"A minimalistic and evil-centric way of binding keys. KEYS is
|
||||
made up of either:
|
||||
|
||||
1. Any of the following keywords:
|
||||
|
||||
:if CONDITION Determines where these keymaps should be set.
|
||||
:prefix PREFIX Key(s) to prefix keymappings with
|
||||
:map KEYMAP Keymaps to bind keys to. Can be a list.
|
||||
:global Tags these keymaps for the global keymap
|
||||
:local Ditto, but for local keymap
|
||||
:leader Like :prefix ?,
|
||||
:localleader Like :prefix ?\\
|
||||
:<evil state> e.g. :normal ;visual and so on. Anything that
|
||||
`evil-state-p' recognizes You can stack to
|
||||
make a key present in more than one state.
|
||||
|
||||
2. A key (as a vector e.g. [escape], a string \"<escape>\", or
|
||||
character ?\^?).
|
||||
|
||||
3. A key definition: a symbol or a lambda function. "
|
||||
(declare (indent 9999))
|
||||
(let* ((condition t)
|
||||
(default-keymaps '(narf-mode-map))
|
||||
(keymaps default-keymaps)
|
||||
(forms '())
|
||||
(consecutive t)
|
||||
(states '())
|
||||
prefix local-p
|
||||
key def)
|
||||
(while keys
|
||||
(setq key (pop keys))
|
||||
(cond ((or (evil-state-p key)
|
||||
(and (listp key)
|
||||
(--all? (evil-state-p it) key)))
|
||||
(setq states (-list key)))
|
||||
|
||||
((keywordp key)
|
||||
(cl-case key
|
||||
(:prefix
|
||||
(let ((val (pop keys)))
|
||||
(cond ((or (stringp val)
|
||||
(characterp val)
|
||||
(vectorp val))
|
||||
(setq prefix val))
|
||||
((eq val 'leader)
|
||||
(setq prefix narf/leader-key))
|
||||
((eq val 'localleader)
|
||||
(setq prefix narf/localleader-key))
|
||||
(t (signal 'bind-invalid-prefix prefix)))))
|
||||
(:map
|
||||
(let ((val (pop keys)))
|
||||
(cond ((or (symbolp val) (listp val))
|
||||
(setq keymaps (-list val)))
|
||||
((null val)
|
||||
(setq keymaps default-keymaps))
|
||||
(t (signal 'bind-invalid-keymaps '(key val))))))
|
||||
(:if (setq condition (pop keys)))
|
||||
(:local (setq local-p (pop keys)))
|
||||
;; TODO: Deprecated
|
||||
(otherwise
|
||||
(let ((keyword (intern-soft (substring (symbol-name key) 1)))
|
||||
(next-key (cadr keys)))
|
||||
(when (evil-state-p keyword)
|
||||
(setq local-p nil)
|
||||
(if consecutive
|
||||
(cl-pushnew keyword states)
|
||||
(setq states (list keyword))))
|
||||
(setq consecutive t)))))
|
||||
|
||||
;; key-definition pairs
|
||||
((or (stringp key)
|
||||
(vectorp key)
|
||||
(characterp key))
|
||||
(unless keys (signal 'bind-no-definition key))
|
||||
(setq def (pop keys))
|
||||
(when condition
|
||||
;; Process the key
|
||||
(cond ((stringp key) (setq key (kbd key)))
|
||||
((characterp key) (setq key (string key))))
|
||||
(when prefix
|
||||
(setq key (if (vectorp key)
|
||||
(vconcat prefix key)
|
||||
(concat (kbd prefix) key))))
|
||||
;; Do the binding
|
||||
(if (null states)
|
||||
(dolist (keymap keymaps)
|
||||
(add-to-list 'forms `(define-key ,keymap ,key ,def) t))
|
||||
(dolist (state (-list states))
|
||||
(when local-p
|
||||
(setq keymaps (list (make-symbol (format "evil-%s-state-local-mode-map" state)))))
|
||||
(dolist (keymap keymaps)
|
||||
(add-to-list 'forms `(define-key ,(if local-p keymap `(evil-get-auxiliary-keymap ,keymap ',state t)) ,key ,def) t)))))
|
||||
(setq consecutive nil))
|
||||
|
||||
;; fallback
|
||||
(t (signal 'bind-invalid-key key))))
|
||||
(when DEBUG-MODE (message "%s" forms))
|
||||
`(progn ,@forms)))))
|
||||
|
||||
(after "evil"
|
||||
(evil-define-command narf:exit-mode-maybe ()
|
||||
"Exits insert mode using jk without the momentary pause caused by
|
||||
key-chord-define."
|
||||
:repeat change
|
||||
(interactive)
|
||||
(let ((modified (buffer-modified-p)))
|
||||
(call-interactively 'self-insert-command)
|
||||
(let ((evt (read-event nil nil 0.4)))
|
||||
(cond
|
||||
((null evt) (message ""))
|
||||
((and (integerp evt) (char-equal evt ?k))
|
||||
|
||||
(if (evil-replace-state-p)
|
||||
(evil-replace-backspace)
|
||||
(delete-char -1))
|
||||
(set-buffer-modified-p modified)
|
||||
(push 'escape unread-command-events))
|
||||
(t
|
||||
(setq unread-command-events (append unread-command-events (list evt)))))))))
|
||||
|
||||
;; Hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defun narf|enable-comment-hard-wrap ()
|
||||
(set (make-local-variable 'comment-auto-fill-only-comments) t)
|
||||
(turn-on-auto-fill))
|
||||
|
||||
(defun narf|enable-hard-wrap ()
|
||||
(turn-on-auto-fill))
|
||||
|
||||
(defun narf|enable-tab-width-2 ()
|
||||
(setq tab-width 2 evil-shift-width 2))
|
||||
|
||||
(defun narf|enable-tab-width-4 ()
|
||||
(setq tab-width 4 evil-shift-width 4))
|
||||
|
||||
(defun narf|disable-final-newline ()
|
||||
(set (make-local-variable 'require-final-newline) nil))
|
||||
|
||||
(defun narf|enable-tabs ()
|
||||
(setq indent-tabs-mode t))
|
||||
|
||||
(defun narf|disable-tabs ()
|
||||
(setq indent-tabs-mode nil))
|
||||
|
||||
(defun narf|disable-delete-trailing-whitespace ()
|
||||
(remove-hook 'before-save-hook 'delete-trailing-whitespace))
|
||||
|
||||
|
||||
;;;; Global Defuns ;;;;;;;;;;;;;;;;;;;;;
|
||||
(defun narf/minibuffer-quit ()
|
||||
"Abort recursive edit. In Delete Selection mode, if the mark is
|
||||
active, just deactivate it; then it takes a second \\[keyboard-quit]
|
||||
to abort the minibuffer."
|
||||
(interactive)
|
||||
(let (message-log-max)
|
||||
(if (and delete-selection-mode transient-mark-mode mark-active)
|
||||
(setq deactivate-mark t)
|
||||
(when (get-buffer "*Completions*")
|
||||
(delete-windows-on "*Completions*"))
|
||||
(abort-recursive-edit))))
|
||||
|
||||
|
||||
;;;; Project defuns ;;;;;;;;;;;;;;;;;;;;
|
||||
(defvar narf/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 narf/project-root (&optional strict-p)
|
||||
"Get the path to the root of your project. Uses `narf/project-root-files' to
|
||||
determine if a directory is a project."
|
||||
(let ((home (file-truename "~")))
|
||||
(catch 'found
|
||||
(f-traverse-upwards
|
||||
(lambda (path)
|
||||
(let ((path (file-truename path)))
|
||||
(if (file-equal-p home path)
|
||||
(throw 'found (if strict-p nil default-directory))
|
||||
(dolist (file narf/project-root-files)
|
||||
(when (file-exists-p (expand-file-name file path))
|
||||
(throw 'found path)))))) default-directory)
|
||||
default-directory)))
|
||||
|
||||
(defun narf/project-has-files (files &optional root)
|
||||
"Return non-nil if `file' exists in the project root."
|
||||
(let ((root (or root (narf/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 (file-exists-p (narf/project-path-to file root))))
|
||||
found-p))
|
||||
|
||||
(defun narf/project-path-to (file &optional root)
|
||||
(let ((root (or root (narf/project-root))))
|
||||
(expand-file-name file root)))
|
||||
|
||||
(defun narf/project-name (&optional root)
|
||||
(file-name-nondirectory (directory-file-name (or root (narf/project-root)))))
|
||||
|
||||
(defun narf/project-p ()
|
||||
(not (null (narf/project-root t))))
|
||||
|
||||
;; Make sure scratch buffer is always "in a project"
|
||||
(defvar narf--project-scratch-buffer nil)
|
||||
(defun narf/project-create-scratch-buffer ()
|
||||
(let* ((scratch-buffer (get-buffer-create "*scratch*"))
|
||||
(root (narf/project-root t))
|
||||
(project-name (narf/project-name root))
|
||||
(current-buffer (current-buffer)))
|
||||
(when root
|
||||
(mapc (lambda (b)
|
||||
(when (and (string-match-p "\\*scratch\\* (.+)" (buffer-name b))
|
||||
(not (eq current-buffer b))
|
||||
(= (buffer-size b) 0))
|
||||
(kill-buffer b)))
|
||||
(buffer-list))
|
||||
(save-window-excursion
|
||||
(switch-to-buffer scratch-buffer)
|
||||
(setq narf--project-scratch-buffer scratch-buffer)
|
||||
(erase-buffer)
|
||||
(cd root)
|
||||
(rename-buffer (format "*scratch* (%s)" project-name))))))
|
||||
(add-hook 'find-file-hook 'narf/project-create-scratch-buffer)
|
||||
|
||||
|
||||
(provide 'defuns)
|
||||
;; defuns.el ends here
|
32
core/defuns/defuns-compile.el
Normal file
32
core/defuns/defuns-compile.el
Normal file
|
@ -0,0 +1,32 @@
|
|||
;;; defuns-compile.el
|
||||
|
||||
(! (require 'f)
|
||||
(setq narf-important-dirs (append (list narf-core-dir narf-modules-dir narf-contrib-dir narf-private-dir)
|
||||
(f-directories narf-core-dir nil t)
|
||||
(f-directories narf-modules-dir nil t)
|
||||
(f-directories narf-contrib-dir nil t))))
|
||||
|
||||
;;;###autoload (autoload 'narf:byte-compile "defuns-compile")
|
||||
(evil-define-command narf:byte-compile (&optional bang)
|
||||
:repeat nil
|
||||
(interactive "<!>")
|
||||
(when emacs-lisp-mode
|
||||
(if (not bang)
|
||||
(progn
|
||||
(byte-recompile-file (! (f-expand "core-defuns.el" narf-core-dir)) t 0)
|
||||
(byte-recompile-file (buffer-file-name) t 0))
|
||||
(byte-recompile-file (! (f-expand "init.el" narf-emacs-dir)) nil 0)
|
||||
(byte-recompile-file (! (f-expand "startup.el" narf-emacs-dir)) nil 0)
|
||||
(dolist (dir (! narf-impotant-dirs))
|
||||
(byte-recompile-directory dir 0 nil)))))
|
||||
|
||||
;;;###autoload (autoload 'narf:autoload-compile "defuns-compile")
|
||||
(evil-define-command narf:autoload-compile (&optional bang)
|
||||
:repeat nil
|
||||
(interactive "<!>")
|
||||
(defvar generated-autoload-file (! (f-expand "autoloads.el" narf-core-dir)))
|
||||
(apply #'update-directory-autoloads (! narf-impotant-dirs)))
|
||||
|
||||
|
||||
(provide 'defuns-compile)
|
||||
;;; defuns-compile.el ends here
|
33
core/defuns/defuns-evil.el
Normal file
33
core/defuns/defuns-evil.el
Normal file
|
@ -0,0 +1,33 @@
|
|||
;;; defuns-evil.el
|
||||
|
||||
;;;###autoload (autoload 'narf:evil-open-folds "defuns-evil")
|
||||
(evil-define-command narf/evil-open-folds (count)
|
||||
"Instead of `evil-open-folds'. Accepts COUNT for dictating fold level."
|
||||
(interactive "P")
|
||||
(if count (hs-hide-level count) (evil-open-folds)))
|
||||
|
||||
;;;###autoload (autoload 'narf:evil-open-folds "defuns-evil")
|
||||
(evil-define-command narf/evil-close-folds (count)
|
||||
"Instead of `evil-close-folds'. Accepts COUNT for dictating fold level."
|
||||
(interactive "P")
|
||||
(if count (hs-hide-level count) (evil-close-folds)))
|
||||
|
||||
;;;; Ace Jump ;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; https://github.com/winterTTr/ace-jump-mode/issues/23
|
||||
;;;###autoload (autoload 'narf:evil-ace-jump-two-chars "defuns-evil")
|
||||
(evil-define-motion narf/evil-ace-jump-two-chars (count)
|
||||
:type exclusive
|
||||
:repeat abort
|
||||
(evil-without-repeat
|
||||
(evil-enclose-ace-jump-for-motion
|
||||
(call-interactively 'ace-jump-two-chars-mode))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/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)))
|
||||
|
||||
|
||||
(provide 'defuns-evil)
|
||||
;;; defuns-evil.el ends here
|
34
core/defuns/defuns-isearch.el
Normal file
34
core/defuns/defuns-isearch.el
Normal file
|
@ -0,0 +1,34 @@
|
|||
|
||||
;;;###autoload
|
||||
(defun narf/isearch-delete-word ()
|
||||
(interactive)
|
||||
(let ((num (length isearch-string))
|
||||
(string (s-reverse isearch-string)))
|
||||
(when (string-match "[^a-zA-Z0-9]" string 1)
|
||||
(setq num (match-beginning 0)))
|
||||
(dotimes (i num)
|
||||
(isearch-pop-state))
|
||||
(isearch-update)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/isearch-delete-line ()
|
||||
(interactive)
|
||||
(let ((num (length isearch-string)))
|
||||
(dotimes (i num) (isearch-pop-state))
|
||||
(isearch-update)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/isearch-paste-from-register (reg)
|
||||
(interactive)
|
||||
(let ((str (evil-get-register reg t)))
|
||||
(when (> (length str) 0)
|
||||
(isearch-yank-string str))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/isearch-paste-from-clipboard ()
|
||||
(interactive)
|
||||
(narf:isearch-paste-from-register ?+))
|
||||
|
||||
|
||||
(provide 'defuns-isearch)
|
||||
;;; defuns-isearch.el ends here
|
12
core/defuns/defuns-nlinum.el
Normal file
12
core/defuns/defuns-nlinum.el
Normal file
|
@ -0,0 +1,12 @@
|
|||
;;; defuns-nlinum.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/nlinum-toggle ()
|
||||
(interactive)
|
||||
(if nlinum-mode
|
||||
(narf|nlinum-disable)
|
||||
(narf|nlinum-enable)))
|
||||
|
||||
|
||||
(provide 'defuns-nlinum)
|
||||
;;; defuns-nlinum.el ends here
|
10
core/defuns/defuns-popwin.el
Normal file
10
core/defuns/defuns-popwin.el
Normal file
|
@ -0,0 +1,10 @@
|
|||
;;;###autoload
|
||||
(defun narf/popwin-toggle ()
|
||||
(interactive)
|
||||
(if (popwin:popup-window-live-p)
|
||||
(popwin:close-popup-window)
|
||||
(popwin:popup-last-buffer)))
|
||||
|
||||
|
||||
(provide 'defuns-popwin)
|
||||
;;; defuns-popwin.el ends here
|
4
core/macros/macros-company.el
Normal file
4
core/macros/macros-company.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
|
||||
(provide 'macros-company)
|
||||
;;; macros-company.el ends here
|
14
core/macros/macros-popwin.el
Normal file
14
core/macros/macros-popwin.el
Normal file
|
@ -0,0 +1,14 @@
|
|||
;;; macros-popwin.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro @popwin-register (&rest forms)
|
||||
"Register a rule for popwin. See `popwin:special-display-config'.
|
||||
|
||||
Example:
|
||||
(@popwin-register (\"^\\*Flycheck.*\\*$\" :regexp t :position bottom :height 0.25 :noselect t))"
|
||||
(declare (indent defun))
|
||||
`(push (,@forms) form))
|
||||
|
||||
|
||||
(provide 'macros-popwin)
|
||||
;;; macros-popwin.el ends here
|
|
@ -1,39 +0,0 @@
|
|||
(defconst BASE-DIR user-emacs-directory)
|
||||
|
||||
(defconst CORE-DIR (eval-when-compile (concat BASE-DIR "core/")))
|
||||
(defconst MODULES-DIR (eval-when-compile (concat BASE-DIR "init/")))
|
||||
(defconst CONTRIB-DIR (eval-when-compile (concat BASE-DIR "contrib/")))
|
||||
(defconst THEMES-DIR (eval-when-compile (concat BASE-DIR "themes/")))
|
||||
(defconst SNIPPETS-DIR (eval-when-compile (concat BASE-DIR "snippets/")))
|
||||
(defconst ELPA-DIR (eval-when-compile (concat BASE-DIR ".cask/" emacs-version "/elpa/")))
|
||||
(defconst TMP-DIR (eval-when-compile (concat BASE-DIR ".cache-" (system-name) "/")))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(eval-when-compile
|
||||
(defmacro narf/init-load-path ()
|
||||
"Collect and verify `load-path'. Compile me!"
|
||||
(let (paths '())
|
||||
(dolist (dir (append (directory-files ELPA-DIR t "^[^.]" t)
|
||||
(directory-files CONTRIB-DIR t "^[^.]" t)))
|
||||
(when (file-directory-p dir)
|
||||
(push dir paths)))
|
||||
`(setq load-path ',(append (list CORE-DIR CONTRIB-DIR MODULES-DIR)
|
||||
(if (listp load-path) load-path (list load-path))
|
||||
paths))))
|
||||
|
||||
;; Are you pondering what I'm pondering?
|
||||
(defmacro narf/init (packages)
|
||||
`(progn ,@(mapcar (lambda (pkg) `(require ',pkg)) (eval packages)))))
|
||||
|
||||
(narf/init-load-path)
|
||||
;; (require 'benchmark)
|
||||
(require 'autoloads nil t) ; use `make autoloads` to generate autoloads file
|
||||
|
||||
(setq custom-theme-directory THEMES-DIR)
|
||||
(setq use-package-verbose DEBUG-MODE)
|
||||
;;(setq use-package-expand-minimally (not DEBUG-MODE))
|
||||
(eval-when-compile (require 'use-package))
|
||||
(require 'diminish)
|
||||
|
||||
;;; startup.el ends here
|
|
@ -1,4 +0,0 @@
|
|||
RelativeLayout
|
||||
LinearLayout
|
||||
ImageView
|
||||
TextView
|
|
@ -1,75 +0,0 @@
|
|||
and
|
||||
and_eq
|
||||
asm
|
||||
auto
|
||||
bitand
|
||||
bitor
|
||||
bool
|
||||
break
|
||||
case
|
||||
catch
|
||||
char
|
||||
class
|
||||
compl
|
||||
const
|
||||
const_cast
|
||||
continue
|
||||
default
|
||||
delete
|
||||
do
|
||||
double
|
||||
dynamic_cast
|
||||
else
|
||||
enum
|
||||
explicit
|
||||
export
|
||||
extern
|
||||
false
|
||||
float
|
||||
for
|
||||
friend
|
||||
goto
|
||||
if
|
||||
inline
|
||||
int
|
||||
internal
|
||||
long
|
||||
mutable
|
||||
namespace
|
||||
new
|
||||
not
|
||||
not_eq
|
||||
operator
|
||||
or
|
||||
or_eq
|
||||
private
|
||||
protected
|
||||
public
|
||||
register
|
||||
reinterpret_cast
|
||||
return
|
||||
short
|
||||
signed
|
||||
sizeof
|
||||
static
|
||||
static_cast
|
||||
struct
|
||||
switch
|
||||
template
|
||||
this
|
||||
throw
|
||||
true
|
||||
try
|
||||
typedef
|
||||
typeid
|
||||
typename
|
||||
union
|
||||
unsigned
|
||||
using
|
||||
virtual
|
||||
void
|
||||
volatile
|
||||
wchar_t
|
||||
while
|
||||
xor
|
||||
xor_eq
|
37
dict/c-mode
37
dict/c-mode
|
@ -1,37 +0,0 @@
|
|||
auto
|
||||
_Bool
|
||||
break
|
||||
case
|
||||
char
|
||||
_Complex
|
||||
const
|
||||
continue
|
||||
default
|
||||
do
|
||||
double
|
||||
else
|
||||
enum
|
||||
extern
|
||||
float
|
||||
for
|
||||
goto
|
||||
if
|
||||
_Imaginary
|
||||
inline
|
||||
int
|
||||
long
|
||||
register
|
||||
restrict
|
||||
return
|
||||
short
|
||||
signed
|
||||
sizeof
|
||||
static
|
||||
struct
|
||||
switch
|
||||
typedef
|
||||
union
|
||||
unsigned
|
||||
void
|
||||
volatile
|
||||
while
|
677
dict/css-mode
677
dict/css-mode
|
@ -1,677 +0,0 @@
|
|||
!important
|
||||
_azimuth
|
||||
_background
|
||||
_background-position-x
|
||||
_background-position-y
|
||||
_border
|
||||
_bottom
|
||||
_caption
|
||||
_clear
|
||||
_clip
|
||||
_color
|
||||
_content
|
||||
_counter
|
||||
_cue
|
||||
_cursor
|
||||
_direction
|
||||
_display
|
||||
_elevation
|
||||
_empty
|
||||
_filter
|
||||
_filter:progid:DXImageTransform.Microsoft
|
||||
_float
|
||||
_font
|
||||
_height
|
||||
_ime
|
||||
_ime-mode
|
||||
_layout
|
||||
_layout-flow
|
||||
_layout-grid
|
||||
_layout-grid-char
|
||||
_layout-grid-line
|
||||
_layout-grid-mode
|
||||
_layout-grid-type
|
||||
_left
|
||||
_letter
|
||||
_line
|
||||
_line-break
|
||||
_list
|
||||
_margin
|
||||
_orphans
|
||||
_outline
|
||||
_overflow
|
||||
_overflow-x
|
||||
_overflow-y
|
||||
_padding
|
||||
_page
|
||||
_pause
|
||||
_pitch
|
||||
_play
|
||||
_position
|
||||
_quotes
|
||||
_richness
|
||||
_right
|
||||
_ruby
|
||||
_ruby-align
|
||||
_ruby-overhang
|
||||
_ruby-position
|
||||
_scrollbar
|
||||
_scrollbar-3dlight-color
|
||||
_scrollbar-arrow-color
|
||||
_scrollbar-base-color
|
||||
_scrollbar-darkshadow-color
|
||||
_scrollbar-face-color
|
||||
_scrollbar-highlight-color
|
||||
_scrollbar-track-color
|
||||
_speak
|
||||
_speech
|
||||
_stress
|
||||
_table
|
||||
_text
|
||||
_text-align-last
|
||||
_text-autospace
|
||||
_text-justify
|
||||
_text-kashida-space
|
||||
_text-overflow
|
||||
_text-underline-position
|
||||
_top
|
||||
_unicode
|
||||
_vertical
|
||||
_visibility
|
||||
_voice
|
||||
_volume
|
||||
_white
|
||||
_widows
|
||||
_width
|
||||
_word
|
||||
_word-break
|
||||
_word-wrap
|
||||
_writing
|
||||
_writing-mode
|
||||
_z
|
||||
_zoom
|
||||
above
|
||||
active
|
||||
adjust
|
||||
after
|
||||
aliceblue
|
||||
align
|
||||
always
|
||||
antiquewhite
|
||||
aqua
|
||||
aquamarine
|
||||
armenian
|
||||
arrow
|
||||
attachment
|
||||
auto
|
||||
autospace
|
||||
avoid
|
||||
azimuth
|
||||
azure
|
||||
background
|
||||
background-attachment
|
||||
background-color
|
||||
background-image
|
||||
background-position
|
||||
background-repeat
|
||||
bar
|
||||
base
|
||||
baseline
|
||||
before
|
||||
behind
|
||||
beige
|
||||
below
|
||||
bidi
|
||||
bidi-override
|
||||
bisque
|
||||
black
|
||||
blanchedalmond
|
||||
blink
|
||||
block
|
||||
blue
|
||||
blueviolet
|
||||
bold
|
||||
bolder
|
||||
border
|
||||
border-bottom
|
||||
border-bottom-color
|
||||
border-bottom-style
|
||||
border-bottom-width
|
||||
border-collapse
|
||||
border-color
|
||||
border-left
|
||||
border-left-color
|
||||
border-left-style
|
||||
border-left-width
|
||||
border-right
|
||||
border-right-color
|
||||
border-right-style
|
||||
border-right-width
|
||||
border-spacing
|
||||
border-style
|
||||
border-top
|
||||
border-top-color
|
||||
border-top-style
|
||||
border-top-width
|
||||
border-width
|
||||
both
|
||||
bottom
|
||||
box
|
||||
break
|
||||
brown
|
||||
burlwood
|
||||
cadetblue
|
||||
capitalize
|
||||
caps
|
||||
caption
|
||||
caption-side
|
||||
cell
|
||||
cells
|
||||
center
|
||||
center-left
|
||||
center-right
|
||||
char
|
||||
chartreuse
|
||||
chocolate
|
||||
circle
|
||||
cjk
|
||||
cjk-ideographic
|
||||
clear
|
||||
clip
|
||||
close
|
||||
close-quote
|
||||
cm
|
||||
code
|
||||
collapse
|
||||
color
|
||||
column
|
||||
compact
|
||||
condensed
|
||||
content
|
||||
continuous
|
||||
coral
|
||||
cornflowerblue
|
||||
cornsilk
|
||||
counter
|
||||
counter-increment
|
||||
counter-reset
|
||||
crimson
|
||||
crop
|
||||
cross
|
||||
crosshair
|
||||
cue
|
||||
cue-after
|
||||
cue-before
|
||||
cursive
|
||||
cursor
|
||||
cyan
|
||||
darkblue
|
||||
darkcyan
|
||||
darkgoldenrod
|
||||
darkgray
|
||||
darkgreen
|
||||
darkkhaki
|
||||
darkmagenta
|
||||
darkolivegreen
|
||||
darkorange
|
||||
darkorchid
|
||||
darkred
|
||||
darksalmon
|
||||
darkseagreen
|
||||
darkshadow
|
||||
darkslateblue
|
||||
darkslategray
|
||||
darkturquoise
|
||||
darkviolet
|
||||
dashed
|
||||
decimal
|
||||
decimal-leading-zero
|
||||
decoration
|
||||
deeppink
|
||||
deepskyblue
|
||||
default
|
||||
deg
|
||||
digits
|
||||
dimgray
|
||||
direction
|
||||
disc
|
||||
display
|
||||
dodgerblue
|
||||
dotted
|
||||
double
|
||||
during
|
||||
e
|
||||
e-resize
|
||||
elevation
|
||||
em
|
||||
embed
|
||||
empty
|
||||
empty-cells
|
||||
ex
|
||||
expanded
|
||||
extra
|
||||
extra-condensed
|
||||
extra-expanded
|
||||
face
|
||||
family
|
||||
fantasy
|
||||
far
|
||||
far-left
|
||||
far-right
|
||||
fast
|
||||
faster
|
||||
firebrick
|
||||
first
|
||||
first-child
|
||||
first-letter
|
||||
first-line
|
||||
fixed
|
||||
float
|
||||
floralwhite
|
||||
flow
|
||||
focus
|
||||
font
|
||||
font-family
|
||||
font-size
|
||||
font-size-adjust
|
||||
font-stretch
|
||||
font-style
|
||||
font-variant
|
||||
font-weight
|
||||
footer
|
||||
forestgreen
|
||||
fuchsia
|
||||
gainsboro
|
||||
georgian
|
||||
ghostwhite
|
||||
gold
|
||||
goldenrod
|
||||
gray
|
||||
greek
|
||||
green
|
||||
greenyellow
|
||||
grid
|
||||
groove
|
||||
group
|
||||
header
|
||||
hebrew
|
||||
height
|
||||
help
|
||||
hidden
|
||||
hide
|
||||
high
|
||||
higher
|
||||
hiragana
|
||||
hiragana-iroha
|
||||
honeydew
|
||||
hotpink
|
||||
hover
|
||||
icon
|
||||
ideographic
|
||||
image
|
||||
in
|
||||
increment
|
||||
indent
|
||||
index
|
||||
indianred
|
||||
indigo
|
||||
inherit
|
||||
inline
|
||||
inline-block
|
||||
inline-table
|
||||
inset
|
||||
inside
|
||||
iroha
|
||||
italic
|
||||
item
|
||||
ivory
|
||||
justify
|
||||
kHz
|
||||
kashida
|
||||
katakana
|
||||
katakana-iroha
|
||||
khaki
|
||||
landscape
|
||||
lang()
|
||||
large
|
||||
larger
|
||||
last
|
||||
latin
|
||||
lavender
|
||||
lavenderblush
|
||||
lawngreen
|
||||
layout
|
||||
leading
|
||||
left
|
||||
left-side
|
||||
leftwards
|
||||
lenonchiffon
|
||||
letter
|
||||
letter-spacing
|
||||
level
|
||||
lightblue
|
||||
lightcoral
|
||||
lightcyan
|
||||
lighter
|
||||
lightgoldenrodyellow
|
||||
lightgray
|
||||
lightgreen
|
||||
lightgrey
|
||||
lightpink
|
||||
lightsalmon
|
||||
lightseagreen
|
||||
lightskyblue
|
||||
lightslategray
|
||||
lightsteelblue
|
||||
lightyellow
|
||||
lime
|
||||
limegreen
|
||||
line
|
||||
line-height
|
||||
line-through
|
||||
linen
|
||||
link
|
||||
list
|
||||
list-item
|
||||
list-style
|
||||
list-style-image
|
||||
list-style-position
|
||||
list-style-type
|
||||
loud
|
||||
low
|
||||
lower
|
||||
lower-alpha
|
||||
lower-greek
|
||||
lower-latin
|
||||
lower-roman
|
||||
lowercase
|
||||
ltr
|
||||
magenta
|
||||
margin
|
||||
margin-bottom
|
||||
margin-left
|
||||
margin-right
|
||||
margin-top
|
||||
marker
|
||||
marker-offset
|
||||
marks
|
||||
maroon
|
||||
max
|
||||
max-height
|
||||
max-width
|
||||
medium
|
||||
mediumaquamarine
|
||||
mediumblue
|
||||
mediumorchid
|
||||
mediumpurple
|
||||
mediumseagreen
|
||||
mediumslateblue
|
||||
mediumspringgreen
|
||||
mediumturquoise
|
||||
mediumvioletred
|
||||
menu
|
||||
message
|
||||
message-box
|
||||
middle
|
||||
midnightblue
|
||||
min
|
||||
min-height
|
||||
min-width
|
||||
mintcream
|
||||
mistyrose
|
||||
mix
|
||||
mm
|
||||
moccasin
|
||||
mode
|
||||
monospace
|
||||
move
|
||||
ms
|
||||
n
|
||||
n-resize
|
||||
naby
|
||||
narrower
|
||||
navajowhite
|
||||
ne
|
||||
ne-resize
|
||||
no
|
||||
no-close-quote
|
||||
no-open-quote
|
||||
no-repeat
|
||||
none
|
||||
normal
|
||||
nowrap
|
||||
number
|
||||
numeral
|
||||
nw
|
||||
nw-resize
|
||||
oblique
|
||||
offset
|
||||
oldlace
|
||||
olive
|
||||
olivedrab
|
||||
once
|
||||
open
|
||||
open-quote
|
||||
orange
|
||||
orangered
|
||||
orchid
|
||||
orphans
|
||||
out
|
||||
outline
|
||||
outline-color
|
||||
outline-style
|
||||
outline-width
|
||||
outset
|
||||
outside
|
||||
overflow
|
||||
overhang
|
||||
overline
|
||||
override
|
||||
padding
|
||||
padding-bottom
|
||||
padding-left
|
||||
padding-right
|
||||
padding-top
|
||||
page
|
||||
page-break-after
|
||||
page-break-before
|
||||
page-break-inside
|
||||
palegoldenrod
|
||||
palegreen
|
||||
paleturquoise
|
||||
palevioletred
|
||||
papayawhip
|
||||
pause
|
||||
pause-after
|
||||
pause-before
|
||||
pc
|
||||
peachpuff
|
||||
peru
|
||||
pink
|
||||
pitch
|
||||
pitch-range
|
||||
play
|
||||
play-during
|
||||
plum
|
||||
pointer
|
||||
portarait
|
||||
position
|
||||
powderblue
|
||||
pre
|
||||
pre-line
|
||||
pre-wrap
|
||||
progid
|
||||
progress
|
||||
pt
|
||||
punctuation
|
||||
purple
|
||||
px
|
||||
quote
|
||||
quotes
|
||||
rad
|
||||
range
|
||||
rate
|
||||
red
|
||||
relative
|
||||
repeat
|
||||
repeat-x
|
||||
repeat-y
|
||||
reset
|
||||
resize
|
||||
richness
|
||||
ridge
|
||||
right
|
||||
right-side
|
||||
rightwards
|
||||
roman
|
||||
rosybrown
|
||||
row
|
||||
royalblue
|
||||
rtl
|
||||
run
|
||||
run-in
|
||||
s
|
||||
s-resize
|
||||
saddlebrown
|
||||
salmon
|
||||
sandybrown
|
||||
sans-serif
|
||||
scroll
|
||||
se
|
||||
se-resize
|
||||
seagreen
|
||||
seashell
|
||||
semi
|
||||
semi-condensed
|
||||
semi-expanded
|
||||
separate
|
||||
serif
|
||||
shadow
|
||||
show
|
||||
side
|
||||
sienna
|
||||
silent
|
||||
silever
|
||||
silver
|
||||
size
|
||||
skyblue
|
||||
slateblue
|
||||
slategray
|
||||
slow
|
||||
slower
|
||||
small
|
||||
small-caps
|
||||
small-caption
|
||||
smaller
|
||||
snow
|
||||
soft
|
||||
solid
|
||||
space
|
||||
spacing
|
||||
speak
|
||||
speak-header
|
||||
speak-numeral
|
||||
speak-punctuation
|
||||
specific
|
||||
specific-voice
|
||||
speech
|
||||
speech-rate
|
||||
spell
|
||||
spell-out
|
||||
springgreen
|
||||
square
|
||||
static
|
||||
status
|
||||
status-bar
|
||||
steelblue
|
||||
stress
|
||||
stretch
|
||||
style
|
||||
sub
|
||||
super
|
||||
sw
|
||||
sw-resize
|
||||
table
|
||||
table-caption
|
||||
table-cell
|
||||
table-column
|
||||
table-column-group
|
||||
table-footer-group
|
||||
table-header-group
|
||||
table-layout
|
||||
table-row
|
||||
table-row-group
|
||||
tan
|
||||
teal
|
||||
text
|
||||
text-align
|
||||
text-bottom
|
||||
text-decoration
|
||||
text-indent
|
||||
text-shadow
|
||||
text-top
|
||||
text-transform
|
||||
thick
|
||||
thin
|
||||
thistle
|
||||
through
|
||||
tomato
|
||||
top
|
||||
track
|
||||
transform
|
||||
transparent
|
||||
turquoise
|
||||
type
|
||||
ultra
|
||||
ultra-condensed
|
||||
ultra-expanded
|
||||
underline
|
||||
unicode
|
||||
unicode-bidi
|
||||
upper
|
||||
upper-alpha
|
||||
upper-latin
|
||||
upper-roman
|
||||
uppercase
|
||||
variant
|
||||
vertical
|
||||
vertical-align
|
||||
violet
|
||||
visibility
|
||||
visible
|
||||
visited
|
||||
voice
|
||||
voice-family
|
||||
volume
|
||||
w
|
||||
w-resize
|
||||
wait
|
||||
weight
|
||||
wheat
|
||||
white
|
||||
white-space
|
||||
whitesmoke
|
||||
wider
|
||||
widows
|
||||
width
|
||||
word
|
||||
word-spacing
|
||||
wrap
|
||||
x
|
||||
x-fast
|
||||
x-high
|
||||
x-large
|
||||
x-loud
|
||||
x-low
|
||||
x-slow
|
||||
x-small
|
||||
x-soft
|
||||
xx
|
||||
xx-large
|
||||
xx-small
|
||||
y
|
||||
yellow
|
||||
yellowgreen
|
||||
z
|
||||
z-index
|
||||
zero
|
4226
dict/java-mode
4226
dict/java-mode
File diff suppressed because it is too large
Load diff
|
@ -1,2 +0,0 @@
|
|||
JSON.stringify
|
||||
JSON.parse
|
|
@ -1,7 +0,0 @@
|
|||
JSON
|
||||
JSON.stringify
|
||||
JSON.parse
|
||||
LaunchBar
|
||||
include
|
||||
HTTP
|
||||
File
|
|
@ -1,30 +0,0 @@
|
|||
love.keyboard.isDown
|
||||
love.draw
|
||||
love.update
|
||||
love.conf
|
||||
love.load
|
||||
draw
|
||||
focus
|
||||
joystickpressed
|
||||
joystickreleased
|
||||
keypressed
|
||||
keyreleased
|
||||
load
|
||||
mousepressed
|
||||
mousereleased
|
||||
quit
|
||||
run
|
||||
update
|
||||
audio
|
||||
event
|
||||
filesystem
|
||||
font
|
||||
graphics
|
||||
image
|
||||
joystick
|
||||
keyboard
|
||||
mouse
|
||||
physics
|
||||
sound
|
||||
thread
|
||||
timer
|
|
@ -1,21 +0,0 @@
|
|||
and
|
||||
break
|
||||
do
|
||||
else
|
||||
elseif
|
||||
end
|
||||
false
|
||||
for
|
||||
function
|
||||
if
|
||||
in
|
||||
local
|
||||
nil
|
||||
not
|
||||
or
|
||||
repeat
|
||||
return
|
||||
then
|
||||
true
|
||||
until
|
||||
while
|
|
@ -1,34 +0,0 @@
|
|||
CFBundleName
|
||||
CFBundleShortVersionString
|
||||
CFBundleVersion
|
||||
CFBundleIdentifier
|
||||
CFBundleIconFile
|
||||
LSMinimumSystemVersion
|
||||
LBMinimumLaunchBarVersion
|
||||
LBDebugLogEnabled
|
||||
LBAbbreviation
|
||||
LBRequiredApplication
|
||||
LBAssociatedApplication
|
||||
LBTextInputTitle
|
||||
LBScripts
|
||||
LBDefaultScript
|
||||
LBScriptName
|
||||
LBRunInBackground
|
||||
LBLiveFeedbackEnabled
|
||||
LBBackgroundKillEnabled
|
||||
LBRequiresArgument
|
||||
LBAcceptedArgumentTypes
|
||||
LBReturnsResult
|
||||
LBResultType
|
||||
LBKeepWindowActive
|
||||
LBSuggestionsScript
|
||||
LBActionURLScript
|
||||
LBDescription
|
||||
LBAuthor
|
||||
LBWebsite
|
||||
LBEmail
|
||||
LBTwitter
|
||||
LBSummary
|
||||
LBArgument
|
||||
LBResult
|
||||
LBRequirements
|
|
@ -1,62 +0,0 @@
|
|||
and
|
||||
array
|
||||
as
|
||||
break
|
||||
case
|
||||
catch
|
||||
cfunction
|
||||
class
|
||||
clone
|
||||
const
|
||||
continue
|
||||
declare
|
||||
default
|
||||
die
|
||||
do
|
||||
echo
|
||||
else
|
||||
elseif
|
||||
empty
|
||||
enddeclare
|
||||
endfor
|
||||
endforeach
|
||||
endif
|
||||
endswitch
|
||||
endwhile
|
||||
eval
|
||||
exit
|
||||
extends
|
||||
final
|
||||
for
|
||||
foreach
|
||||
function
|
||||
global
|
||||
goto
|
||||
if
|
||||
implements
|
||||
include
|
||||
include_once
|
||||
instanceof
|
||||
interface
|
||||
isset
|
||||
list
|
||||
namespace
|
||||
new
|
||||
old_function
|
||||
or
|
||||
print
|
||||
private
|
||||
protected
|
||||
public
|
||||
require
|
||||
require_once
|
||||
return
|
||||
static
|
||||
switch
|
||||
throw
|
||||
try
|
||||
unset
|
||||
use
|
||||
var
|
||||
while
|
||||
xor
|
181
dict/ruby-mode
181
dict/ruby-mode
|
@ -1,181 +0,0 @@
|
|||
$!
|
||||
$"
|
||||
$$
|
||||
$&
|
||||
$'
|
||||
$*
|
||||
$+
|
||||
$,
|
||||
$-0
|
||||
$-F
|
||||
$-I
|
||||
$-K
|
||||
$-a
|
||||
$-d
|
||||
$-i
|
||||
$-l
|
||||
$-p
|
||||
$-v
|
||||
$-w
|
||||
$.
|
||||
$/
|
||||
$0
|
||||
$1
|
||||
$10
|
||||
$11
|
||||
$2
|
||||
$3
|
||||
$4
|
||||
$5
|
||||
$6
|
||||
$7
|
||||
$8
|
||||
$9
|
||||
$:
|
||||
$;
|
||||
$<
|
||||
$=
|
||||
$>
|
||||
$?
|
||||
$@
|
||||
$DEBUG
|
||||
$FILENAME
|
||||
$KCODE
|
||||
$LOADED_FEATURES
|
||||
$LOAD_PATH
|
||||
$PROGRAM_NAME
|
||||
$SAFE
|
||||
$VERBOSE
|
||||
$\
|
||||
$_
|
||||
$`
|
||||
$deferr
|
||||
$defout
|
||||
$stderr
|
||||
$stdin
|
||||
$stdout
|
||||
$~
|
||||
ARGF
|
||||
ARGV
|
||||
Array
|
||||
BEGIN
|
||||
DATA
|
||||
END
|
||||
ENV
|
||||
FALSE
|
||||
Float
|
||||
Integer
|
||||
NIL
|
||||
PLATFORM
|
||||
RELEASE_DATE
|
||||
RUBY_COPYRIGHT
|
||||
RUBY_DESCRIPTION
|
||||
RUBY_PATCHLEVEL
|
||||
RUBY_PLATFORM
|
||||
RUBY_RELEASE_DATE
|
||||
RUBY_VERSION
|
||||
SCRIPT_LINES__
|
||||
STDERR
|
||||
STDIN
|
||||
STDOUT
|
||||
String
|
||||
TOPLEVEL_BINDING
|
||||
TRUE
|
||||
VERSION
|
||||
__method__
|
||||
`
|
||||
abort
|
||||
alias
|
||||
and
|
||||
at_exit
|
||||
autoload
|
||||
autoload?
|
||||
begin
|
||||
binding
|
||||
block_given
|
||||
break
|
||||
callcc
|
||||
caller
|
||||
case
|
||||
catch
|
||||
chomp
|
||||
chomp!
|
||||
chop
|
||||
chop
|
||||
class
|
||||
def
|
||||
defined?
|
||||
do
|
||||
else
|
||||
elsif
|
||||
end
|
||||
ensure
|
||||
eval
|
||||
exec
|
||||
exit
|
||||
exit!
|
||||
fail
|
||||
false
|
||||
for
|
||||
fork
|
||||
format
|
||||
getc
|
||||
gets
|
||||
global_variables
|
||||
gsub
|
||||
gsub!
|
||||
if
|
||||
in
|
||||
iterator?
|
||||
lambda
|
||||
load
|
||||
local_varaibles
|
||||
loop
|
||||
module
|
||||
next
|
||||
nil
|
||||
not
|
||||
open
|
||||
or
|
||||
p
|
||||
printf
|
||||
proc
|
||||
putc
|
||||
puts
|
||||
raise
|
||||
rand
|
||||
readline
|
||||
readlines
|
||||
redo
|
||||
require
|
||||
require_relative
|
||||
rescue
|
||||
retry
|
||||
return
|
||||
scan
|
||||
select
|
||||
self
|
||||
set_trace_func
|
||||
sleep
|
||||
split
|
||||
sprintf
|
||||
srand
|
||||
sub
|
||||
sub!
|
||||
super
|
||||
syscall
|
||||
system
|
||||
test
|
||||
then
|
||||
throw
|
||||
trace_var
|
||||
trap
|
||||
true
|
||||
undef
|
||||
unless
|
||||
until
|
||||
untrace_var
|
||||
warn
|
||||
when
|
||||
while
|
||||
yield
|
680
dict/scss-mode
680
dict/scss-mode
|
@ -1,680 +0,0 @@
|
|||
@import
|
||||
@mixin
|
||||
@extend
|
||||
!important
|
||||
_azimuth
|
||||
_background
|
||||
_background-position-x
|
||||
_background-position-y
|
||||
_border
|
||||
_bottom
|
||||
_caption
|
||||
_clear
|
||||
_clip
|
||||
_color
|
||||
_content
|
||||
_counter
|
||||
_cue
|
||||
_cursor
|
||||
_direction
|
||||
_display
|
||||
_elevation
|
||||
_empty
|
||||
_filter
|
||||
_filter:progid:DXImageTransform.Microsoft
|
||||
_float
|
||||
_font
|
||||
_height
|
||||
_ime
|
||||
_ime-mode
|
||||
_layout
|
||||
_layout-flow
|
||||
_layout-grid
|
||||
_layout-grid-char
|
||||
_layout-grid-line
|
||||
_layout-grid-mode
|
||||
_layout-grid-type
|
||||
_left
|
||||
_letter
|
||||
_line
|
||||
_line-break
|
||||
_list
|
||||
_margin
|
||||
_orphans
|
||||
_outline
|
||||
_overflow
|
||||
_overflow-x
|
||||
_overflow-y
|
||||
_padding
|
||||
_page
|
||||
_pause
|
||||
_pitch
|
||||
_play
|
||||
_position
|
||||
_quotes
|
||||
_richness
|
||||
_right
|
||||
_ruby
|
||||
_ruby-align
|
||||
_ruby-overhang
|
||||
_ruby-position
|
||||
_scrollbar
|
||||
_scrollbar-3dlight-color
|
||||
_scrollbar-arrow-color
|
||||
_scrollbar-base-color
|
||||
_scrollbar-darkshadow-color
|
||||
_scrollbar-face-color
|
||||
_scrollbar-highlight-color
|
||||
_scrollbar-track-color
|
||||
_speak
|
||||
_speech
|
||||
_stress
|
||||
_table
|
||||
_text
|
||||
_text-align-last
|
||||
_text-autospace
|
||||
_text-justify
|
||||
_text-kashida-space
|
||||
_text-overflow
|
||||
_text-underline-position
|
||||
_top
|
||||
_unicode
|
||||
_vertical
|
||||
_visibility
|
||||
_voice
|
||||
_volume
|
||||
_white
|
||||
_widows
|
||||
_width
|
||||
_word
|
||||
_word-break
|
||||
_word-wrap
|
||||
_writing
|
||||
_writing-mode
|
||||
_z
|
||||
_zoom
|
||||
above
|
||||
active
|
||||
adjust
|
||||
after
|
||||
aliceblue
|
||||
align
|
||||
always
|
||||
antiquewhite
|
||||
aqua
|
||||
aquamarine
|
||||
armenian
|
||||
arrow
|
||||
attachment
|
||||
auto
|
||||
autospace
|
||||
avoid
|
||||
azimuth
|
||||
azure
|
||||
background
|
||||
background-attachment
|
||||
background-color
|
||||
background-image
|
||||
background-position
|
||||
background-repeat
|
||||
bar
|
||||
base
|
||||
baseline
|
||||
before
|
||||
behind
|
||||
beige
|
||||
below
|
||||
bidi
|
||||
bidi-override
|
||||
bisque
|
||||
black
|
||||
blanchedalmond
|
||||
blink
|
||||
block
|
||||
blue
|
||||
blueviolet
|
||||
bold
|
||||
bolder
|
||||
border
|
||||
border-bottom
|
||||
border-bottom-color
|
||||
border-bottom-style
|
||||
border-bottom-width
|
||||
border-collapse
|
||||
border-color
|
||||
border-left
|
||||
border-left-color
|
||||
border-left-style
|
||||
border-left-width
|
||||
border-right
|
||||
border-right-color
|
||||
border-right-style
|
||||
border-right-width
|
||||
border-spacing
|
||||
border-style
|
||||
border-top
|
||||
border-top-color
|
||||
border-top-style
|
||||
border-top-width
|
||||
border-width
|
||||
both
|
||||
bottom
|
||||
box
|
||||
break
|
||||
brown
|
||||
burlwood
|
||||
cadetblue
|
||||
capitalize
|
||||
caps
|
||||
caption
|
||||
caption-side
|
||||
cell
|
||||
cells
|
||||
center
|
||||
center-left
|
||||
center-right
|
||||
char
|
||||
chartreuse
|
||||
chocolate
|
||||
circle
|
||||
cjk
|
||||
cjk-ideographic
|
||||
clear
|
||||
clip
|
||||
close
|
||||
close-quote
|
||||
cm
|
||||
code
|
||||
collapse
|
||||
color
|
||||
column
|
||||
compact
|
||||
condensed
|
||||
content
|
||||
continuous
|
||||
coral
|
||||
cornflowerblue
|
||||
cornsilk
|
||||
counter
|
||||
counter-increment
|
||||
counter-reset
|
||||
crimson
|
||||
crop
|
||||
cross
|
||||
crosshair
|
||||
cue
|
||||
cue-after
|
||||
cue-before
|
||||
cursive
|
||||
cursor
|
||||
cyan
|
||||
darkblue
|
||||
darkcyan
|
||||
darkgoldenrod
|
||||
darkgray
|
||||
darkgreen
|
||||
darkkhaki
|
||||
darkmagenta
|
||||
darkolivegreen
|
||||
darkorange
|
||||
darkorchid
|
||||
darkred
|
||||
darksalmon
|
||||
darkseagreen
|
||||
darkshadow
|
||||
darkslateblue
|
||||
darkslategray
|
||||
darkturquoise
|
||||
darkviolet
|
||||
dashed
|
||||
decimal
|
||||
decimal-leading-zero
|
||||
decoration
|
||||
deeppink
|
||||
deepskyblue
|
||||
default
|
||||
deg
|
||||
digits
|
||||
dimgray
|
||||
direction
|
||||
disc
|
||||
display
|
||||
dodgerblue
|
||||
dotted
|
||||
double
|
||||
during
|
||||
e
|
||||
e-resize
|
||||
elevation
|
||||
em
|
||||
embed
|
||||
empty
|
||||
empty-cells
|
||||
ex
|
||||
expanded
|
||||
extra
|
||||
extra-condensed
|
||||
extra-expanded
|
||||
face
|
||||
family
|
||||
fantasy
|
||||
far
|
||||
far-left
|
||||
far-right
|
||||
fast
|
||||
faster
|
||||
firebrick
|
||||
first
|
||||
first-child
|
||||
first-letter
|
||||
first-line
|
||||
fixed
|
||||
float
|
||||
floralwhite
|
||||
flow
|
||||
focus
|
||||
font
|
||||
font-family
|
||||
font-size
|
||||
font-size-adjust
|
||||
font-stretch
|
||||
font-style
|
||||
font-variant
|
||||
font-weight
|
||||
footer
|
||||
forestgreen
|
||||
fuchsia
|
||||
gainsboro
|
||||
georgian
|
||||
ghostwhite
|
||||
gold
|
||||
goldenrod
|
||||
gray
|
||||
greek
|
||||
green
|
||||
greenyellow
|
||||
grid
|
||||
groove
|
||||
group
|
||||
header
|
||||
hebrew
|
||||
height
|
||||
help
|
||||
hidden
|
||||
hide
|
||||
high
|
||||
higher
|
||||
hiragana
|
||||
hiragana-iroha
|
||||
honeydew
|
||||
hotpink
|
||||
hover
|
||||
icon
|
||||
ideographic
|
||||
image
|
||||
in
|
||||
increment
|
||||
indent
|
||||
index
|
||||
indianred
|
||||
indigo
|
||||
inherit
|
||||
inline
|
||||
inline-block
|
||||
inline-table
|
||||
inset
|
||||
inside
|
||||
iroha
|
||||
italic
|
||||
item
|
||||
ivory
|
||||
justify
|
||||
kHz
|
||||
kashida
|
||||
katakana
|
||||
katakana-iroha
|
||||
khaki
|
||||
landscape
|
||||
lang()
|
||||
large
|
||||
larger
|
||||
last
|
||||
latin
|
||||
lavender
|
||||
lavenderblush
|
||||
lawngreen
|
||||
layout
|
||||
leading
|
||||
left
|
||||
left-side
|
||||
leftwards
|
||||
lenonchiffon
|
||||
letter
|
||||
letter-spacing
|
||||
level
|
||||
lightblue
|
||||
lightcoral
|
||||
lightcyan
|
||||
lighter
|
||||
lightgoldenrodyellow
|
||||
lightgray
|
||||
lightgreen
|
||||
lightgrey
|
||||
lightpink
|
||||
lightsalmon
|
||||
lightseagreen
|
||||
lightskyblue
|
||||
lightslategray
|
||||
lightsteelblue
|
||||
lightyellow
|
||||
lime
|
||||
limegreen
|
||||
line
|
||||
line-height
|
||||
line-through
|
||||
linen
|
||||
link
|
||||
list
|
||||
list-item
|
||||
list-style
|
||||
list-style-image
|
||||
list-style-position
|
||||
list-style-type
|
||||
loud
|
||||
low
|
||||
lower
|
||||
lower-alpha
|
||||
lower-greek
|
||||
lower-latin
|
||||
lower-roman
|
||||
lowercase
|
||||
ltr
|
||||
magenta
|
||||
margin
|
||||
margin-bottom
|
||||
margin-left
|
||||
margin-right
|
||||
margin-top
|
||||
marker
|
||||
marker-offset
|
||||
marks
|
||||
maroon
|
||||
max
|
||||
max-height
|
||||
max-width
|
||||
medium
|
||||
mediumaquamarine
|
||||
mediumblue
|
||||
mediumorchid
|
||||
mediumpurple
|
||||
mediumseagreen
|
||||
mediumslateblue
|
||||
mediumspringgreen
|
||||
mediumturquoise
|
||||
mediumvioletred
|
||||
menu
|
||||
message
|
||||
message-box
|
||||
middle
|
||||
midnightblue
|
||||
min
|
||||
min-height
|
||||
min-width
|
||||
mintcream
|
||||
mistyrose
|
||||
mix
|
||||
mm
|
||||
moccasin
|
||||
mode
|
||||
monospace
|
||||
move
|
||||
ms
|
||||
n
|
||||
n-resize
|
||||
naby
|
||||
narrower
|
||||
navajowhite
|
||||
ne
|
||||
ne-resize
|
||||
no
|
||||
no-close-quote
|
||||
no-open-quote
|
||||
no-repeat
|
||||
none
|
||||
normal
|
||||
nowrap
|
||||
number
|
||||
numeral
|
||||
nw
|
||||
nw-resize
|
||||
oblique
|
||||
offset
|
||||
oldlace
|
||||
olive
|
||||
olivedrab
|
||||
once
|
||||
open
|
||||
open-quote
|
||||
orange
|
||||
orangered
|
||||
orchid
|
||||
orphans
|
||||
out
|
||||
outline
|
||||
outline-color
|
||||
outline-style
|
||||
outline-width
|
||||
outset
|
||||
outside
|
||||
overflow
|
||||
overhang
|
||||
overline
|
||||
override
|
||||
padding
|
||||
padding-bottom
|
||||
padding-left
|
||||
padding-right
|
||||
padding-top
|
||||
page
|
||||
page-break-after
|
||||
page-break-before
|
||||
page-break-inside
|
||||
palegoldenrod
|
||||
palegreen
|
||||
paleturquoise
|
||||
palevioletred
|
||||
papayawhip
|
||||
pause
|
||||
pause-after
|
||||
pause-before
|
||||
pc
|
||||
peachpuff
|
||||
peru
|
||||
pink
|
||||
pitch
|
||||
pitch-range
|
||||
play
|
||||
play-during
|
||||
plum
|
||||
pointer
|
||||
portarait
|
||||
position
|
||||
powderblue
|
||||
pre
|
||||
pre-line
|
||||
pre-wrap
|
||||
progid
|
||||
progress
|
||||
pt
|
||||
punctuation
|
||||
purple
|
||||
px
|
||||
quote
|
||||
quotes
|
||||
rad
|
||||
range
|
||||
rate
|
||||
red
|
||||
relative
|
||||
repeat
|
||||
repeat-x
|
||||
repeat-y
|
||||
reset
|
||||
resize
|
||||
richness
|
||||
ridge
|
||||
right
|
||||
right-side
|
||||
rightwards
|
||||
roman
|
||||
rosybrown
|
||||
row
|
||||
royalblue
|
||||
rtl
|
||||
run
|
||||
run-in
|
||||
s
|
||||
s-resize
|
||||
saddlebrown
|
||||
salmon
|
||||
sandybrown
|
||||
sans-serif
|
||||
scroll
|
||||
se
|
||||
se-resize
|
||||
seagreen
|
||||
seashell
|
||||
semi
|
||||
semi-condensed
|
||||
semi-expanded
|
||||
separate
|
||||
serif
|
||||
shadow
|
||||
show
|
||||
side
|
||||
sienna
|
||||
silent
|
||||
silever
|
||||
silver
|
||||
size
|
||||
skyblue
|
||||
slateblue
|
||||
slategray
|
||||
slow
|
||||
slower
|
||||
small
|
||||
small-caps
|
||||
small-caption
|
||||
smaller
|
||||
snow
|
||||
soft
|
||||
solid
|
||||
space
|
||||
spacing
|
||||
speak
|
||||
speak-header
|
||||
speak-numeral
|
||||
speak-punctuation
|
||||
specific
|
||||
specific-voice
|
||||
speech
|
||||
speech-rate
|
||||
spell
|
||||
spell-out
|
||||
springgreen
|
||||
square
|
||||
static
|
||||
status
|
||||
status-bar
|
||||
steelblue
|
||||
stress
|
||||
stretch
|
||||
style
|
||||
sub
|
||||
super
|
||||
sw
|
||||
sw-resize
|
||||
table
|
||||
table-caption
|
||||
table-cell
|
||||
table-column
|
||||
table-column-group
|
||||
table-footer-group
|
||||
table-header-group
|
||||
table-layout
|
||||
table-row
|
||||
table-row-group
|
||||
tan
|
||||
teal
|
||||
text
|
||||
text-align
|
||||
text-bottom
|
||||
text-decoration
|
||||
text-indent
|
||||
text-shadow
|
||||
text-top
|
||||
text-transform
|
||||
thick
|
||||
thin
|
||||
thistle
|
||||
through
|
||||
tomato
|
||||
top
|
||||
track
|
||||
transform
|
||||
transparent
|
||||
turquoise
|
||||
type
|
||||
ultra
|
||||
ultra-condensed
|
||||
ultra-expanded
|
||||
underline
|
||||
unicode
|
||||
unicode-bidi
|
||||
upper
|
||||
upper-alpha
|
||||
upper-latin
|
||||
upper-roman
|
||||
uppercase
|
||||
variant
|
||||
vertical
|
||||
vertical-align
|
||||
violet
|
||||
visibility
|
||||
visible
|
||||
visited
|
||||
voice
|
||||
voice-family
|
||||
volume
|
||||
w
|
||||
w-resize
|
||||
wait
|
||||
weight
|
||||
wheat
|
||||
white
|
||||
white-space
|
||||
whitesmoke
|
||||
wider
|
||||
widows
|
||||
width
|
||||
word
|
||||
word-spacing
|
||||
wrap
|
||||
x
|
||||
x-fast
|
||||
x-high
|
||||
x-large
|
||||
x-loud
|
||||
x-low
|
||||
x-slow
|
||||
x-small
|
||||
x-soft
|
||||
xx
|
||||
xx-large
|
||||
xx-small
|
||||
y
|
||||
yellow
|
||||
yellowgreen
|
||||
z
|
||||
z-index
|
||||
zero
|
162
dict/sh-mode
162
dict/sh-mode
|
@ -1,162 +0,0 @@
|
|||
alias
|
||||
bg
|
||||
bind
|
||||
break
|
||||
builtin
|
||||
caller
|
||||
cd
|
||||
command
|
||||
compgen
|
||||
complete
|
||||
compopt
|
||||
continue
|
||||
declare
|
||||
dirs
|
||||
disown
|
||||
echo
|
||||
enable
|
||||
eval
|
||||
exec
|
||||
exit
|
||||
export
|
||||
fc
|
||||
fg
|
||||
getopts
|
||||
hash
|
||||
help
|
||||
history
|
||||
jobs
|
||||
kill
|
||||
let
|
||||
local
|
||||
logout
|
||||
mapfile
|
||||
popd
|
||||
printf
|
||||
pushd
|
||||
pwd
|
||||
read
|
||||
readarray
|
||||
readonly
|
||||
return
|
||||
set
|
||||
shift
|
||||
shopt
|
||||
source
|
||||
suspend
|
||||
test
|
||||
times
|
||||
trap
|
||||
type
|
||||
typeset
|
||||
ulimit
|
||||
umask
|
||||
unalias
|
||||
unset
|
||||
wait
|
||||
case
|
||||
do
|
||||
done
|
||||
elif
|
||||
else
|
||||
esac
|
||||
fi
|
||||
for
|
||||
function
|
||||
if
|
||||
in
|
||||
select
|
||||
then
|
||||
time
|
||||
until
|
||||
while
|
||||
BASH
|
||||
BASH_ALIASES
|
||||
BASH_ARGC
|
||||
BASH_ARGV
|
||||
BASH_CMDS
|
||||
BASH_COMMAND
|
||||
BASH_ENV
|
||||
BASH_EXECUTION_STRING
|
||||
BASH_LINENO
|
||||
BASH_REMATCH
|
||||
BASH_SOURCE
|
||||
BASH_SUBSHELL
|
||||
BASH_VERSINFO
|
||||
BASH_VERSION
|
||||
BASH_XTRACEFD
|
||||
BASHOPTS
|
||||
BASHPID
|
||||
CDPATH
|
||||
COLUMNS
|
||||
COMP_CWORD
|
||||
COMP_KEY
|
||||
COMP_LINE
|
||||
COMP_POINT
|
||||
COMP_TYPE
|
||||
COMP_WORDBREAKS
|
||||
COMP_WORDS
|
||||
COMPREPLY
|
||||
DIRSTACK
|
||||
EMACS
|
||||
EUID
|
||||
FCEDIT
|
||||
FIGNORE
|
||||
FUNCNAME
|
||||
GLOBIGNORE
|
||||
GROUPS
|
||||
HISTCMD
|
||||
HISTCONTROL
|
||||
HISTFILE
|
||||
HISTFILESIZE
|
||||
HISTIGNORE
|
||||
HISTSIZE
|
||||
HISTTIMEFORMAT
|
||||
HOME
|
||||
HOSTFILE
|
||||
HOSTNAME
|
||||
HOSTTYPE
|
||||
IFS
|
||||
IGNOREEOF
|
||||
INPUTRC
|
||||
LANG
|
||||
LC_ALL
|
||||
LC_COLLATE
|
||||
LC_CTYPE
|
||||
LC_MESSAGES
|
||||
LC_MESSAGES
|
||||
LC_NUMERIC
|
||||
LINENO
|
||||
LINES
|
||||
MACHTYPE
|
||||
MAIL
|
||||
MAILCHECK
|
||||
MAILPATH
|
||||
OLDPWD
|
||||
OPTARG
|
||||
OPTERR
|
||||
OPTIND
|
||||
OSTYPE
|
||||
PATH
|
||||
PIPESTATUS
|
||||
POSIXLY_CORRECT
|
||||
PPID
|
||||
PROMPT_COMMAND
|
||||
PROMPT_DIRTRIM
|
||||
PS1
|
||||
PS2
|
||||
PS3
|
||||
PS4
|
||||
PWD
|
||||
RANDOM
|
||||
REPLY
|
||||
SECONDS
|
||||
SHELL
|
||||
SHELLOPTS
|
||||
SHLVL
|
||||
TEXTDOMAIN
|
||||
TEXTDOMAINDIR
|
||||
TIMEFORMAT
|
||||
TMOUT
|
||||
TMPDIR
|
||||
UID
|
111
init.el
111
init.el
|
@ -1,18 +1,19 @@
|
|||
;;; NARF! Emacs for the jaded vimmer
|
||||
;;; init.el --- NARF bootstrap
|
||||
;;
|
||||
;; Author: Henrik Lissner <henrik@lissner>
|
||||
;; URL: https://github.com/hlissner/emacs.d
|
||||
;; Author: Henrik Lissner <henrik@lissner.net>
|
||||
;; URL: https://github.com/hlissner/emacs.d
|
||||
;; Version: 0.0.0001
|
||||
;;
|
||||
;;; Narf!
|
||||
;;; Are you pondering what i'm pondering, Pinky?
|
||||
;;
|
||||
;; ,,, !/:.
|
||||
;; /::\". !!:::
|
||||
;; :::::\". ," \:,::
|
||||
;; ::::::\ ". ,","\::.
|
||||
;; \:::::":\ "/""V' :'
|
||||
;; \:::::":\ "/""v' :'
|
||||
;; !::::\ ! \ \ __
|
||||
;; "::::\ \ ! \.&&&&,
|
||||
;; ," __ ", CD,&&&&&&'
|
||||
;; ," __ ", cd,&&&&&&'
|
||||
;; \ ". "" / \&&&" _,---
|
||||
;; "",__\_ / _,:":::::
|
||||
;; _," ,"" ,-,__,/":,_ ,",":::::::
|
||||
|
@ -22,73 +23,65 @@
|
|||
;; / ,"_!:::::::/, ," _,,--, /::::::/
|
||||
;; / "" _,"\:::::::' ! ," ){:::::/
|
||||
;; ! _," \ "", \,"""-,____,"__,,,"_," _/
|
||||
;; ""T" \\ \ "-,_(*)&&&&(*)," \ ."
|
||||
;; ""t" \\ \ "-,_(*)&&&&(*)," \ ."
|
||||
;; / \", ! , \ ! - )
|
||||
;; ! \ "" ! !==!"-,__,'
|
||||
;; ! \ """_""""`, ", /"_
|
||||
;; \ , .L /" " ", \! ,_/
|
||||
;; \ , .l /" " ", \! ,_/
|
||||
;; ), \ / \ \/ ,, /! !
|
||||
;; ,::\ \," \ ! \/ ! !
|
||||
;; _,::::" ) )\ ," ___ \ -,_, ,"",! !
|
||||
;; __,,,::::"" ," ,":::,-:::--:" __\_!__/_""-,_!
|
||||
;; ,,:::""""""" ,:_,""__...._"""::::"" /:::::" ""::::::
|
||||
;; (:._ L::::::::::::\\/ "" ""
|
||||
;; (:._ l::::::::::::\\/ "" ""
|
||||
;; """"--,,,--- """"
|
||||
;;
|
||||
;;; Code:
|
||||
(defconst DEBUG-MODE nil)
|
||||
;; These mice are not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
(defconst DEFAULT-FONT (font-spec :family "Terminus (TTF)" :size 12 :antialias nil))
|
||||
(defconst DEFAULT-THEME 'narf-dark) ; for GUI client
|
||||
(defconst TERM-THEME 'wombat) ; for <256 color terminals
|
||||
(defconst narf-debug-mode nil)
|
||||
|
||||
(load (concat user-emacs-directory "core/startup.el"))
|
||||
(narf/init
|
||||
'(core ; yoink @ core.el
|
||||
core-ui ; aesthetics
|
||||
core-evil ; evil-mode and its plugins
|
||||
core-editor ; completing the editor
|
||||
core-company ; for the lazy typist
|
||||
(defconst narf-default-font '(:family "terminus (ttf)" :size 12 :antialias nil))
|
||||
(defconst narf-default-theme (if window-system 'narf-dark 'wombat))
|
||||
|
||||
init-auto-insert ; see above
|
||||
init-fly ; fly(check|spell)
|
||||
init-vc ; version control gutter + git modes
|
||||
init-ido ; a search engine for your car keys
|
||||
init-helm ; a search engine for your life
|
||||
init-project ; dired, neotree
|
||||
(setq user-emacs-directory "~/Dropbox/Projects/dev/narf-emacs/")
|
||||
(load (concat user-emacs-directory "core/core.el"))
|
||||
(mapc 'require
|
||||
'())
|
||||
;; (;; Settings for specific modes or tools
|
||||
;; init-cc ; c/c++/obj-c madness
|
||||
;; ;; init-cscope
|
||||
;; ;; init-csharp ; unity, mono and xamarin
|
||||
;; init-data ; dbs 'n data formats
|
||||
;; ;; init-eshell
|
||||
;; ;; init-go
|
||||
;; init-java ; the poster child for carpal tunnel syndome
|
||||
;; init-js ; alert("not java, javascript!")
|
||||
;; init-lisp ; elisp, clisp and clojure
|
||||
;; init-lua ; one-based indices? one-based indices.
|
||||
;; init-org ; for fearless [organized] leader
|
||||
;; init-php ; making php less painful to work with
|
||||
;; init-python ; beautiful is better than ugly
|
||||
;; init-regex ; /^[^\s](meaning)[^\n]*/
|
||||
;; init-ruby ; <3
|
||||
;; init-scss ; @include magic;
|
||||
;; init-sh ; #!/bin/bash_your_head_in
|
||||
;; ;; init-sonicpi ; the funk soul brotha
|
||||
;; ;; init-swift ; yay, emoji variabless!
|
||||
;; init-text ; i got nothing...
|
||||
;; ;; init-rust
|
||||
;; ;; init-r ; for science!
|
||||
;; init-vim ; the confessional
|
||||
;; init-web ; for the 2.0'er
|
||||
|
||||
init-cc ; C/C++/Obj-C madness
|
||||
;; init-cscope
|
||||
;; init-csharp ; unity, mono and xamarin
|
||||
init-data ; DBs 'n data formats
|
||||
;; init-eshell
|
||||
;; init-go
|
||||
init-java ; the poster child for carpal tunnel syndome
|
||||
init-js ; alert("not java, javascript!")
|
||||
init-lisp ; elisp, clisp and clojure
|
||||
init-lua ; one-based indices? One-based indices.
|
||||
init-org ; for fearless [organized] leader
|
||||
init-php ; making php less painful to work with
|
||||
init-python ; beautiful is better than ugly
|
||||
init-regex ; /^[^\s](meaning)[^\n]*/
|
||||
init-ruby ; <3
|
||||
init-scss ; @include magic;
|
||||
init-sh ; #!/bin/bash_your_head_in
|
||||
;; bindings
|
||||
;; commands
|
||||
;; )
|
||||
;; )
|
||||
|
||||
;; init-sonicpi ;
|
||||
;; init-swift ; yay, emoji variabless!
|
||||
init-text ; I got nothing...
|
||||
;; init-rust
|
||||
;; init-r ; for science!
|
||||
init-vim ; the confessional
|
||||
init-web ; for the 2.0'er
|
||||
init-workgroups ; session management I can understand
|
||||
init-yasnippet ; type for me
|
||||
|
||||
narf-bindings
|
||||
narf-commands
|
||||
narf-settings
|
||||
))
|
||||
(require 'local nil t)
|
||||
(message ">>> Loaded in %s" (emacs-init-time))
|
||||
|
||||
|
||||
;;; Are you pondering what I'm pondering Pinky?
|
||||
;;; I think so Brain...
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
(use-package autoinsert
|
||||
:config
|
||||
(progn
|
||||
;; (setq auto-insert-directory "%/.emacs.d/templates/")
|
||||
(setq auto-insert-query nil) ; Don't prompt before insertion
|
||||
(setq auto-insert-alist '())
|
||||
|
||||
(auto-insert-mode 1)))
|
||||
|
||||
(after "yasnippet"
|
||||
(defun add-template (regexp-or-major-mode uuid yas-mode &optional project-only)
|
||||
(define-auto-insert regexp-or-major-mode
|
||||
`(lambda () (insert-template ,uuid ',yas-mode ,project-only))))
|
||||
|
||||
(defun insert-template (uuid mode &optional project-only)
|
||||
"Expand snippet template in MODE by its UUID"
|
||||
(unless (or (and project-only (not (narf/project-p)))
|
||||
(not (or (eq major-mode mode)
|
||||
(symbol-value mode))))
|
||||
(insert uuid)
|
||||
(yas-expand-from-trigger-key)
|
||||
(if (string-equal uuid (s-trim (buffer-string)))
|
||||
(erase-buffer)
|
||||
(evil-insert-state 1))))
|
||||
|
||||
(add-template "/\\.gitignore$" "%%" 'gitignore-mode)
|
||||
|
||||
;; C/C++
|
||||
(add-template "/Makefile$" "%%" 'makefile-gmake-mode)
|
||||
(add-template "/main\\.\\(cc\\|cpp\\)$" "%main.cpp%" 'c++-mode)
|
||||
(add-template "/win32_\\.\\(cc\\|cpp\\)$" "%winmain.cpp%" 'c++-mode)
|
||||
(add-template "\\.\\([Hh]\\|hpp\\)$" "%.h%" 'c++-mode)
|
||||
(add-template "\\.\\([Cc]\\|cc\\|cpp\\)$" "%.cpp%" 'c++-mode)
|
||||
|
||||
;; Shell scripts
|
||||
(add-template "\\.z?sh$" "%%" 'sh-mode)
|
||||
|
||||
;; Ruby
|
||||
(add-template "/spec_helper\\.rb$" "%helper%" 'rspec-mode t)
|
||||
(add-template "_spec\\.rb$" "%%" 'rspec-mode t)
|
||||
(add-template "/\\.rspec$" "%.rspec%" 'rspec-mode)
|
||||
(add-template "/Rakefile$" "%Rakefile%" 'ruby-mode t)
|
||||
(add-template "/Gemfile$" "%Gemfile%" 'ruby-mode t)
|
||||
;; (add-template "\\.gemspec$" "%.gemspec%" 'ruby-mode t)
|
||||
(add-template "/lib/.+\\.rb$" "%module%" 'ruby-mode t)
|
||||
(add-template "\\.rb$" "%%" 'ruby-mode)
|
||||
|
||||
;; ;; Python
|
||||
;; (add-template "tests?/test_.+\\.py$" "%%" 'nose-mode)
|
||||
;; (add-template "/setup\\.py$" "%setup%" 'python-mode)
|
||||
(add-template "\\.py$" "%%" 'python-mode)
|
||||
|
||||
;; ;; PHP
|
||||
;; (add-template "\\.class\\.php$" "%class%" 'php-mode)
|
||||
;; (add-template "\\.php$" "%%" 'php-mode)
|
||||
|
||||
;; ;; Markdown
|
||||
(add-template "\\.md$" "%%" 'markdown-mode)
|
||||
;; (add-template "/_posts/.+\\.md$" "%jekyll-post" 'markdown-mode)
|
||||
;; (add-template "/_layouts/.+\\.html$" "%jekyll-layout%" 'web-mode)
|
||||
|
||||
;; ;; Javascript
|
||||
(add-template "\\.lbaction/Contents/Info.plist$" "%Info.plst%" 'lb6-mode)
|
||||
(add-template "\\.lbaction/.+/\\(default\\|suggestions\\)\\.js$" "%default.js%" 'lb6-mode)
|
||||
;; (add-template "/package\\.json$" "%package.json%" 'json-mode)
|
||||
;; (add-template "\\.\\(json\\|jshintrc\\)$" "%%" 'json-mode)
|
||||
|
||||
;; ;; SCSS
|
||||
;; (add-template "/master\\.scss$" "%master%" 'scss-mode)
|
||||
;; (add-template "/normalize\\.scss$" "%normalize%" 'scss-mode)
|
||||
;; (add-template "\\.scss$" "%%" 'scss-mode)
|
||||
|
||||
;; ;; HTML
|
||||
;; (add-template "\\.html$" "%%" 'web-mode)
|
||||
|
||||
;; Lua
|
||||
;; (add-template "\\.love/main\\.lua$" "%love.main%" 'lua-mode)
|
||||
(add-template "/conf\\.lua$" "%love.conf%" 'love-mode)
|
||||
;; (add-template "\\.lua$" "%%" 'lua-mode)
|
||||
|
||||
;; ;; Java
|
||||
(add-template "/src/.+/.+\\.java$" "%%" 'java-mode)
|
||||
(add-template "/build\\.gradle$" "%gradle%" 'android-mode)
|
||||
|
||||
;; ;; Elisp
|
||||
(add-template "\\.emacs\\.d/.+\\.el$" "%initfile%" 'emacs-lisp-mode)
|
||||
(add-template "\\.emacs\\.d/snippets/.+$" "%%" 'snippet-mode))
|
||||
|
||||
|
||||
(provide 'init-auto-insert)
|
||||
;;; init-auto-insert.el ends here
|
153
init/init-cc.el
153
init/init-cc.el
|
@ -1,153 +0,0 @@
|
|||
(use-package cmake-mode
|
||||
:mode "CMakeLists\\.txt$"
|
||||
:config
|
||||
(progn
|
||||
(after "company"
|
||||
(use-package company-cmake
|
||||
:config
|
||||
(narf/add-company-backend cmake-mode (company-cmake company-yasnippet))))))
|
||||
|
||||
(use-package glsl-mode
|
||||
:mode (("\\.glsl\\'" . glsl-mode)
|
||||
("\\.vert\\'" . glsl-mode)
|
||||
("\\.frag\\'" . glsl-mode)
|
||||
("\\.geom\\'" . glsl-mode)))
|
||||
|
||||
(use-package cc-mode
|
||||
:defines (c-syntactic-context)
|
||||
:functions (c-toggle-electric-state c-toggle-auto-newline
|
||||
c-skip-comments-and-strings c-forward-sws c-end-of-macro
|
||||
c-font-lock-invalid-string csharp-log c-font-lock-declarators
|
||||
c-get-lang-constant c-forward-keyword-clause
|
||||
c-fontify-recorded-types-and-refs c-forward-type imenu--split
|
||||
c-backward-sws c-determine-limit c-beginning-of-decl-1)
|
||||
:commands (c-mode c++-mode objc-mode java-mode)
|
||||
:init
|
||||
(progn
|
||||
(associate-mode "\\.h$" 'c++-mode)
|
||||
(associate-mode "\\.mm$" 'objc-mode))
|
||||
:config
|
||||
(progn
|
||||
;; Settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(setq c-basic-offset 4
|
||||
c-tab-always-indent nil
|
||||
c-electric-flag nil)
|
||||
|
||||
(progn ; C/C++ Settings
|
||||
(after "flycheck"
|
||||
(when IS-MAC
|
||||
(setq flycheck-clang-language-standard "c++11"
|
||||
flycheck-clang-standard-library "libc++"
|
||||
flycheck-c/c++-clang-executable "clang++"
|
||||
flycheck-clang-include-path '("/usr/local/include"))))
|
||||
|
||||
(after "company"
|
||||
;; TODO Clang is *really* slow in larger projects, maybe replace it with irony-mode or ycmd?
|
||||
(narf/add-company-backend c-mode (company-c-headers company-clang))
|
||||
(narf/add-company-backend c++-mode (company-c-headers company-clang))
|
||||
(narf/add-company-backend objc-mode (company-c-headers company-xcode)))
|
||||
|
||||
(defun narf--c-lineup-inclass (langelem)
|
||||
(let ((inclass (assoc 'inclass c-syntactic-context)))
|
||||
(save-excursion
|
||||
(goto-char (c-langelem-pos inclass))
|
||||
(if (or (looking-at "struct")
|
||||
(looking-at "typedef struct"))
|
||||
'+
|
||||
'++))))
|
||||
(defun narf|init-c/c++-settings ()
|
||||
(c-toggle-electric-state -1)
|
||||
(c-toggle-auto-newline -1)
|
||||
(c-set-offset 'substatement-open '0) ; brackets should be at same indentation level as the statements they open
|
||||
(c-set-offset 'inline-open '+)
|
||||
(c-set-offset 'block-open '+)
|
||||
(c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level
|
||||
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
|
||||
(c-set-offset 'access-label '-)
|
||||
(c-set-offset 'inclass 'narf--c-lineup-inclass)
|
||||
;; DEL mapping interferes with smartparens and my custom DEL binding
|
||||
(define-key c-mode-map (kbd "DEL") nil))
|
||||
(add-hook 'c-mode-hook 'narf|init-c/c++-settings)
|
||||
(add-hook 'c++-mode-hook 'narf|init-c/c++-settings)
|
||||
|
||||
;; C++11 syntax support (until cc-mode is updated)
|
||||
(require 'font-lock)
|
||||
(defun --copy-face (new-face face)
|
||||
"Define NEW-FACE from existing FACE."
|
||||
(copy-face face new-face)
|
||||
(eval `(defvar ,new-face nil))
|
||||
(set new-face new-face))
|
||||
|
||||
(--copy-face 'font-lock-label-face ; labels, case, public, private, proteced, namespace-tags
|
||||
'font-lock-keyword-face)
|
||||
(--copy-face 'font-lock-doc-markup-face ; comment markups such as Javadoc-tags
|
||||
'font-lock-doc-face)
|
||||
(--copy-face 'font-lock-doc-string-face ; comment markups
|
||||
'font-lock-comment-face)
|
||||
(global-font-lock-mode t)
|
||||
(setq font-lock-maximum-decoration t)
|
||||
|
||||
(add-hook! 'c++-mode-hook
|
||||
;; We could place some regexes into `c-mode-common-hook', but
|
||||
;; note that their evaluation order matters.
|
||||
(font-lock-add-keywords
|
||||
nil '(;; complete some fundamental keywords
|
||||
("\\<\\(void\\|unsigned\\|signed\\|char\\|short\\|bool\\|int\\|long\\|float\\|double\\)\\>" . font-lock-keyword-face)
|
||||
;; namespace names and tags - these are rendered as constants by cc-mode
|
||||
("\\<\\(\\w+::\\)" . font-lock-function-name-face)
|
||||
;; new C++11 keywords
|
||||
("\\<\\(alignof\\|alignas\\|constexpr\\|decltype\\|noexcept\\|nullptr\\|static_assert\\|thread_local\\|override\\|final\\)\\>" . font-lock-keyword-face)
|
||||
("\\<\\(char16_t\\|char32_t\\)\\>" . font-lock-keyword-face)
|
||||
;; PREPROCESSOR_CONSTANT, PREPROCESSORCONSTANT
|
||||
("\\<[A-Z]*_[A-Z_]+\\>" . font-lock-constant-face)
|
||||
("\\<[A-Z]\\{3,\\}\\>" . font-lock-constant-face)
|
||||
;; hexadecimal numbers
|
||||
("\\<0[xX][0-9A-Fa-f]+\\>" . font-lock-constant-face)
|
||||
;; integer/float/scientific numbers
|
||||
("\\<[\\-+]*[0-9]*\\.?[0-9]+\\([ulUL]+\\|[eE][\\-+]?[0-9]+\\)?\\>" . font-lock-constant-face)
|
||||
;; c++11 string literals
|
||||
;; L"wide string"
|
||||
;; L"wide string with UNICODE codepoint: \u2018"
|
||||
;; u8"UTF-8 string", u"UTF-16 string", U"UTF-32 string"
|
||||
("\\<\\([LuU8]+\\)\".*?\"" 1 font-lock-keyword-face)
|
||||
;; R"(user-defined literal)"
|
||||
;; R"( a "quot'd" string )"
|
||||
;; R"delimiter(The String Data" )delimiter"
|
||||
;; R"delimiter((a-z))delimiter" is equivalent to "(a-z)"
|
||||
("\\(\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(\\)" 1 font-lock-keyword-face t) ; start delimiter
|
||||
( "\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(\\(.*?\\))[^\\s-\\\\()]\\{0,16\\}\"" 1 font-lock-string-face t) ; actual string
|
||||
( "\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(.*?\\()[^\\s-\\\\()]\\{0,16\\}\"\\)" 1 font-lock-keyword-face t) ; end delimiter
|
||||
|
||||
;; user-defined types (rather project-specific)
|
||||
("\\<[A-Za-z_]+[A-Za-z_0-9]*_\\(type\\|ptr\\)\\>" . font-lock-type-face)
|
||||
("\\<\\(xstring\\|xchar\\)\\>" . font-lock-type-face)
|
||||
)) t)
|
||||
|
||||
;; Fix enum and C++11 lambda indentation
|
||||
(defadvice c-lineup-arglist (around c-lineup-arglist-indent-fix activate)
|
||||
"Improve indentation of continued C++11 lambda function opened as argument."
|
||||
(setq ad-return-value
|
||||
(if (and (equal major-mode 'c++-mode)
|
||||
(ignore-errors
|
||||
(save-excursion
|
||||
(goto-char (c-langelem-pos langelem))
|
||||
;; Detect "[...](" or "[...]{". preceded by "," or "(",
|
||||
;; and with unclosed brace.
|
||||
(looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$"))))
|
||||
0 ; no additional indent
|
||||
ad-do-it))))
|
||||
|
||||
(progn ; Obj-C
|
||||
(add-to-list 'magic-mode-alist
|
||||
`(,(lambda ()
|
||||
(and (string= (file-name-extension buffer-file-name) "h")
|
||||
(re-search-forward "@\\<interface\\>"
|
||||
magic-mode-regexp-match-limit t)))
|
||||
. objc-mode))
|
||||
(after "flycheck"
|
||||
(add-hook! 'objc-mode-hook (use-package flycheck-objc))))
|
||||
))
|
||||
|
||||
|
||||
(provide 'init-cc)
|
||||
;;; init-cc.el ends here
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
(use-package xcscope
|
||||
:init (cscope-setup)
|
||||
:config
|
||||
;; (push '("*cscope*" :position bottom) popwin:special-display-config)
|
||||
)
|
||||
|
||||
(add-hook 'ruby-mode-hook (function cscope-minor-mode))
|
||||
|
||||
|
||||
(provide 'init-cscope)
|
|
@ -1,25 +0,0 @@
|
|||
(use-package csharp-mode :mode "\\.cs$"
|
||||
:init
|
||||
(add-hook 'csharp-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(progn
|
||||
(use-package omnisharp
|
||||
:defer t
|
||||
:config
|
||||
(progn
|
||||
(setq omnisharp-server-executable-path
|
||||
"~/Dropbox/projects/lib/Omnisharp/server/OmniSharp/bin/Debug/OmniSharp.exe")
|
||||
|
||||
(bind :normal :map omnisharp-mode-map
|
||||
"gd" 'omnisharp-go-to-definition)
|
||||
|
||||
(after "company"
|
||||
(narf/add-company-backend csharp-mode (company-omnisharp))
|
||||
(add-hook 'csharp-mode-hook 'turn-on-eldoc-mode))))))
|
||||
|
||||
;; unity shaders
|
||||
(use-package shaderlab-mode :mode "\\.shader$")
|
||||
|
||||
|
||||
(provide 'init-csharp)
|
||||
;;; init-csharp.el ends here
|
|
@ -1,11 +0,0 @@
|
|||
(use-package yaml-mode
|
||||
:mode "\\.ya?ml$"
|
||||
:init (add-hook 'yaml-mode-hook 'narf|enable-tab-width-2))
|
||||
|
||||
(use-package json-mode
|
||||
:mode (("\\.json$" . json-mode)
|
||||
("\\.jshintrc$" . json-mode)))
|
||||
|
||||
|
||||
(provide 'init-data)
|
||||
;;; init-data.el ends here
|
|
@ -1,50 +0,0 @@
|
|||
;; (evil-set-initial-state 'eshell-mode 'emacs)
|
||||
|
||||
;; (push '("*eshell*" :position left :width 80 :stick t) popwin:special-display-config)
|
||||
|
||||
;; ;; eshell
|
||||
;; (setq eshell-directory-name (concat TMP-DIR "eshell"))
|
||||
;; (setq eshell-scroll-to-bottom-on-input 'all)
|
||||
;; (setq eshell-buffer-shorthand t)
|
||||
|
||||
|
||||
;; ;; em-alias
|
||||
;; (setq eshell-aliases-file (concat TMP-DIR ".eshell-aliases"))
|
||||
|
||||
|
||||
;; ;; em-glob
|
||||
;; (setq eshell-glob-case-insensitive t)
|
||||
;; (setq eshell-error-if-no-glob t)
|
||||
|
||||
|
||||
;; ;; em-hist
|
||||
;; (setq eshell-history-size 1024)
|
||||
|
||||
|
||||
;; ;; plan 9 smart shell
|
||||
;; ;; (after "esh-module"
|
||||
;; ;; (add-to-list 'eshell-modules-list 'eshell-smart)
|
||||
;; ;; (setq eshell-where-to-jump 'begin)
|
||||
;; ;; (setq eshell-review-quick-commands nil)
|
||||
;; ;; (setq eshell-smart-space-goes-to-end t))
|
||||
|
||||
;; (defun my-current-git-branch ()
|
||||
;; (let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n")
|
||||
;; when (string-match "^\*" match)
|
||||
;; collect match))))
|
||||
;; (if (not (eq branch nil))
|
||||
;; (concat " [" (substring branch 2) "]")
|
||||
;; "")))
|
||||
|
||||
;; (defun my-eshell-prompt ()
|
||||
;; (concat (propertize (abbreviate-file-name (eshell/pwd)) 'face 'eshell-prompt)
|
||||
;; (propertize (my-current-git-branch) 'face 'font-lock-function-name-face)
|
||||
;; (propertize " $ " 'face 'font-lock-constant-face)))
|
||||
|
||||
|
||||
;; ;; em-prompt
|
||||
;; (setq eshell-prompt-function 'my-eshell-prompt)
|
||||
|
||||
|
||||
(provide 'init-eshell)
|
||||
;;; init-eshell.el ends here
|
|
@ -1,45 +0,0 @@
|
|||
(use-package flycheck
|
||||
:functions (flycheck-buffer)
|
||||
:commands (flycheck-mode flycheck-list-errors)
|
||||
:init
|
||||
(add-to-hooks 'flycheck-mode '(ruby-mode-hook
|
||||
python-mode-hook
|
||||
php-mode-hook
|
||||
lua-mode-hook
|
||||
shell-mode-hook
|
||||
scss-mode-hook
|
||||
c++-mode-hook
|
||||
c-mode-hook))
|
||||
:config
|
||||
(progn ; flycheck settings
|
||||
(defun my-shorter-fly-status (result)
|
||||
(format "[%s]" (replace-regexp-in-string " FlyC:?" "" result)))
|
||||
(advice-add 'flycheck-mode-line-status-text :filter-return 'my-shorter-fly-status)
|
||||
|
||||
(setq-default flycheck-indication-mode 'right-fringe
|
||||
;; Removed checks on idle/change for snappiness
|
||||
flycheck-check-syntax-automatically '(save mode-enabled idle-change)
|
||||
flycheck-disabled-checkers '(emacs-lisp-checkdoc make))
|
||||
|
||||
(narf/add-throwaway-buffer "^\\*Flycheck.*\\*$")
|
||||
|
||||
(bind :normal :map flycheck-error-list-mode-map
|
||||
[escape] 'kill-this-buffer
|
||||
"q" 'kill-this-buffer)
|
||||
|
||||
(evil-initial-state 'flycheck-error-list-mode 'emacs)
|
||||
|
||||
(defun narf/evil-flycheck-buffer ()
|
||||
(if (and (featurep 'flycheck) flycheck-mode)
|
||||
(flycheck-buffer)))
|
||||
|
||||
;; Check buffer when normal mode is entered
|
||||
(add-hook 'evil-normal-state-entry-hook 'narf/evil-flycheck-buffer)
|
||||
;; And on ESC in normal mode.
|
||||
(advice-add 'evil-force-normal-state :after 'narf/evil-flycheck-buffer)))
|
||||
|
||||
(use-package flyspell :commands flyspell-mode)
|
||||
|
||||
|
||||
(provide 'init-fly)
|
||||
;;; init-fly.el ends here
|
|
@ -1,14 +0,0 @@
|
|||
(use-package go-mode
|
||||
:mode "\\.go$"
|
||||
:interpreter "go"
|
||||
:config
|
||||
(progn
|
||||
(bind normal :map go-mode-map "gd" 'godef-jump)
|
||||
|
||||
(use-package company-go
|
||||
:config
|
||||
(narf/add-company-backend go-mode (company-go company-yasnippet)))))
|
||||
|
||||
|
||||
(provide 'init-go)
|
||||
;;; init-go.el ends here
|
|
@ -1,176 +0,0 @@
|
|||
(use-package helm
|
||||
:commands (helm
|
||||
helm-etags-select
|
||||
helm-show-kill-ring
|
||||
helm-bookmarks
|
||||
helm-wg
|
||||
helm-ag
|
||||
helm-alive-p
|
||||
helm-attrset)
|
||||
:init
|
||||
(progn
|
||||
(defvar helm-global-prompt ">>> ")
|
||||
(evil-set-initial-state 'helm-mode 'emacs))
|
||||
:config
|
||||
(progn
|
||||
(use-package helm-grep)
|
||||
(use-package helm-ag
|
||||
:functions (helm-ag--select-source)
|
||||
:defines (helm-ag-source helm-ag--last-query))
|
||||
|
||||
;; No persistent header
|
||||
(defun narf--helm-display-mode-line (source &optional force)
|
||||
(setq mode-line-format nil)
|
||||
(setq header-line-format nil))
|
||||
(advice-add 'helm-display-mode-line :override 'narf--helm-display-mode-line)
|
||||
|
||||
;; Minimalistic split-fn; leaves popwin to handle helm buffers
|
||||
(defun narf--helm-split-window-fn (window)
|
||||
(if (one-window-p t)
|
||||
(let ((helm-full-frame t))
|
||||
(selected-window))
|
||||
(other-window-for-scrolling)))
|
||||
|
||||
(setq helm-quick-update t
|
||||
helm-idle-delay 0.05
|
||||
helm-input-idle-delay 0.05
|
||||
helm-reuse-last-window-split-state t
|
||||
helm-buffers-fuzzy-matching t
|
||||
helm-candidate-number-limit 40
|
||||
helm-bookmark-show-location t
|
||||
helm-split-window-default-side 'other
|
||||
helm-split-window-preferred-function 'narf--helm-split-window-fn) ; let popwin handle this
|
||||
|
||||
(after "winner"
|
||||
;; Tell winner-mode to ignore helm buffers
|
||||
(dolist (bufname '("*helm recentf*"
|
||||
"*helm projectile*"
|
||||
"*helm imenu*"
|
||||
"*helm company*"
|
||||
"*helm buffers*"
|
||||
;; "*helm tags*"
|
||||
"*helm-ag*"
|
||||
"*Helm Swoop*"))
|
||||
(push bufname winner-boring-buffers)))
|
||||
(narf/add-throwaway-buffer "^\\*[Hh]elm.*\\*$")
|
||||
|
||||
(bind :map helm-map
|
||||
"C-w" 'evil-delete-backward-word
|
||||
"C-u" 'helm-delete-minibuffer-contents
|
||||
"C-r" 'evil-ex-paste-from-register ; Evil registers in helm! Glorious!
|
||||
[escape] 'helm-keyboard-quit)))
|
||||
|
||||
(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
|
||||
projectile-global-mode
|
||||
helm-projectile-switch-to-buffer
|
||||
helm-projectile-find-file
|
||||
helm-projectile-recentf
|
||||
helm-projectile-find-other-file
|
||||
helm-projectile-switch-project)
|
||||
:diminish projectile-mode
|
||||
:config
|
||||
(progn
|
||||
(defun narf/project-invalidate-cache-maybe ()
|
||||
(when (projectile-project-p) (projectile-invalidate-cache nil)))
|
||||
(add-hook 'kill-emacs-hook 'narf/project-invalidate-cache-maybe)
|
||||
(setq-default projectile-enable-caching t)
|
||||
(setq projectile-sort-order 'recentf
|
||||
projectile-cache-file (concat TMP-DIR "projectile.cache")
|
||||
projectile-known-projects-file (concat TMP-DIR "projectile.projects")
|
||||
projectile-indexing-method 'alien
|
||||
projectile-project-root-files narf/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"))
|
||||
|
||||
(use-package helm-projectile)
|
||||
(projectile-global-mode +1)
|
||||
|
||||
;; Don't show the project name in the prompts; I already know.
|
||||
(defun projectile-prepend-project-name (string) helm-global-prompt)))
|
||||
|
||||
(use-package helm-org
|
||||
:commands (helm-org-in-buffer-headings
|
||||
helm-org-agenda-files-headings
|
||||
helm-org-capture-templates)
|
||||
:config
|
||||
(defun helm-get-org-candidates-in-file (filename min-depth max-depth
|
||||
&optional fontify nofname)
|
||||
(with-current-buffer (pcase filename
|
||||
((pred bufferp) filename)
|
||||
((pred stringp) (find-file-noselect filename)))
|
||||
(and fontify (jit-lock-fontify-now))
|
||||
(let ((match-fn (if fontify 'match-string 'match-string-no-properties)))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(cl-loop with width = (window-width)
|
||||
while (re-search-forward org-complex-heading-regexp nil t)
|
||||
if (let ((num-stars (length (match-string-no-properties 1))))
|
||||
(and (>= num-stars min-depth) (<= num-stars max-depth)))
|
||||
collect `(,(let ((heading (funcall match-fn 4))
|
||||
(file (unless nofname
|
||||
(concat (f-no-ext (f-relative filename org-directory)) ":")))
|
||||
(level (length (match-string-no-properties 1))))
|
||||
(org-format-outline-path
|
||||
(append (org-get-outline-path t level heading)
|
||||
(list heading)) width file))
|
||||
. ,(point-marker))))))))
|
||||
|
||||
(use-package helm-files
|
||||
:commands helm-recentf
|
||||
:config
|
||||
(progn
|
||||
;; Reconfigured `helm-recentf' to use `helm', instead of `helm-other-buffer'
|
||||
(defun helm-recentf ()
|
||||
(interactive)
|
||||
(let ((helm-ff-transformer-show-only-basename nil))
|
||||
(helm :sources '(helm-source-recentf)
|
||||
:buffer "*helm recentf*"
|
||||
:prompt helm-global-prompt)))))
|
||||
|
||||
(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
|
||||
:defines (helm-swoop-last-prefix-number)
|
||||
:commands (helm-swoop helm-multi-swoop helm-multi-swoop-all)
|
||||
:config
|
||||
(setq helm-swoop-use-line-number-face t
|
||||
helm-swoop-split-with-multiple-windows t
|
||||
helm-swoop-speed-or-color t))
|
||||
|
||||
(use-package helm-c-yasnippet :commands helm-yas-visit-snippet-file)
|
||||
(use-package helm-buffers :commands helm-buffers-list)
|
||||
(use-package helm-semantic :commands helm-semantic-or-imenu)
|
||||
(use-package helm-elisp :commands helm-apropos)
|
||||
(use-package helm-command :commands helm-M-x)
|
||||
(use-package helm-company :defer t)
|
||||
|
||||
|
||||
(provide 'init-helm)
|
||||
;;; init-helm.el ends here
|
|
@ -1,62 +0,0 @@
|
|||
(use-package ido
|
||||
:defines (flx-ido-mode ido-ubiquitous-debug-mode ido-context-switch-command ido-temp-list)
|
||||
:functions (ido-to-end)
|
||||
:commands (ido-mode
|
||||
ido-everywhere
|
||||
ido-vertical-mode
|
||||
flx-ido-mode
|
||||
ido-ubiquitous-mode
|
||||
ido-find-file
|
||||
ido-find-file-in-dir)
|
||||
:config
|
||||
(progn
|
||||
(ido-mode 1)
|
||||
(ido-everywhere 1)
|
||||
|
||||
(use-package ido-vertical-mode :config (ido-vertical-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
|
||||
ido-confirm-unique-completion t
|
||||
ido-case-fold t
|
||||
ido-enable-tramp-completion nil
|
||||
ido-enable-flex-matching t
|
||||
ido-create-new-buffer 'always
|
||||
ido-enable-tramp-completion t
|
||||
ido-enable-last-directory-history t
|
||||
ido-save-directory-list-file (concat TMP-DIR "ido.last"))
|
||||
|
||||
(add-to-list 'ido-ignore-files "\\`.DS_Store$")
|
||||
(add-to-list 'ido-ignore-files "Icon\\?$")
|
||||
(setq ido-ignore-buffers
|
||||
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer"
|
||||
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-"
|
||||
"_region_" " output\\*$" "^TAGS$" "^\*Ido"))
|
||||
|
||||
; sort ido filelist by mtime instead of alphabetically
|
||||
(add-hook 'ido-make-file-list-hook 'ido-sort-mtime)
|
||||
(add-hook 'ido-make-dir-list-hook 'ido-sort-mtime)
|
||||
(defun ido-sort-mtime ()
|
||||
(setq ido-temp-list
|
||||
(sort ido-temp-list
|
||||
(lambda (a b)
|
||||
(time-less-p
|
||||
(sixth (file-attributes (concat ido-current-directory b)))
|
||||
(sixth (file-attributes (concat ido-current-directory a)))))))
|
||||
(ido-to-end ;; move . files to end (again)
|
||||
(delq nil (mapcar
|
||||
(lambda (x) (and (char-equal (string-to-char x) ?.) x))
|
||||
ido-temp-list))))
|
||||
|
||||
;; Press ~ to go to $HOME in ido
|
||||
(add-hook! 'ido-setup-hook
|
||||
;; Go straight home
|
||||
(define-key ido-file-completion-map (kbd "~")
|
||||
(λ (if (looking-back "/")
|
||||
(insert "~/")
|
||||
(call-interactively 'self-insert-command)))))))
|
||||
|
||||
|
||||
(provide 'init-ido)
|
||||
;;; init-ido.el ends here
|
|
@ -1,84 +0,0 @@
|
|||
(defun narf/java-project-package ()
|
||||
(if (eq major-mode 'java-mode)
|
||||
(s-chop-suffix "." (s-replace "/" "." (f-dirname (f-relative (buffer-file-name)
|
||||
(concat (narf/project-root) "/src/")))))
|
||||
""))
|
||||
|
||||
(defun narf/java-class-name ()
|
||||
(if (eq major-mode 'java-mode)
|
||||
(f-no-ext (f-base (buffer-file-name)))
|
||||
""))
|
||||
|
||||
(use-package eclim
|
||||
:functions (eclim--project-dir eclim--project-name)
|
||||
:commands (eclim-mode global-eclim-mode)
|
||||
:init
|
||||
(progn
|
||||
(setq eclim-eclipse-dirs '("/Applications/eclipse")
|
||||
eclim-executable "/Applications/eclipse/eclim")
|
||||
(when (file-exists-p eclim-executable)
|
||||
(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)
|
||||
|
||||
(setq help-at-pt-display-when-idle t)
|
||||
(setq help-at-pt-timer-delay 0.1)
|
||||
(help-at-pt-set-timer)
|
||||
|
||||
(push "*eclim: problems*" winner-boring-buffers)
|
||||
|
||||
(after "company"
|
||||
(use-package company-emacs-eclim
|
||||
:config (company-emacs-eclim-setup)))
|
||||
|
||||
(bind :motion :map java-mode-map "gd" 'eclim-java-find-declaration)))
|
||||
|
||||
(use-package android-mode
|
||||
:commands android-mode
|
||||
:init
|
||||
(progn
|
||||
;; yasnippet defuns
|
||||
(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 narf|android-mode-enable-maybe ()
|
||||
(let ((root (narf/project-root)))
|
||||
(when (or (narf/project-has-files "local.properties" root)
|
||||
(narf/project-has-files "AndroidManifest.xml" root)
|
||||
(narf/project-has-files "src/main/AndroidManifest.xml" root))
|
||||
(android-mode +1)
|
||||
(narf/set-build-command "./gradlew %s" "build.gradle"))))
|
||||
|
||||
(after "company" (add-to-list 'company-dictionary-major-minor-modes 'android-mode))
|
||||
(add-hook 'java-mode-hook 'narf|android-mode-enable-maybe)
|
||||
(add-hook 'groovy-mode-hook 'narf|android-mode-enable-maybe)
|
||||
(add-hook 'nxml-mode-hook 'narf|android-mode-enable-maybe)
|
||||
(add-hook! 'android-mode-hook (narf/init-yas-mode 'android-mode))))
|
||||
|
||||
(use-package groovy-mode
|
||||
:functions (is-groovy-mode)
|
||||
:mode "\\.gradle$")
|
||||
|
||||
|
||||
(provide 'init-java)
|
||||
;;; init-java.el ends here
|
|
@ -1,57 +0,0 @@
|
|||
(use-package js2-mode
|
||||
:mode "\\.js$"
|
||||
:interpreter "node"
|
||||
:config
|
||||
(progn
|
||||
(setq js2-skip-preprocessor-directives t)
|
||||
(setq-default js2-show-parse-errors nil)
|
||||
(setq-default js2-global-externs '("module" "require" "buster" "sinon" "assert"
|
||||
"refute" "setTimeout" "clearTimeout"
|
||||
"setInterval" "clearInterval" "location"
|
||||
"__dirname" "console" "JSON" "jQuery" "$"
|
||||
;; Launchbar API
|
||||
"LaunchBar" "File" "Action" "HTTP" "include"))
|
||||
|
||||
(after "web-beautify"
|
||||
(add-hook! 'js2-mode-hook (setenv "jsbeautify_indent_size" "4"))
|
||||
(bind :motion :map js2-mode-map "gQ" 'web-beautify-js))
|
||||
|
||||
(after "emr" (use-package js2-refactor))
|
||||
|
||||
;; [pedantry intensifies]
|
||||
(defadvice js2-mode (after js2-mode-rename-modeline activate)
|
||||
(setq mode-name "Javascript2"))
|
||||
|
||||
(use-package tern
|
||||
:diminish (tern-mode . "tern")
|
||||
:commands tern-mode
|
||||
:init
|
||||
(add-hook 'js2-mode-hook 'tern-mode)
|
||||
:config
|
||||
(after "company"
|
||||
(use-package company-tern
|
||||
:config
|
||||
(narf/add-company-backend js2-mode (company-tern)))))))
|
||||
|
||||
;; For UnityScript
|
||||
(use-package unityjs-mode
|
||||
:mode "/Assets/*.js$"
|
||||
:config
|
||||
(progn
|
||||
(add-hook 'unityjs-mode-hook 'flycheck-mode)
|
||||
(add-hook! 'unityjs-mode-hook
|
||||
(narf|enable-tab-width-2)
|
||||
(setq js-indent-level 2))))
|
||||
|
||||
;; For launchbar script development
|
||||
(define-minor-mode lb6-mode
|
||||
"Launchbar development mode."
|
||||
:init-value nil
|
||||
:lighter "lb6"
|
||||
:keymap (make-sparse-keymap)
|
||||
(narf/init-yas-mode 'lb6-mode))
|
||||
(associate-minor-mode "\\.lb\\(action\\|ext\\)/.*$" 'lb6-mode)
|
||||
|
||||
|
||||
(provide 'init-js)
|
||||
;;; init-js.el ends here
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
;; TODO: Do this later
|
||||
|
||||
(add-hook! 'hs-minor-mode-hook (when hs-minor-mode (hs-hide-level 3)))
|
||||
|
||||
;; [pedantry intensifies]
|
||||
(defadvice emacs-lisp-mode (after emacs-lisp-mode-rename-modeline activate)
|
||||
(setq mode-name "Elisp"))
|
||||
|
||||
;; Real go-to-definition for elisp
|
||||
(bind :motion :map 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)))))
|
||||
|
||||
|
||||
(provide 'init-lisp)
|
||||
;;; init-lisp.el ends here
|
|
@ -1,28 +0,0 @@
|
|||
(use-package lua-mode
|
||||
:mode "\\.lua$"
|
||||
:interpreter "lua"
|
||||
:init
|
||||
(progn
|
||||
(setq lua-indent-level tab-width)
|
||||
|
||||
(when (file-exists-p "/Applications/love.app")
|
||||
(define-minor-mode love-mode
|
||||
"Buffer local minor mode for Love2D"
|
||||
:init-value nil
|
||||
:lighter " <3"
|
||||
:keymap (make-sparse-keymap)
|
||||
(narf/init-yas-mode 'love-mode))
|
||||
(add-hook! 'lua-mode-hook
|
||||
(narf/set-build-command "open -a love.app '%s'" "main.lua")
|
||||
(when (narf/project-has-files "main.lua")
|
||||
(love-mode +1))))
|
||||
|
||||
(after "company" (add-to-list 'company-dictionary-major-minor-modes 'love-mode))
|
||||
|
||||
(add-hook! 'lua-mode-hook
|
||||
(narf|enable-tab-width-2)
|
||||
(setq lua-indent-level 2))))
|
||||
|
||||
|
||||
(provide 'init-lua)
|
||||
;;; init-lua.el ends here
|
255
init/init-org.el
255
init/init-org.el
|
@ -1,255 +0,0 @@
|
|||
(define-minor-mode evil-org-mode
|
||||
"Evil-mode bindings for org-mode."
|
||||
:init-value nil
|
||||
:lighter "!"
|
||||
:keymap (make-sparse-keymap) ; defines evil-org-mode-map
|
||||
:group 'evil-org)
|
||||
|
||||
(use-package org
|
||||
:defines (org-directory)
|
||||
:functions (org-bookmark-jump-unhide outline-next-heading org-end-of-subtree
|
||||
outline-flag-region org-remove-inline-images org-display-inline-images
|
||||
org-at-item-checkbox-p org-toggle-checkbox org-entry-is-todo-p org-todo
|
||||
org-format-outline-path org-get-outline-path)
|
||||
:commands (org-capture
|
||||
org-capture-string)
|
||||
:mode (("\\.org$" . org-mode)
|
||||
("\\.opml$" . org-mode))
|
||||
:init
|
||||
(progn
|
||||
(add-hook 'org-mode-hook 'narf|enable-tab-width-2)
|
||||
(add-hook 'org-mode-hook 'narf|enable-hard-wrap)
|
||||
(add-hook 'org-mode-hook 'iimage-mode)
|
||||
(add-hook 'org-mode-hook 'org-indent-mode)
|
||||
(add-hook 'org-mode-hook 'evil-org-mode)
|
||||
(add-hook! 'org-mode-hook (hl-line-mode -1)))
|
||||
:config
|
||||
(progn
|
||||
(after "org-indent" (diminish 'org-indent-mode))
|
||||
(after "iimage" (diminish 'iimage-mode))
|
||||
|
||||
(setq org-directory "~/Dropbox/notes")
|
||||
(setq org-project-directory (expand-file-name "projects" org-directory) ; custom variable
|
||||
org-default-notes-file (expand-file-name "notes.org" org-directory)
|
||||
org-agenda-files (f-entries org-directory (lambda (path) (and (f-ext? path "org")
|
||||
(not (f-same? path (f-expand "inbox.org" org-directory))))) t)
|
||||
org-archive-location (concat org-directory "/archive/%s::")
|
||||
org-confirm-babel-evaluate nil
|
||||
org-src-tab-acts-natively t
|
||||
org-image-actual-width 250
|
||||
org-startup-with-inline-images t
|
||||
org-completion-use-ido t
|
||||
org-hidden-keywords '(title)
|
||||
org-special-ctrl-a/e t
|
||||
org-hide-leading-stars t
|
||||
org-hierarchical-todo-statistics t
|
||||
org-checkbox-hierarchical-statistics t
|
||||
org-tags-column -87
|
||||
org-log-done t
|
||||
org-confirm-elisp-link-function nil
|
||||
org-startup-folded 'content
|
||||
org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
|
||||
(sequence "DOING(s)" "PENDING(p)")
|
||||
(sequence "|" "CANCELLED(c)"))
|
||||
org-mobile-directory "~/Dropbox/Apps/MobileOrg"
|
||||
org-mobile-inbox-for-pull (expand-file-name "mobile.org" org-directory))
|
||||
|
||||
(setq org-src-fontify-natively t
|
||||
org-blank-before-new-entry '((heading . auto) (plain-list-item . auto))
|
||||
org-export-backends '(ascii html latex md opml))
|
||||
|
||||
(add-to-list 'org-link-frame-setup '(file . find-file))
|
||||
|
||||
(setq org-tag-alist '(("@home" . ?h)
|
||||
("@daily" . ?d)
|
||||
("@invoices" . ?i)
|
||||
("@personal" . ?p)
|
||||
("@learning" . ?l)
|
||||
("@dev" . ?v)
|
||||
("@writing" . ?w)
|
||||
("@projects" . ?r)))
|
||||
|
||||
(setq org-capture-templates
|
||||
'(("t" "TODO" entry (file+headline "~/Dropbox/notes/todo.org" "Inbox") "* TODO %? %u\n%i")
|
||||
("T" "Project TODO" entry (file+headline (narf/project-org-filename) "Tasks") "** TODO %?\n%i" :prepend t)
|
||||
("N" "Project Note" entry (file+headline (narf/project-org-filename) "Notes") "** %u %?\n%i")
|
||||
("c" "Changelog" entry (file+datetree (narf/project-org-filename)) "** %<%H:%M>: %? :unsorted:\n%i" :prepend t)
|
||||
("n" "Note" entry (file+datetree org-default-notes-file) "** %<%H:%M>: %?\n%i" :prepend t)
|
||||
("j" "Journal" entry (file+datetree "~/Dropbox/notes/journal.org") "** %?%^g\nAdded: %U\n%i")
|
||||
("a" "Trivia" entry (file "~/Dropbox/notes/trivia.org") "* %u %?\n%i" :prepend t)
|
||||
("s" "Writing Scraps" entry (file "~/Dropbox/notes/writing.org") "* %u %?\n%i" :prepend t)
|
||||
("v" "Vocab" entry (file "~/Dropbox/notes/vocab.org") "* %?\n%i" :prepend t)
|
||||
("e" "Excerpt" entry (file "~/Dropbox/notes/excerpts.org") "* %u %?\n%i" :prepend t)))
|
||||
|
||||
(setq iimage-mode-image-regex-alist
|
||||
'(("\\(`?file://\\|\\[\\[\\|<\\|`\\)?\\([-+./_0-9a-zA-Z]+\\.\\(GIF\\|JP\\(?:E?G\\)\\|P\\(?:BM\\|GM\\|N[GM]\\|PM\\)\\|SVG\\|TIFF?\\|X\\(?:[BP]M\\)\\|gif\\|jp\\(?:e?g\\)\\|p\\(?:bm\\|gm\\|n[gm]\\|pm\\)\\|svg\\|tiff?\\|x\\(?:[bp]m\\)\\)\\)\\(\\]\\]\\|>\\|'\\)?" . 2)
|
||||
("<\\(http://.+\\.\\(GIF\\|JP\\(?:E?G\\)\\|P\\(?:BM\\|GM\\|N[GM]\\|PM\\)\\|SVG\\|TIFF?\\|X\\(?:[BP]M\\)\\|gif\\|jp\\(?:e?g\\)\\|p\\(?:bm\\|gm\\|n[gm]\\|pm\\)\\|svg\\|tiff?\\|x\\(?:[bp]m\\)\\)\\)>" . 1)))
|
||||
|
||||
(org-babel-do-load-languages 'org-babel-load-languages
|
||||
'((python . t)
|
||||
(ruby . t)
|
||||
(sh . t)
|
||||
(emacs-lisp . t)
|
||||
(matlab . t)
|
||||
(latex . t)))
|
||||
|
||||
;; Remove occur highlights on ESC in normal mode
|
||||
(advice-add 'evil-force-normal-state :before 'org-remove-occur-highlights)
|
||||
|
||||
;; (progn ; opml support
|
||||
;; (defun set-buffer-file-format-to-opml ()
|
||||
;; (when (string-match "\.opml$" (buffer-file-name))
|
||||
;; (setq buffer-file-format '(opml))))
|
||||
|
||||
;; (defun my--opml-encode (begin end buffer)
|
||||
;; "Export Org mode buffer to OPML."
|
||||
;; (let ((org-export-show-temporary-export-buffer nil)
|
||||
;; (name "*OPML Export Buffer*"))
|
||||
;; (org-export-to-buffer 'opml name)
|
||||
;; (erase-buffer)
|
||||
;; (insert-buffer-substring (get-buffer name))
|
||||
;; (point-max)))
|
||||
|
||||
;; (add-hook 'find-file-hooks 'set-buffer-file-format-to-opml)
|
||||
;; (add-to-list 'format-alist '(opml "Outline Processor Markup Language"
|
||||
;; "<[?]xml version=\"1.0\"[^>]*[?]>[\n]?.*[\n]?.*[\n]?<opml version=\"[1|2].0\">"
|
||||
;; "~/.emacs.d/elisp/org-opml/opml2org.py" my--opml-encode t))
|
||||
;; (shut-up (load-library "ox-opml")))
|
||||
|
||||
(progn ; key bindings
|
||||
;; Hide properties PERMANENTLY
|
||||
(defun org-cycle-hide-drawers (state)
|
||||
"Re-hide all drawers after a visibility state change."
|
||||
(when (and (derived-mode-p 'org-mode)
|
||||
(not (memq state '(overview folded contents))))
|
||||
(save-excursion
|
||||
(let* ((globalp (memq state '(contents all)))
|
||||
(beg (if globalp (point-min) (point)))
|
||||
(end (if globalp (point-max)
|
||||
(if (eq state 'children)
|
||||
(save-excursion (outline-next-heading) (point))
|
||||
(org-end-of-subtree t)))))
|
||||
(goto-char beg)
|
||||
(while (re-search-forward org-drawer-regexp end t)
|
||||
(save-excursion
|
||||
(beginning-of-line 1)
|
||||
(backward-char 1)
|
||||
(let ((b (point)))
|
||||
(if (re-search-forward
|
||||
"^[ \t]*:END:"
|
||||
(save-excursion (outline-next-heading) (point)) t)
|
||||
(outline-flag-region b (point-at-eol) t)
|
||||
(user-error ":END: line missing at position %s" b)))))))))
|
||||
|
||||
(use-package org-agenda
|
||||
:config
|
||||
(setq org-agenda-restore-windows-after-quit t
|
||||
org-agenda-custom-commands '(("x" agenda)
|
||||
("y" agenda*)
|
||||
("w" todo "WAITING")
|
||||
("W" todo-tree "WAITING")
|
||||
("to" todo)
|
||||
("tp" tags "+Projects")
|
||||
("tg" tags-todo "+gamedev")
|
||||
("tw" tags-tree "+webdev"))))
|
||||
|
||||
(bind :map org-mode-map
|
||||
"RET" nil
|
||||
"C-j" nil
|
||||
"C-k" nil
|
||||
|
||||
insert [remap narf:inflate-space-maybe] 'self-insert-command
|
||||
|
||||
normal insert
|
||||
:map evil-org-mode-map
|
||||
"A-l" 'org-metaright ; M-j
|
||||
"A-h" 'org-metaleft ; M-h
|
||||
"A-k" 'org-metaup ; M-k
|
||||
"A-j" 'org-metadown ; M-j
|
||||
"A-l" 'org-shiftmetaright ; M-L
|
||||
"A-h" 'org-shiftmetaleft ; M-H
|
||||
"A-k" 'org-shiftmetaup ; M-K
|
||||
"A-j" 'org-shiftmetadown ; M-J
|
||||
|
||||
"<M-left>" 'org-beginning-of-line
|
||||
"<M-right>" 'org-end-of-line
|
||||
"<M-up>" 'org-up-element
|
||||
"<M-down>" 'org-down-element
|
||||
|
||||
",;" 'helm-org-in-buffer-headings
|
||||
"M-a" 'mark-whole-buffer
|
||||
", l" 'org-insert-link
|
||||
|
||||
insert
|
||||
"C-e" 'org-end-of-line
|
||||
"C-a" 'org-beginning-of-line
|
||||
;; Add new header line before this line
|
||||
"<S-M-return>" 'narf/org-insert-item-before
|
||||
;; Add new header line after this line
|
||||
"<M-return>" 'narf/org-insert-item-after
|
||||
|
||||
"M-b" (λ (narf/org-surround "*")) ; bold
|
||||
"M-u" (λ (narf/org-surround "_")) ; underline
|
||||
"M-i" (λ (narf/org-surround "/")) ; italics
|
||||
"M-`" (λ (narf/org-surround "+")) ; strikethrough
|
||||
|
||||
visual
|
||||
"M-b" "S*"
|
||||
"M-u" "S_"
|
||||
"M-i" "S/"
|
||||
"M-`" "S+"
|
||||
|
||||
normal
|
||||
",=" 'org-align-all-tags
|
||||
",/" 'org-sparse-tree
|
||||
",?" 'org-tags-view
|
||||
",a" 'org-attach
|
||||
",D" 'org-time-stamp-inactive
|
||||
",T" 'org-show-todo-tree
|
||||
",d" 'org-time-stamp
|
||||
",r" 'org-refile
|
||||
",s" 'org-schedule
|
||||
",t" 'org-todo
|
||||
"gr" 'org-babel-execute-src-block-maybe
|
||||
"gh" 'outline-up-heading
|
||||
"gj" 'org-forward-heading-same-level
|
||||
"gk" 'org-backward-heading-same-level
|
||||
"gl" 'outline-next-visible-heading
|
||||
"go" 'org-open-at-point
|
||||
"gO" 'org-attach-open
|
||||
"gC-o" 'org-attach-reveal
|
||||
"gI" (λ (if (> (length org-inline-image-overlays) 0)
|
||||
(org-remove-inline-images)
|
||||
(org-display-inline-images nil t (line-beginning-position) (line-end-position))))
|
||||
"gQ" 'org-fill-paragraph
|
||||
"ga" 'org-attach
|
||||
"gA" 'org-agenda
|
||||
"gt" 'org-show-todo-tree
|
||||
"]l" 'org-next-link
|
||||
"[l" 'org-previous-link
|
||||
"$" 'org-end-of-line
|
||||
"^" 'org-beginning-of-line
|
||||
"<" 'org-metaleft
|
||||
">" 'org-metaright
|
||||
"-" 'org-cycle-list-bullet
|
||||
",SPC" 'narf/org-toggle-checkbox
|
||||
",<return>" 'org-archive-subtree
|
||||
"<S-M-return>" 'narf/org-insert-item-before
|
||||
"<M-return>" 'narf/org-insert-item-after
|
||||
"RET" (λ (cond ((org-at-item-checkbox-p)
|
||||
(org-toggle-checkbox))
|
||||
((org-entry-is-todo-p)
|
||||
(org-todo 'done))))
|
||||
[tab] 'org-cycle)
|
||||
|
||||
(after "org-agenda"
|
||||
(bind emacs :map org-agenda-mode-map
|
||||
"<escape>" 'org-agenda-Quit
|
||||
"C-j" 'org-agenda-next-item
|
||||
"C-k" 'org-agenda-previous-item
|
||||
"C-n" 'org-agenda-next-item
|
||||
"C-p" 'org-agenda-previous-item)))))
|
||||
|
||||
|
||||
(provide 'init-org)
|
||||
;;; init-org.el ends here
|
|
@ -1,21 +0,0 @@
|
|||
(use-package php-mode
|
||||
:mode "\\.\\(php\\|inc\\)$"
|
||||
:config
|
||||
(progn
|
||||
(setq php-template-compatibility nil)
|
||||
(add-hook 'php-mode-hook 'turn-on-eldoc-mode)
|
||||
|
||||
(use-package php-extras
|
||||
:config
|
||||
(narf/add-company-backend php-mode (php-extras-company)))
|
||||
|
||||
;; TODO Tie into emr
|
||||
(use-package php-refactor-mode
|
||||
:config
|
||||
(progn
|
||||
(add-hook 'php-mode-hook 'emr-initialize)
|
||||
(add-hook 'php-mode-hook 'php-refactor-mode)))))
|
||||
|
||||
|
||||
(provide 'init-php)
|
||||
;;; init-php.el ends here
|
|
@ -1,86 +0,0 @@
|
|||
;; Project nav+search tools (projectile, helm, ag)
|
||||
(use-package neotree
|
||||
:functions (neo-buffer--unlock-width neo-buffer--lock-width
|
||||
projectile-current-project-dirs projectile-file-cached-p
|
||||
projectile-purge-file-from-cache neo-buffer--insert-with-face
|
||||
neo-global--get-buffer)
|
||||
:commands (neotree-show
|
||||
neotree-hide
|
||||
neotree-toggle
|
||||
neo-global--window-exists-p
|
||||
neotree-dir
|
||||
neotree-find)
|
||||
:init
|
||||
(progn
|
||||
(defun narf:neotree-open (&optional dir)
|
||||
(interactive)
|
||||
(neotree-dir (or dir (narf/project-root))))
|
||||
|
||||
(defun narf:neotree-toggle ()
|
||||
(interactive)
|
||||
(if (neo-global--window-exists-p)
|
||||
(neotree-hide)
|
||||
(narf:neotree-open)))
|
||||
|
||||
(defun narf:neotree-find ()
|
||||
(interactive)
|
||||
(save-excursion (narf:neotree-open))
|
||||
(neotree-find))
|
||||
|
||||
(add-hook 'neotree-mode-hook 'narf|init-neotree-keymap))
|
||||
:config
|
||||
(progn
|
||||
(setq neo-create-file-auto-open t
|
||||
neo-mode-line-type 'none
|
||||
neo-persist-show t
|
||||
neo-window-width 22
|
||||
neo-show-updir-line nil
|
||||
neo-auto-indent-point t
|
||||
neo-banner-message nil
|
||||
;; requires <https://github.com/jeffplang/emacs-neotree> fork of
|
||||
;; neotree (at least, until the PR is accepted). Causes neotree to
|
||||
;; open in a vertical split that consumes the entire height of the
|
||||
;; frame.
|
||||
neo-modern-sidebar t)
|
||||
|
||||
;; Redefinition for custom ascii theme
|
||||
(defun narf/neo-buffer-fold-symbol (name)
|
||||
(let ((n-insert-symbol (lambda (n)
|
||||
(neo-buffer--insert-with-face
|
||||
n 'neo-expand-btn-face))))
|
||||
(or (and (equal name 'open) (funcall n-insert-symbol "- "))
|
||||
(and (equal name 'close) (funcall n-insert-symbol "> "))
|
||||
(and (equal name 'leaf) (funcall n-insert-symbol " ")))))
|
||||
(advice-add 'neo-buffer--insert-fold-symbol :override 'narf/neo-buffer-fold-symbol)
|
||||
|
||||
;; Close neotree on window changes, to prevent ensuing mindbuggery
|
||||
(add-hook! 'window-configuration-change-hook
|
||||
(unless (and (neo-global--window-exists-p)
|
||||
(eq (current-buffer) (neo-global--get-buffer)))
|
||||
(neotree-hide)))
|
||||
|
||||
(after "projectile"
|
||||
(setq projectile-switch-project-action 'neotree-projectile-action))
|
||||
(add-to-list 'evil-motion-state-modes 'neotree-mode)
|
||||
(defun narf|init-neotree-keymap ()
|
||||
(bind :map evil-motion-state-local-map
|
||||
"ESC" 'neotree-hide
|
||||
"\\\\" '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-))))
|
||||
|
||||
|
||||
(provide 'init-project)
|
||||
;;; init-project.el ends here
|
|
@ -1,80 +0,0 @@
|
|||
(use-package python
|
||||
:mode ("\\.py\\'" . python-mode)
|
||||
:interpreter ("python" . python-mode)
|
||||
:commands (python-mode)
|
||||
:init
|
||||
(add-to-hook 'python-mode-hook '(narf|enable-tab-width-4 emr-initialize))
|
||||
:config
|
||||
(progn
|
||||
(setq-default python-indent-offset 4)
|
||||
(setq python-environment-directory TMP-DIR)
|
||||
(setq python-shell-interpreter "ipython")
|
||||
;; interferes with smartparens
|
||||
(define-key python-mode-map (kbd "DEL") nil)
|
||||
|
||||
(use-package anaconda-mode
|
||||
:defines (anaconda-mode-map anaconda-nav-mode-map)
|
||||
:functions (anaconda-mode-running-p)
|
||||
:init (add-to-hook 'python-mode-hook '(anaconda-mode eldoc-mode))
|
||||
:config
|
||||
(progn
|
||||
(bind :motion :map anaconda-mode-map "gd" 'anaconda-mode-goto-definitions)
|
||||
(bind :normal :map anaconda-nav-mode-map [escape] 'anaconda-nav-quit)
|
||||
|
||||
;; Delete the window on escape or C-g
|
||||
(defadvice anaconda-mode-doc-buffer (after anaconda-doc-buffer-escape-to-close activate)
|
||||
(with-current-buffer (get-buffer "*anaconda-doc*")
|
||||
(local-set-key [escape] 'anaconda-nav-quit)
|
||||
(local-set-key [?\C-g] 'anaconda-nav-quit)))
|
||||
|
||||
(after "emr"
|
||||
(emr-declare-command 'anaconda-mode-view-doc
|
||||
:title "view documentation"
|
||||
:modes 'python-mode
|
||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
(emr-declare-command 'anaconda-mode-goto-assignments
|
||||
:title "go to assignments"
|
||||
:modes 'python-mode
|
||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
|
||||
(emr-declare-command 'anaconda-mode-goto-definitions
|
||||
:title "go to definition"
|
||||
:modes 'python-mode
|
||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
|
||||
(emr-declare-command 'anaconda-mode-usages
|
||||
:title "show usages"
|
||||
:modes 'python-mode
|
||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment))))))
|
||||
|
||||
(after "company"
|
||||
(use-package company-anaconda
|
||||
:config
|
||||
(narf/add-company-backend python-mode (company-anaconda))))))
|
||||
|
||||
(use-package nose
|
||||
:commands nose-mode
|
||||
:preface (defvar nose-mode-map (make-sparse-keymap))
|
||||
:init (associate-minor-mode "/test_.+\\.py\\'" 'nose-mode)
|
||||
:config
|
||||
(bind normal :map nose-mode-map
|
||||
:prefix leader
|
||||
"tr" 'nosetests-again
|
||||
"ta" 'nosetests-all
|
||||
"ts" 'nosetests-one
|
||||
"tv" 'nosetests-module
|
||||
"tA" 'nosetests-pdb-all
|
||||
"tO" 'nosetests-pdb-one
|
||||
"tV" 'nosetests-pdb-module))))
|
||||
|
||||
|
||||
(provide 'init-python)
|
||||
;;; init-python.el ends here
|
|
@ -1,10 +0,0 @@
|
|||
(use-package ess-site
|
||||
:config
|
||||
(progn
|
||||
(setq ess-indent-level 4)
|
||||
(setq ess-arg-function-offset 4)
|
||||
(setq ess-else-offset 4)
|
||||
))
|
||||
|
||||
(provide 'init-r)
|
||||
;;; init-r.el ends here
|
|
@ -1,56 +0,0 @@
|
|||
(use-package re-builder
|
||||
:commands (re-builder reb-mode-buffer-p)
|
||||
:config
|
||||
(progn
|
||||
(bind :normal :map reb-mode-map
|
||||
"C-g" 'reb-quit
|
||||
[escape] 'reb-quit
|
||||
[backtab] 'reb-change-syntax)
|
||||
|
||||
(defun narf|reb-cleanup ()
|
||||
(replace-regexp "^[ \n]*" "" nil (point-min) (point-max))
|
||||
(text-scale-set 1.5)
|
||||
(goto-char 2))
|
||||
(add-hook 'reb-mode-hook 'narf|reb-cleanup)
|
||||
|
||||
(use-package pcre2el
|
||||
:functions (rxt--re-builder-switch-pcre-mode)
|
||||
:config
|
||||
(progn
|
||||
(bind :normal :map rxt-help-mode-map [escape] 'kill-buffer-and-window)
|
||||
(setq reb-re-syntax 'pcre)))
|
||||
|
||||
(after "evil"
|
||||
(evil-set-initial-state 'reb-mode 'insert)
|
||||
;; Either a) converts selected (or entered-in) pcre regex into elisp
|
||||
;; regex, OR b) opens up re-builder.
|
||||
(evil-define-operator narf::regex (beg end type &optional regexstr bang)
|
||||
:move-point nil
|
||||
:type inclusive
|
||||
:repeat nil
|
||||
(interactive "<R><a><!>")
|
||||
(if (reb-mode-buffer-p)
|
||||
(if regexstr
|
||||
(let ((regexstr (s-trim (buffer-string))))
|
||||
(if bang
|
||||
(rxt-explain-pcre regexstr)
|
||||
(rxt-pcre-to-elisp (s-trim (buffer-string)))))
|
||||
(erase-buffer)
|
||||
(insert (concat "/" regexstr "/")))
|
||||
(cond ((and beg end (/= beg (1- end))) ; Convert selection from pcre regex to elisp
|
||||
(let ((regexstr (buffer-substring-no-properties beg end)))
|
||||
(if bang
|
||||
(rxt-explain-pcre (concat "/" regexstr "/"))
|
||||
(delete-region beg end)
|
||||
(insert (rxt-pcre-to-elisp regexstr)))))
|
||||
(regexstr ; Convert input regex into elisp regex
|
||||
(let ((newregex (rxt-pcre-to-elisp regexstr)))
|
||||
(when bang
|
||||
(setq newregex (s-replace "\\" "\\\\" newregex)))
|
||||
(kill-new newregex)
|
||||
(message "Copied regex to kill ring: %s" newregex)))
|
||||
(t (re-builder))))))))
|
||||
|
||||
|
||||
(provide 'init-regex)
|
||||
;;; init-regex.el ends here
|
|
@ -1,134 +0,0 @@
|
|||
(use-package enh-ruby-mode
|
||||
:mode (("\\.rb$" . enh-ruby-mode)
|
||||
("\\.ru$" . enh-ruby-mode)
|
||||
("\\.rake$" . enh-ruby-mode)
|
||||
("\\.gemspec$" . enh-ruby-mode)
|
||||
("\\.?pryrc$" . enh-ruby-mode)
|
||||
("/Gemfile$" . enh-ruby-mode)
|
||||
("/Capfile$" . enh-ruby-mode)
|
||||
("/Vagrantfile$" . enh-ruby-mode)
|
||||
("/Rakefile$" . enh-ruby-mode))
|
||||
:interpreter "ruby"
|
||||
:init
|
||||
(progn
|
||||
(add-hook 'enh-ruby-mode-hook 'narf|enable-tab-width-2)
|
||||
(add-hook! 'enh-ruby-mode-hook (set-build-command "rake %s" "Rakefile")))
|
||||
:config
|
||||
(progn
|
||||
;;; Formatting
|
||||
(setq ruby-indent-level 2
|
||||
ruby-deep-indent-paren t
|
||||
enh-ruby-check-syntax nil)
|
||||
|
||||
(associate-mode "/\\.rspec$" 'text-mode)
|
||||
|
||||
;; Don't interfere with my custom RET behavior
|
||||
(define-key enh-ruby-mode-map [?\n] nil)
|
||||
|
||||
(use-package ruby-refactor
|
||||
:init
|
||||
(add-hook 'enh-ruby-mode-hook 'emr-initialize)
|
||||
:config
|
||||
(after "emr"
|
||||
(emr-declare-command 'ruby-refactor-extract-to-method
|
||||
:title "extract method"
|
||||
:modes 'enh-ruby-mode
|
||||
:predicate (lambda () (use-region-p)))
|
||||
(emr-declare-command 'ruby-refactor-extract-local-variable
|
||||
:title "extract local variable"
|
||||
:modes 'enh-ruby-mode
|
||||
:predicate (lambda () (use-region-p)))
|
||||
(emr-declare-command 'ruby-refactor-extract-constant
|
||||
:title "extract constant"
|
||||
:modes 'enh-ruby-mode
|
||||
:predicate (lambda () (use-region-p)))
|
||||
(emr-declare-command 'ruby-refactor-add-parameter
|
||||
:title "add parameter"
|
||||
:modes 'enh-ruby-mode)
|
||||
(emr-declare-command 'ruby-refactor-extract-to-let
|
||||
:title "extract to let"
|
||||
:modes 'enh-ruby-mode
|
||||
:predicate (lambda () (use-region-p)))))
|
||||
|
||||
|
||||
;; Rakefiles ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(define-minor-mode rake-mode
|
||||
"Buffer local minor mode for rake files"
|
||||
:lighter " Rake" :keymap (make-sparse-keymap)
|
||||
(narf/init-yas-mode 'rake-mode))
|
||||
(associate-minor-mode "/\\(Rakefile\\|\\.rake\\)$" 'rake-mode)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Vagrantfiles ;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(define-minor-mode vagrant-mode
|
||||
"Buffer local minor mode for vagrant files"
|
||||
:lighter " Va" :keymap (make-sparse-keymap)
|
||||
(narf/yas-init-mode 'vagrant-mode))
|
||||
(associate-minor-mode "/Vagrantfile$" 'vagrant-mode)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Rspec files ;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(use-package rspec-mode
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(associate-minor-mode "\\(/spec_helper\\|_spec\\)\\.rb$" 'rspec-mode)
|
||||
(associate-minor-mode "/\\.rspec$" 'rspec-mode)
|
||||
|
||||
(defvar rspec-mode-verifiable-map (make-sparse-keymap))
|
||||
(defvar evilmi-ruby-match-tags
|
||||
'((("unless" "if") ("elsif" "else") "end")
|
||||
("begin" ("rescue" "ensure") "end")
|
||||
("case" ("when" "else") "end")
|
||||
(("class" "def" "while" "do" "module" "for" "until") () "end")
|
||||
;; Rake
|
||||
(("task" "namespace") () "end"))))
|
||||
:config
|
||||
(bind :normal
|
||||
",tr" 'rspec-rerun
|
||||
",ta" 'rspec-verify-all
|
||||
",ts" 'rspec-verify-single
|
||||
",tv" 'rspec-verify))
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-package inf-ruby
|
||||
:commands (inf-ruby inf-ruby-console-auto)
|
||||
:config
|
||||
(progn
|
||||
(evil-set-initial-state 'inf-enh-ruby-mode 'insert)
|
||||
(after "company"
|
||||
(use-package company-inf-ruby
|
||||
:config (narf/add-company-backend inf-enh-ruby-mode (company-inf-ruby))))))
|
||||
|
||||
(use-package robe
|
||||
:functions (robe-mode robe-start ruby-load-file)
|
||||
:config
|
||||
(progn
|
||||
(after "company"
|
||||
(use-package company-robe
|
||||
:config (narf/add-company-backend enh-ruby-mode (company-robe))))
|
||||
|
||||
(defun narf|enable-robe-maybe ()
|
||||
(let ((file (buffer-file-name)))
|
||||
;; Don't run in gemfiles, capfiles or vagrantfiles
|
||||
(unless (or (string-equal (f-filename file) "Gemfile")
|
||||
(string-equal (f-filename file) "Capfile")
|
||||
(string-equal (f-filename file) "Vagrantfile")
|
||||
(f-ext? file "org")) ;; or org-mode
|
||||
(robe-mode 1)
|
||||
(narf|ruby-load-file file))))
|
||||
(add-hook 'enh-ruby-mode-hook 'narf|enable-robe-maybe)
|
||||
|
||||
(defun narf|ruby-load-file (&optional file)
|
||||
(let ((file (or file buffer-file-name)))
|
||||
(when (and (eq major-mode 'enh-ruby-mode)
|
||||
(featurep 'robe)
|
||||
(not (string= (f-base file) "Gemfile"))
|
||||
(file-exists-p buffer-file-name))
|
||||
(unless robe-running (robe-start 1))
|
||||
(when robe-running (ruby-load-file file)))))
|
||||
(add-hook 'after-save-hook 'narf|ruby-load-file)))))
|
||||
|
||||
|
||||
(provide 'init-ruby)
|
||||
;;; init-ruby.el ends here
|
|
@ -1,13 +0,0 @@
|
|||
(use-package rust-mode
|
||||
:mode "\\.rs$"
|
||||
:config
|
||||
;; (after "company"
|
||||
;; (let ((racer-dir (concat my-contrib-dir "racer/")))
|
||||
;; (setq racer-rust-src-path (concat racer-dir "src"))
|
||||
;; (setq racer-cmd (concat racer-dir "bin/racer"))
|
||||
;; (add-to-list 'load-path (concat racer-dir "editors/"))
|
||||
;; (require 'racer)))
|
||||
)
|
||||
|
||||
(provide 'init-rust)
|
||||
;;; init-rust.el ends here
|
|
@ -1,33 +0,0 @@
|
|||
(use-package sass-mode
|
||||
:mode "\\.sass$"
|
||||
:init
|
||||
(add-hook 'sass-mode-hook 'narf|enable-tab-width-2)
|
||||
:config
|
||||
(progn
|
||||
(after "company" (narf/add-company-backend sass-mode (company-css)))))
|
||||
|
||||
(use-package scss-mode
|
||||
:mode "\\.scss$"
|
||||
:init
|
||||
(add-hook 'scss-mode-hook 'narf|enable-tab-width-2)
|
||||
:config
|
||||
(progn
|
||||
(setq-default css-indent-offset 2)
|
||||
(setq scss-compile-at-save nil)
|
||||
|
||||
;; Syntax coloring breaks on consecutive loads for some reason. This fixes that:
|
||||
(add-hook 'scss-mode-hook 'css-mode)
|
||||
|
||||
(after "web-beautify"
|
||||
(add-hook! 'scss-mode-hook (setenv "jsbeautify_indent_size" "2"))
|
||||
(bind :motion :map scss-mode-map "gQ" 'web-beautify-css))
|
||||
|
||||
(after "company" (narf/add-company-backend scss-mode (company-css)))))
|
||||
|
||||
(use-package rainbow-mode
|
||||
:defer t
|
||||
:init (add-hook 'scss-mode-hook 'rainbow-mode))
|
||||
|
||||
|
||||
(provide 'init-scss)
|
||||
;;; init-scss.el ends here
|
|
@ -1,19 +0,0 @@
|
|||
(narf/add-throwaway-buffer "^\\*Shell Command Output\\*$")
|
||||
(narf/add-throwaway-buffer "^\\*Async Shell Command\\*$")
|
||||
|
||||
;; Make shell scrips executable on save?
|
||||
;; (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
|
||||
|
||||
;; Color in *Shell Command Output*
|
||||
(require 'ansi-color)
|
||||
(defadvice display-message-or-buffer (before ansi-color activate)
|
||||
"Process ANSI color codes in shell output."
|
||||
(let ((buf (ad-get-arg 0)))
|
||||
(and (bufferp buf)
|
||||
(string= (buffer-name buf) "*Shell Command Output*")
|
||||
(with-current-buffer buf
|
||||
(ansi-color-apply-on-region (point-min) (point-max))))))
|
||||
|
||||
|
||||
(provide 'init-sh)
|
||||
;;; init-sh.el ends here
|
|
@ -1,11 +0,0 @@
|
|||
(use-package swift-mode
|
||||
:mode "\\.swift$"
|
||||
:config
|
||||
(progn
|
||||
(after "flycheck" (add-to-list 'flycheck-cehckers 'swift))
|
||||
(after "company" (narf/add-company-backend swift-mode (company-xcode)))))
|
||||
|
||||
;; TODO Set up emacs task runners for fruitstrap
|
||||
|
||||
(provide 'init-swift)
|
||||
;;; init-swift.el ends here
|
|
@ -1,56 +0,0 @@
|
|||
(add-hook 'text-mode-hook 'narf|enable-hard-wrap)
|
||||
(add-hook 'prog-mode-hook 'narf|enable-comment-hard-wrap)
|
||||
|
||||
(use-package markdown-mode
|
||||
:mode (("\\.md$" . markdown-mode)
|
||||
("/README$" . markdown-mode))
|
||||
:functions (markdown-use-region-p markdown-unwrap-things-in-region
|
||||
markdown-wrap-or-insert markdown-unwrap-thing-at-point)
|
||||
:init
|
||||
;; Implement strike-through formatting
|
||||
(defvar markdown-regex-del "\\(^\\|[^\\]\\)\\(\\(~\\{2\\}\\)\\([^ \n \\]\\|[^ \n ]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(\\3\\)\\)")
|
||||
:config
|
||||
(progn
|
||||
(defun markdown-insert-del ()
|
||||
(interactive)
|
||||
(let ((delim "~~"))
|
||||
(if (markdown-use-region-p)
|
||||
;; Active region
|
||||
(let ((bounds (markdown-unwrap-things-in-region
|
||||
(region-beginning) (region-end)
|
||||
markdown-regex-del 2 4)))
|
||||
(markdown-wrap-or-insert delim delim nil (car bounds) (cdr bounds)))
|
||||
;; Bold markup removal, bold word at point, or empty markup insertion
|
||||
(if (thing-at-point-looking-at markdown-regex-del)
|
||||
(markdown-unwrap-thing-at-point nil 2 4)
|
||||
(markdown-wrap-or-insert delim delim 'word nil nil)))))
|
||||
|
||||
(sp-local-pair 'markdown-mode "*" "*"
|
||||
:unless '(sp-point-after-bol-p sp-point-before-same-p sp-point-after-same-p))
|
||||
|
||||
(bind :map markdown-mode-map
|
||||
"<backspace>" nil
|
||||
"<M-left>" nil
|
||||
"<M-right>" nil
|
||||
|
||||
"M-*" 'markdown-insert-list-item
|
||||
"M-b" 'markdown-insert-bold
|
||||
"M-i" 'markdown-insert-italic
|
||||
"M-`" 'markdown-insert-del
|
||||
|
||||
:normal :visual
|
||||
",i" 'markdown-insert-image
|
||||
",l" 'markdown-insert-link
|
||||
",L" 'markdown-insert-reference-link-dwim
|
||||
",b" 'markdown-preview
|
||||
|
||||
:normal
|
||||
"[p" 'markdown-promote
|
||||
"]p" 'markdown-demote
|
||||
|
||||
:insert
|
||||
"M--" 'markdown-insert-hr)))
|
||||
|
||||
|
||||
(provide 'init-text)
|
||||
;;; init-text.el ends here
|
|
@ -1,33 +0,0 @@
|
|||
(use-package git-commit-mode ;
|
||||
:mode (("/COMMIT_EDITMSG\\'" . git-commit-mode)
|
||||
("/NOTES_EDITMSG\\'" . git-commit-mode)
|
||||
("/MERGE_MSG\\'" . git-commit-mode)
|
||||
("/TAG_EDITMSG\\'" . git-commit-mode)
|
||||
("/PULLREQ_EDITMSG\\'" . git-commit-mode))
|
||||
:config
|
||||
(evil-set-initial-state 'git-commit-mode 'insert))
|
||||
|
||||
(use-package git-rebase-mode
|
||||
:mode ("/git-rebase-todo\\'" . git-rebase-mode)
|
||||
:config
|
||||
(evil-set-initial-state 'git-rebase-mode 'insert))
|
||||
|
||||
(use-package gitconfig-mode
|
||||
:mode (("/\\.?git/?config\\'" . gitconfig-mode)
|
||||
("/\\.gitmodules\\'" . gitconfig-mode))
|
||||
:init (add-hook 'gitconfig-mode-hook 'flyspell-mode))
|
||||
|
||||
(use-package gitignore-mode
|
||||
:mode (("/\\.gitignore\\'" . gitignore-mode)
|
||||
("/\\.git/info/exclude\\'" . gitignore-mode)
|
||||
("/git/ignore\\'" . gitignore-mode)))
|
||||
|
||||
(use-package diff-hl
|
||||
:config
|
||||
(progn
|
||||
(setq diff-hl-draw-borders nil)
|
||||
(global-diff-hl-mode +1)))
|
||||
|
||||
|
||||
(provide 'init-vc)
|
||||
;;; init-vc.el ends here
|
|
@ -1,7 +0,0 @@
|
|||
(use-package vimrc-mode
|
||||
:mode (("/\\.?g?vimrc$" . vimrc-mode)
|
||||
("\\.vim$" . vimrc-mode)))
|
||||
|
||||
|
||||
(provide 'init-vim)
|
||||
;;; init-vim.el ends here
|
|
@ -1,89 +0,0 @@
|
|||
(use-package web-beautify
|
||||
:commands (web-beautify-js web-beautify-css web-beautify-html)
|
||||
:init
|
||||
(after "css-mode"
|
||||
(add-hook! 'css-mode-hook (setenv "jsbeautify_indent_size" "2"))
|
||||
(bind :motion :map css-mode-map "gQ" 'web-beautify-css)))
|
||||
|
||||
(use-package web-mode
|
||||
:mode (("\\.\\(p\\)?htm\\(l\\)?$" . web-mode)
|
||||
("\\.tpl\\(\\.php\\)?$" . web-mode)
|
||||
("\\.erb$" . web-mode)
|
||||
("wp-content/themes/.+/.+\\.php$" . web-mode))
|
||||
:init
|
||||
(add-hook 'web-mode-hook 'narf|enable-tab-width-2)
|
||||
:config
|
||||
(progn
|
||||
(setq web-mode-markup-indent-offset 2
|
||||
web-mode-code-indent-offset 2
|
||||
web-mode-css-indent-offset 2
|
||||
web-mode-style-padding 2
|
||||
web-mode-script-padding 2
|
||||
web-mode-block-padding 2)
|
||||
|
||||
(after "smartparens"
|
||||
(add-hook! 'web-mode-hook (setq web-mode-enable-auto-pairing nil))
|
||||
|
||||
(defun sp-web-mode-is-code-context (id action context)
|
||||
(when (and (eq action 'insert)
|
||||
(not (or (get-text-property (point) 'part-side)
|
||||
(get-text-property (point) 'block-side))))
|
||||
t))
|
||||
(sp-local-pair 'web-mode "<" nil :when '(sp-web-mode-is-code-context)))
|
||||
|
||||
(after "web-beautify"
|
||||
(add-hook! 'web-mode-hook (setenv "jsbeautify_indent_size" "4"))
|
||||
(bind :motion :map web-mode-map "gQ" 'web-beautify-html))
|
||||
|
||||
(bind :map web-mode-map
|
||||
"M-/" 'web-mode-comment-or-uncomment
|
||||
|
||||
:normal
|
||||
"zf" 'web-mode-fold-or-unfold
|
||||
",t" 'web-mode-element-rename
|
||||
|
||||
:normal :visual
|
||||
"]a" 'web-mode-attribute-next
|
||||
"[a" 'web-mode-attribute-previous
|
||||
"]t" 'web-mode-tag-next
|
||||
"[t" 'web-mode-tag-previous
|
||||
"]T" 'web-mode-element-child
|
||||
"[T" 'web-mode-element-parent)))
|
||||
|
||||
(use-package emmet-mode
|
||||
:defer t
|
||||
:init
|
||||
(add-to-hooks 'emmet-mode '(scss-mode-hook web-mode-hook html-mode-hook haml-mode-hook nxml-mode-hook))
|
||||
:config
|
||||
(progn
|
||||
(setq emmet-move-cursor-between-quotes t)
|
||||
(bind insert :map emmet-mode-keymap
|
||||
"M-e" 'emmet-expand-yas
|
||||
"M-E" 'emmet-expand-line)))
|
||||
|
||||
(define-minor-mode jekyll-mode
|
||||
"Jekyll development mode."
|
||||
:init-value nil
|
||||
:lighter " :{"
|
||||
:keymap (make-sparse-keymap)
|
||||
(narf/init-yas-mode 'jekyll-mode))
|
||||
(defun narf|jekyll-mode-enable-maybe ()
|
||||
(when (narf/project-has-files '("_config.yml" "_layouts"))
|
||||
(jekyll-mode 1)))
|
||||
(associate-minor-mode "/_\\(layouts\\|posts\\)/.+$" 'jekyll-mode)
|
||||
(add-to-hooks 'narf|jekyll-mode-enable-maybe '(web-mode-hook scss-mode-hook html-mode-hook markdown-mode markdown-mode-hook))
|
||||
(after "company" (add-to-list 'company-dictionary-major-minor-modes 'jekyll-mode))
|
||||
|
||||
(define-minor-mode wordpress-mode
|
||||
"Wordpress development mode."
|
||||
:init-value nil
|
||||
:lighter " wp"
|
||||
:keymap (make-sparse-keymap)
|
||||
(narf/init-yas-mode 'wordpress-mode))
|
||||
(associate-minor-mode "/wp-\\(content\\|admin\\|includes\\)/.+$" 'wordpress-mode)
|
||||
(associate-minor-mode "/wp-.+\\.php$" 'wordpress-mode)
|
||||
(after "company" (add-to-list 'company-dictionary-major-minor-modes 'wordpress-mode))
|
||||
|
||||
|
||||
(provide 'init-web)
|
||||
;;; init-web.el ends here
|
|
@ -1,41 +0,0 @@
|
|||
(use-package workgroups2
|
||||
:init
|
||||
(setq wg-session-file (expand-file-name "wg-default" TMP-DIR)
|
||||
wg-workgroup-directory (expand-file-name "workgroups" TMP-DIR)
|
||||
wg-first-wg-name "main"
|
||||
wg-session-load-on-start t
|
||||
wg-mode-line-display-on nil
|
||||
;; What to do on Emacs exit / workgroups-mode exit?
|
||||
wg-emacs-exit-save-behavior 'save ; Options: 'save 'ask nil
|
||||
wg-workgroups-mode-exit-save-behavior 'save)
|
||||
:config
|
||||
(progn
|
||||
(after "helm"
|
||||
(defun narf/helm-switch-to-workgroup (name)
|
||||
(wg-switch-to-workgroup (wg-get-workgroup name)))
|
||||
(defvar narf/helm-source-wg
|
||||
'((name . "Workgroups")
|
||||
(candidates . wg-workgroup-names)
|
||||
(action . narf/helm-switch-to-workgroup)))
|
||||
(defun narf:helm-wg ()
|
||||
(interactive)
|
||||
(helm :sources '(helm-source-wg))))
|
||||
|
||||
;; Turns projectile switch-project interface (or helm's interface to it)
|
||||
;; create a new workgroup for the new project.
|
||||
(after "projectile"
|
||||
(defun narf/wg-projectile-switch-project ()
|
||||
(let ((workgroup-name (file-name-nondirectory (directory-file-name (narf/project-root)))))
|
||||
(wg-create-workgroup workgroup-name t)
|
||||
(helm-projectile-find-file)))
|
||||
(setq projectile-switch-project-action 'narf/wg-projectile-switch-project))
|
||||
|
||||
;; Initialize!
|
||||
(defun narf|init-workgroups ()
|
||||
(workgroups-mode +1)
|
||||
(diminish 'workgroups-mode))
|
||||
(add-hook 'after-init-hook 'narf|init-workgroups)))
|
||||
|
||||
|
||||
(provide 'init-workgroups)
|
||||
;;; init-workgroups.el ends here
|
|
@ -1,158 +0,0 @@
|
|||
(use-package yasnippet
|
||||
:diminish (yas-minor-mode . "Y")
|
||||
:commands (yas-minor-mode yas-minor-mode-on narf/init-yas-mode)
|
||||
:mode (("emacs\\.d/snippets/.+$" . snippet-mode))
|
||||
:init
|
||||
(progn
|
||||
(add-to-hooks 'yas-minor-mode-on '(prog-mode-hook
|
||||
snippet-mode-hook
|
||||
markdown-mode-hook
|
||||
org-mode-hook))
|
||||
(add-hook 'snippet-mode-hook 'disable-final-newline)
|
||||
|
||||
;; Switch to insert mode when expanding a template via backtab, or go back
|
||||
;; to normal mode if there are no fields.
|
||||
(defun narf/insert-yas-snippet ()
|
||||
(interactive)
|
||||
(yas-insert-snippet)
|
||||
(evil-insert-state +1))
|
||||
|
||||
(defvar yas-minor-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(bind insert :map map [(tab)] 'yas-expand)
|
||||
(bind visual :map map "<backtab>" 'narf/insert-yas-snippet)
|
||||
map)))
|
||||
:config
|
||||
(progn
|
||||
;; Undo global maps
|
||||
(bind insert [(tab)] nil)
|
||||
(bind visual "<backtab>" nil)
|
||||
|
||||
(after "helm" (add-to-list 'yas-dont-activate 'helm-alive-p))
|
||||
|
||||
(setq yas-verbosity 0
|
||||
yas-indent-line 'auto
|
||||
yas-also-auto-indent-first-line t
|
||||
yas-wrap-around-region nil
|
||||
;; Only load personal snippets
|
||||
yas-snippet-dirs `(,SNIPPETS-DIR)
|
||||
yas-prompt-functions '(yas-ido-prompt yas-no-prompt))
|
||||
(yas-reload-all)
|
||||
|
||||
;; Exit snippets on ESC in normal mode
|
||||
(advice-add 'evil-force-normal-state :before 'yas-exit-all-snippets)
|
||||
;; Once you're in normal mode, you're out
|
||||
(add-hook 'evil-normal-state-entry-hook 'yas-abort-snippet)
|
||||
|
||||
;; Fixes: evil's visual-line mode gobbles up the newline on the right.
|
||||
;; This prevents that by essentially doing (1- (region-end)).
|
||||
(defadvice yas-expand-snippet (around yas-expand-snippet-visual-line activate)
|
||||
(when (evil-visual-line-state-p)
|
||||
(ad-set-arg 2 (1- (ad-get-arg 2)))) ad-do-it)
|
||||
|
||||
;; Fixes: visual-line includes indentation before the selection. This
|
||||
;; strips it out.
|
||||
(add-hook! 'yas-before-expand-snippet-hook
|
||||
(when (evil-visual-line-state-p)
|
||||
(setq-local yas-selected-text
|
||||
(replace-regexp-in-string
|
||||
"\\(^ *\\|\n? $\\)" ""
|
||||
(buffer-substring-no-properties (region-beginning)
|
||||
(1- (region-end)))))))
|
||||
;; Previous hook causes yas-selected-text to persist between expansions.
|
||||
;; This little hack gets around it.
|
||||
(add-hook! 'yas-after-exit-snippet-hook (setq-local yas-selected-text nil))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Snippet helpers
|
||||
(defvaralias '% 'yas-selected-text)
|
||||
;; Shorthand defun to surround text with newlines if more than one line.
|
||||
(defun !%! ()
|
||||
(when %
|
||||
(if (> (length (s-lines %)) 1)
|
||||
(concat "\n" % "\n")
|
||||
(s-trim %))))
|
||||
;; Shorthand defun for snippets: prepends a newline to `yas-selected-text'
|
||||
;; IF it contains more than one line.
|
||||
(defun !% ()
|
||||
(when %
|
||||
(if (> (length (s-lines %)) 1)
|
||||
(concat "\n" %)
|
||||
(s-trim %))))
|
||||
;; Trim selection; do no further processing
|
||||
(defun %1 () (s-trim %))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Inter-field navigation
|
||||
(defun narf/yas-goto-start-of-field ()
|
||||
(interactive)
|
||||
(let* ((snippet (car (yas--snippets-at-point)))
|
||||
(position (yas--field-start (yas--snippet-active-field snippet))))
|
||||
(if (= (point) position)
|
||||
(move-beginning-of-line 1)
|
||||
(goto-char position))))
|
||||
(defun narf/yas-goto-end-of-field ()
|
||||
(interactive)
|
||||
(let* ((snippet (car (yas--snippets-at-point)))
|
||||
(position (yas--field-end (yas--snippet-active-field snippet))))
|
||||
(if (= (point) position)
|
||||
(move-end-of-line 1)
|
||||
(goto-char position))))
|
||||
|
||||
;; Prevents Yas from stepping on my toes when I use backspace
|
||||
(defun narf/yas-backspace (&optional field)
|
||||
(interactive)
|
||||
(let ((field (or field (and yas--active-field-overlay
|
||||
(overlay-buffer yas--active-field-overlay)
|
||||
(overlay-get yas--active-field-overlay 'yas--field)))))
|
||||
(cond ((eq (point) (marker-position (yas--field-start field))) nil)
|
||||
(t (delete-char -1)))))
|
||||
|
||||
(defun narf/yas-delete (&optional field)
|
||||
(interactive)
|
||||
(let ((field (or field (and yas--active-field-overlay
|
||||
(overlay-buffer yas--active-field-overlay)
|
||||
(overlay-get yas--active-field-overlay 'yas--field)))))
|
||||
(cond ((and field
|
||||
(not (yas--field-modified-p field))
|
||||
(eq (point) (marker-position (yas--field-start field))))
|
||||
(yas--skip-and-clear field)
|
||||
(yas-next-field 1))
|
||||
((eq (point) (marker-position (yas--field-end field))) nil)
|
||||
(t (delete-char 1)))))
|
||||
|
||||
(defun narf/yas-clear-to-sof (&optional field)
|
||||
(interactive)
|
||||
(let* ((field (or field (and yas--active-field-overlay
|
||||
(overlay-buffer yas--active-field-overlay)
|
||||
(overlay-get yas--active-field-overlay 'yas--field))))
|
||||
(sof (marker-position (yas--field-start field))))
|
||||
(when (and field (> (point) sof))
|
||||
(delete-region sof (point)))))
|
||||
|
||||
(defun narf/init-yas-mode (&rest modes)
|
||||
;; Yasnippet 0.8.1+
|
||||
(after "yasnippet"
|
||||
(when (boundp 'yas-extra-modes)
|
||||
(dolist (mode modes)
|
||||
(if (symbol-value mode)
|
||||
(yas-activate-extra-mode mode)
|
||||
(setq yas-extra-modes (delq mode yas-extra-modes)))))))
|
||||
|
||||
;; keybinds
|
||||
(bind :map yas-keymap
|
||||
"C-e" 'narf/yas-goto-end-of-field
|
||||
"C-a" 'narf/yas-goto-start-of-field
|
||||
"<M-right>" 'narf/yas-goto-end-of-field
|
||||
"<M-left>" 'narf/yas-goto-start-of-field
|
||||
"<S-tab>" 'yas-prev-field
|
||||
"<M-backspace>" 'narf/yas-clear-to-sof
|
||||
|
||||
[backspace] 'narf/yas-backspace
|
||||
"<delete>" 'narf/yas-delete)))
|
||||
|
||||
|
||||
(provide 'init-yasnippet)
|
||||
;;; init-yasnippet.el ends here
|
|
@ -1,347 +0,0 @@
|
|||
(eval-when-compile (require 'defuns))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Global keymaps ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(bind "M-x" 'smex
|
||||
"M-X" 'smex-major-mode-commands
|
||||
"M-A-x" 'helm-M-x
|
||||
"M-;" 'eval-expression
|
||||
"C-`" 'popwin:toggle-popup-window
|
||||
"M-=" 'text-scale-increase
|
||||
"M--" 'text-scale-decrease
|
||||
"M-w" 'evil-window-delete
|
||||
"M-/" 'evil-commentary-line
|
||||
"M-b" 'narf::build
|
||||
"M-t" 'helm-projectile-find-file)
|
||||
|
||||
(bind motion
|
||||
;; Faster scrolling
|
||||
"M-j" "6j"
|
||||
"M-k" "6k"
|
||||
"M-r" 'narf::eval
|
||||
|
||||
normal
|
||||
"M-o" 'narf:ido-find-file
|
||||
"M-O" 'narf:ido-find-project-file
|
||||
"<f1>" 'dash-at-point
|
||||
|
||||
"M-R" 'narf::eval-buffer)
|
||||
|
||||
;; restore text nav keys
|
||||
(bind :if IS-MAC
|
||||
"<A-left>" 'backward-word
|
||||
"<A-right>" 'forward-word
|
||||
"<M-backspace>" 'narf: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" 'clipboard-yank
|
||||
"M-q" 'evil-quit-all
|
||||
"M-z" 'undo
|
||||
"M-Z" 'redo
|
||||
"C-M-f" 'narf:toggle-fullscreen)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Local keymaps ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(bind (normal motion visual) ";" 'evil-ex)
|
||||
|
||||
(bind normal
|
||||
:prefix leader
|
||||
"," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
|
||||
"<" 'helm-buffers-list
|
||||
"." 'narf:ido-find-file
|
||||
">" 'narf:ido-find-file-other-window
|
||||
"/" 'helm-projectile-find-file
|
||||
";" 'helm-semantic-or-imenu
|
||||
|
||||
"]" 'helm-etags-select
|
||||
"a" 'helm-projectile-find-other-file
|
||||
"E" 'narf::initfiles
|
||||
"h" 'helm-apropos
|
||||
"n" 'narf::notes
|
||||
"m" 'helm-recentf
|
||||
"M" 'helm-projectile-recentf ; recent PROJECT files
|
||||
"p" 'helm-projectile-switch-project
|
||||
"r" 'emr-show-refactor-menu
|
||||
|
||||
"qq" 'evil-save-and-quit
|
||||
"QQ" (λ (let ((confirm-kill-emacs nil)) (narf::kill-buffers t) (evil-quit-all)))
|
||||
|
||||
;; insert lines in-place
|
||||
"jj" (λ (save-excursion (evil-insert-newline-below)))
|
||||
"kk" (λ (save-excursion (evil-insert-newline-above)))
|
||||
|
||||
"oo" 'narf:osx-open-with
|
||||
"ob" (λ (narf:osx-open-with "Google Chrome"))
|
||||
"of" (λ (narf:osx-open-with "Finder.app" default-directory))
|
||||
"oF" (λ (narf:osx-open-with "Finder.app" (narf/project-root)))
|
||||
"ou" (λ (narf:osx-open-with "Transmit"))
|
||||
"oU" (λ (narf:osx-open-with "Transmit" default-directory))
|
||||
"ol" (λ (narf:osx-open-with "LaunchBar"))
|
||||
"oL" (λ (narf:osx-open-with "LaunchBar" default-directory))
|
||||
"ot" (λ (narf::tmux-chdir nil t)) ; tmux: cd (default-directory)
|
||||
"oT" 'narf::tmux-chdir ; tmux: cd [project root]
|
||||
|
||||
:prefix localleader
|
||||
"\\" 'narf:neotree-toggle
|
||||
"." 'narf:neotree-find
|
||||
";" 'narf:nlinum-toggle
|
||||
"=" 'toggle-transparency
|
||||
"E" 'evil-emacs-state
|
||||
|
||||
"]" 'next-buffer
|
||||
"[" 'previous-buffer
|
||||
|
||||
"s" (λ (narf::snippets t)) ; ido snippets dir
|
||||
"g" 'diff-hl-diff-goto-hunk
|
||||
"e" (λ (call-interactively 'flycheck-buffer) (flycheck-list-errors))
|
||||
"p" 'helm-show-kill-ring
|
||||
"b" 'helm-bookmarks
|
||||
"w" 'helm-wg)
|
||||
|
||||
(bind normal
|
||||
"Y" (λ (evil-yank (point) (point-at-eol))) ; yank to eol, like D and C
|
||||
|
||||
"zr" 'narf:open-folds
|
||||
"zm" 'narf:close-folds
|
||||
|
||||
"zx" 'narf:kill-real-buffer
|
||||
"zX" 'bury-buffer
|
||||
|
||||
"]b" 'narf:next-real-buffer
|
||||
"[b" 'narf:previous-real-buffer
|
||||
"]w" 'wg-switch-to-workgroup-right
|
||||
"[w" 'wg-switch-to-workgroup-left
|
||||
|
||||
;; Increment/decrement number under cursor
|
||||
"g=" 'evil-numbers/inc-at-pt
|
||||
"g-" 'evil-numbers/dec-at-pt
|
||||
"gR" 'narf::eval-buffer
|
||||
"gc" 'evil-commentary
|
||||
"gy" 'evil-commentary-yank
|
||||
|
||||
visual
|
||||
"gR" 'narf::eval-region-and-replace
|
||||
",=" 'align-regexp
|
||||
|
||||
;; vnoremap < <gv
|
||||
"<" (λ (evil-shift-left (region-beginning) (region-end))
|
||||
(evil-normal-state)
|
||||
(evil-visual-restore))
|
||||
;; vnoremap > >gv
|
||||
">" (λ (evil-shift-right (region-beginning) (region-end))
|
||||
(evil-normal-state)
|
||||
(evil-visual-restore))
|
||||
|
||||
;; undo/redo for regions
|
||||
;; "u" 'undo-tree-undo
|
||||
;; "C-r" 'redo-tree-redo
|
||||
|
||||
"*" 'evil-visualstar/begin-search-forward
|
||||
"#" 'evil-visualstar/begin-search-backward
|
||||
|
||||
;; paste from recent yank register; which isn't overwritten by deletes or
|
||||
;; other operations.
|
||||
"P" "\"0p"
|
||||
|
||||
"S" 'evil-surround-region
|
||||
"R" 'evil-iedit-state/iedit-mode ; edit all instances of marked region
|
||||
"v" 'er/expand-region
|
||||
"V" 'er/contract-region
|
||||
|
||||
motion
|
||||
;; aliases for %
|
||||
"%" 'evilmi-jump-items
|
||||
[tab] (λ (if (ignore-errors (hs-already-hidden-p))
|
||||
(hs-toggle-hiding)
|
||||
(call-interactively 'evilmi-jump-items)))
|
||||
|
||||
"j" 'evil-next-line
|
||||
"k" 'evil-previous-line
|
||||
|
||||
"]g" 'diff-hl-next-hunk
|
||||
"[g" 'diff-hl-previous-hunk
|
||||
|
||||
"]e" (λ (call-interactively (if (bound-and-true-p flycheck-mode) 'flycheck-next-error 'next-error)))
|
||||
"[e" (λ (call-interactively (if (bound-and-true-p flycheck-mode) 'flycheck-previous-error 'previous-error)))
|
||||
|
||||
"gl" 'narf:goto-line
|
||||
"gs" 'evil-ace-jump-two-chars-mode
|
||||
"gx" 'evil-exchange
|
||||
"gr" 'narf::eval-region
|
||||
"g]" 'smart-down
|
||||
"g[" 'smart-up
|
||||
|
||||
insert
|
||||
"<A-backspace>" 'evil-delete-backward-word
|
||||
"<A-delete>" (λ (evil-forward-word) (evil-delete-backward-word))
|
||||
|
||||
;; Newline magic
|
||||
"<backspace>" 'backward-delete-char-untabify
|
||||
"<M-backspace>" 'narf:backward-kill-to-bol-and-indent
|
||||
"<C-return>" 'evil-ret-and-indent
|
||||
|
||||
;; Textmate-esque indent shift left/right
|
||||
"M-[" (kbd "C-o m l C-o I DEL C-o ` l")
|
||||
"M-]" (λ (evil-shift-right (point-at-bol) (point-at-eol)))
|
||||
"<backtab>" (kbd "M-[")
|
||||
|
||||
;; Company-mode
|
||||
"C-SPC" 'company-complete-common
|
||||
"C-x C-k" 'company-dictionary
|
||||
"C-x C-f" 'company-files
|
||||
"C-x C-]" 'company-tags
|
||||
"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)))
|
||||
|
||||
(insert replace)
|
||||
;; escape from insert mode (more responsive than using key-chord-define)
|
||||
"j" 'narf:exit-mode-maybe
|
||||
|
||||
(insert replace visual)
|
||||
"C-g" 'evil-normal-state
|
||||
|
||||
operator
|
||||
"s" 'evil-surround-edit
|
||||
"S" 'evil-Surround-edit
|
||||
|
||||
;; Rotate-text (see elisp/rotate-text.el)
|
||||
normal "!" 'rotate-word-at-point
|
||||
visual "!" 'rotate-region
|
||||
emacs [escape] 'evil-normal-state)
|
||||
|
||||
(bind :map evil-window-map
|
||||
;; winner-mode: window layout undo/redo (see core.el)
|
||||
"u" 'winner-undo
|
||||
"C-u" 'winner-undo
|
||||
"C-r" 'winner-redo
|
||||
|
||||
"C-w" 'ace-window
|
||||
"C-S-w" (λ (ace-window 4)) ; swap windows
|
||||
"C-C" (λ (ace-window 16))) ; delete windows
|
||||
|
||||
(after "help-mode"
|
||||
(bind normal :map help-mode-map
|
||||
"<escape>" (λ (kill-buffer)
|
||||
(if (eq popwin:popup-buffer (current-buffer))
|
||||
(popwin:close-popup-window)
|
||||
(evil-window-delete)))
|
||||
"]]" 'help-go-forward
|
||||
"[[" 'help-go-back))
|
||||
|
||||
(bind :map evil-ex-completion-map
|
||||
"C-r" 'evil-ex-paste-from-register ; registers in ex-mode
|
||||
"C-a" 'move-beginning-of-line
|
||||
"<s-left>" 'move-beginning-of-line
|
||||
"<s-right>" 'move-beginning-of-line
|
||||
"<s-backspace>" 'evil-delete-whole-line)
|
||||
|
||||
(bind :map company-active-map
|
||||
"C-o" 'company-search-kill-others
|
||||
"C-n" 'company-select-next-or-abort
|
||||
"C-p" 'company-select-previous-or-abort
|
||||
"C-h" 'company-show-doc-buffer
|
||||
"C-S-h" 'company-show-location
|
||||
"C-S-s" 'company-search-candidates
|
||||
"C-s" 'company-filter-candidates
|
||||
"C-SPC" 'company-complete-common
|
||||
[tab] 'company-complete
|
||||
"<backtab>" 'company-select-previous
|
||||
[escape] 'company-abort
|
||||
"<C-return>" 'helm-company
|
||||
"C-w" nil
|
||||
|
||||
:map company-search-map
|
||||
"C-n" 'company-search-repeat-forward
|
||||
"C-p" 'company-search-repeat-backward
|
||||
[escape] 'company-abort
|
||||
"C-w" nil)
|
||||
|
||||
;; TODO: Swap helm's C-z and Tab
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Keymap fixes ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; This section is dedicated to keymaps that "fix" certain keys so
|
||||
;; that they behave more like vim (or how I like it).
|
||||
|
||||
;; Restores "dumb" indentation to the tab key. This rustles a lot of
|
||||
;; peoples' jimmies, apparently, but it's how I like it.
|
||||
(bind insert
|
||||
"<tab>" 'narf:dumb-indent
|
||||
"<C-tab>" 'indent-for-tab-command
|
||||
|
||||
;; No dumb-tab for lisp
|
||||
:map lisp-mode-map [remap narf:dumb-indent] 'indent-for-tab-command
|
||||
:map emacs-lisp-mode-map [remap narf:dumb-indent] 'indent-for-tab-command)
|
||||
|
||||
;; Highjacks space/backspace to:
|
||||
;; a) delete spaces on either side of the cursor, if present ( | ) -> (|)
|
||||
;; b) allow backspace to delete space-indented blocks intelligently
|
||||
;; c) and not do any of this magic when inside a string
|
||||
(bind insert
|
||||
"SPC" 'narf:inflate-space-maybe
|
||||
[remap backward-delete-char-untabify] 'narf:deflate-space-maybe
|
||||
[remap newline] 'narf:newline-and-indent
|
||||
|
||||
;; Smarter move-to-beginning-of-line
|
||||
[remap move-beginning-of-line] 'narf:move-to-bol
|
||||
|
||||
;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist
|
||||
"C-e" 'narf:move-to-eol
|
||||
"C-u" 'narf:backward-kill-to-bol-and-indent
|
||||
|
||||
;; Fixes delete
|
||||
"<kp-delete>" 'delete-char
|
||||
|
||||
;; Fix osx keymappings and then some
|
||||
"<M-left>" 'narf:move-to-bol
|
||||
"<M-right>" 'narf:move-to-eol
|
||||
"<M-up>" 'beginning-of-buffer
|
||||
"<M-down>" 'end-of-buffer
|
||||
"<C-up>" 'smart-up
|
||||
"<C-down>" 'smart-down
|
||||
|
||||
;; Fix emacs motion keys
|
||||
"A-b" 'evil-backward-word-begin
|
||||
"A-w" 'evil-forward-word-begin
|
||||
"A-e" 'evil-forward-word-end
|
||||
|
||||
(insert normal)
|
||||
;; Textmate-esque insert-line before/after
|
||||
"<M-return>" 'evil-open-below
|
||||
"<S-M-return>" 'evil-open-above)
|
||||
|
||||
;; Make ESC quit all the things
|
||||
(bind :map (minibuffer-local-map
|
||||
minibuffer-local-ns-map
|
||||
minibuffer-local-completion-map
|
||||
minibuffer-local-must-match-map
|
||||
minibuffer-local-isearch-map)
|
||||
[escape] 'narf/minibuffer-quit)
|
||||
(bind emacs [escape] 'narf/minibuffer-quit)
|
||||
|
||||
(bind :map read-expression-map "C-w" 'evil-delete-backward-word)
|
||||
|
||||
;; Line selection via linum
|
||||
(bind "<left-margin> <down-mouse-1>" 'narf/mouse-select-line
|
||||
"<left-margin> <mouse-1>" 'narf/mouse-select-line
|
||||
"<left-margin> <drag-mouse-1>" 'narf/mouse-select-line
|
||||
"<left-margin> <double-mouse-1>" 'narf/mouse-select-block)
|
||||
|
||||
|
||||
(provide 'narf-bindings)
|
||||
;;; narf-bindings.el ends here
|
|
@ -1,88 +0,0 @@
|
|||
;; ex-commands
|
||||
(evil-define-command narf::byte-compile (&optional bang)
|
||||
:repeat nil
|
||||
(interactive "<!>")
|
||||
(when emacs-lisp-mode
|
||||
(if (not bang)
|
||||
(progn ;; (byte-recompile-file (concat CORE-DIR "defuns.el") t 0)
|
||||
(byte-recompile-file (buffer-file-name) t 0))
|
||||
(byte-recompile-file (expand-file-name "init.el" BASE-DIR) nil 0)
|
||||
(byte-recompile-directory CORE-DIR 0 nil)
|
||||
(byte-recompile-directory CONTRIB-DIR 0 nil)
|
||||
(dolist (path (directory-files MODULES-DIR t "\\(core\\|defuns\\|narf\\).*\\.el$"))
|
||||
(byte-recompile-file path nil 0)))))
|
||||
|
||||
(evil-define-command narf::autoload-compile (&optional bang)
|
||||
:repeat nil
|
||||
(interactive "<!>")
|
||||
(defvar generated-autoload-file (expand-file-name "autoloads.el" MODULES-DIR))
|
||||
(update-directory-autoloads CORE-DIR MODULES-DIR CONTRIB-DIR))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(excmd! "settr[im]" 'narf:toggle-delete-trailing-whitespace)
|
||||
|
||||
(excmd! "echo" 'narf::echo)
|
||||
(excmd "l[ast]" 'popwin:popup-last-buffer)
|
||||
(excmd "m[sg]" 'popwin:messages)
|
||||
(excmd! "full[scr]" 'narf:toggle-fullscreen)
|
||||
(excmd! "ini" 'narf::initfiles)
|
||||
(excmd! "bcomp[ile]" 'narf::byte-compile)
|
||||
(excmd! "acomp[ile]" 'narf::autoload-compile)
|
||||
(excmd! "cd" 'narf::cd)
|
||||
(excmd! "en[ew]" 'narf::create-file)
|
||||
(excmd! "ren[ame]" 'narf::rename-this-file) ; rename [NEWNAME] # rename file
|
||||
(excmd! "del[ete]" 'narf::delete-this-file) ; delete[!]
|
||||
(excmd! "al[ign]" 'narf::align)
|
||||
(excmd! "retab" 'narf::retab)
|
||||
(excmd! "na[rrow]" 'narf::narrow-indirect-or-widen) ; Narrow buffer to selection
|
||||
(excmd! "x" 'narf::scratch-buffer)
|
||||
(excmd "k[ill]" 'kill-this-buffer) ; Kill current buffer
|
||||
(excmd! "k[ill]o" 'narf:cleanup-buffers) ; Kill current project buffers
|
||||
(excmd! "k[ill]all" 'narf::kill-buffers) ; Kill all buffers (bang = project buffers only)
|
||||
(excmd! "k[ill]buried" 'narf::kill-buried-buffers) ; Kill all buffers (bang = project buffers only)
|
||||
(excmd! "ma[ke]" 'narf::build)
|
||||
(excmd! "t" 'narf::tmux-run)
|
||||
(excmd! "tcd" 'narf::tmux-chdir)
|
||||
(excmd! "a" 'helm-projectile-find-other-file)
|
||||
(excmd! "proj[ect]" 'helm-projectile-switch-project)
|
||||
(excmd! "ag" 'narf::ag-search)
|
||||
(excmd! "agr" 'narf::ag-regex-search)
|
||||
(excmd! "ag[cw]d" 'narf::ag-search-cwd)
|
||||
(excmd! "agr[cw]d" 'narf::ag-regex-search-cwd)
|
||||
(excmd! "sw[oop]" 'narf::swoop)
|
||||
(excmd! "rec[ent]" 'narf::recentf)
|
||||
(excmd! "ref[actor]" 'emr-show-refactor-menu)
|
||||
(excmd! "snip[pets]" 'narf::snippets) ; snip[!]
|
||||
(excmd! "cap[ture]" 'helm-org-capture-templates)
|
||||
(excmd! "n[otes]" 'helm-org-agenda-files-headings)
|
||||
(after "flycheck"
|
||||
(excmd! "er[rors]" (λ (flycheck-buffer) (flycheck-list-errors))))
|
||||
(after "re-builder"
|
||||
(excmd "re[gex]" 'narf::regex))
|
||||
(after "org"
|
||||
(excmd "o[rg]edit" 'org-edit-special)
|
||||
(excmd "o[rg]refile" 'org-refile)
|
||||
(excmd "o[rg]archive" 'org-archive-subtree)
|
||||
(excmd "o[rg]agenda" 'org-agenda)
|
||||
(excmd "o[rg]todo" 'org-show-todo-tree)
|
||||
(excmd "o[rg]link" 'org-link)
|
||||
(excmd "o[rg]align" 'org-align-all-tags))
|
||||
(after "workgroups2"
|
||||
(excmd! "sl[oad]" 'narf::load-session)
|
||||
(excmd! "ss[ave]" 'narf::save-session)
|
||||
(excmd "wg" (λ (message (wg-workgroup-list-display))))
|
||||
(excmd! "wnew" 'narf::new-workgroup)
|
||||
(excmd! "wre[name]" 'narf::rename-workgroup)
|
||||
(excmd "wn[ext]" 'wg-switch-to-workgroup-right)
|
||||
(excmd "wp[rev]" 'wg-switch-to-workgroup-left)
|
||||
(excmd "wl[ast]" 'wg-switch-to-previous-workgroup)
|
||||
(excmd "k[ill]w" 'wg-kill-workgroup)
|
||||
(excmd "k[ill]ow" (λ (let (workgroup (wg-current-workgroup))
|
||||
(dolist (w (wg-workgroup-list))
|
||||
(unless (wg-current-workgroup-p w)
|
||||
(wg-kill-workgroup w)))))))
|
||||
|
||||
|
||||
(provide 'narf-commands)
|
||||
;;; narf-commands.el ends here
|
|
@ -1,26 +0,0 @@
|
|||
(set-register ?. "~/.dotfiles/")
|
||||
(set-register ?d "~/Dropbox/Projects/")
|
||||
(set-register ?@ "~/.emacs.d/init.el")
|
||||
|
||||
;;;; Keymap Fixes ;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Implements some helpful keymappings for emacs sub-modes
|
||||
(add-hook! 'ido-setup-hook
|
||||
(bind :map (ido-completion-map ido-file-completion-map)
|
||||
;; "<backspace>" 'ido-delete-backward-updir
|
||||
"C-w" 'ido-delete-backward-word-updir))
|
||||
|
||||
(bind :normal :map evil-command-window-mode-map [escape] 'kill-buffer-and-window)
|
||||
(bind :map evil-ex-map [escape] 'narf/minibuffer-quit)
|
||||
|
||||
(bind :map minibuffer-local-map "\C-u" 'evil-delete-whole-line)
|
||||
|
||||
;; Disable the global drag-mouse map; clicking in new buffers often sends evil
|
||||
;; into visual mode, which is UN...ACCEPTAABBLLLEEEE!
|
||||
(global-unset-key (kbd "<drag-mouse-1>"))
|
||||
|
||||
;; Don't allow quitting easily.
|
||||
(setq confirm-kill-emacs (lambda (prompt) (y-or-n-p ">> Gee, I dunno Brain... Are you sure?")))
|
||||
|
||||
|
||||
(provide 'narf-settings)
|
||||
;;; narf-settings.el ends here
|
10
package.json
10
package.json
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"name": "Emacs.d",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"jshint": "*",
|
||||
"jsonlint": "*",
|
||||
"js-beautify": "*",
|
||||
"jsctags": "git://github.com/ramitos/jsctags.git"
|
||||
}
|
||||
}
|
0
private/README.md
Normal file
0
private/README.md
Normal file
336
private/my-bindings.el
Normal file
336
private/my-bindings.el
Normal file
|
@ -0,0 +1,336 @@
|
|||
;;; my-bindings.el
|
||||
|
||||
;; Minimalistic key mapping! Why go so far for this?
|
||||
;; ...
|
||||
;; Uh. Good question.
|
||||
|
||||
(@map
|
||||
-
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Global keymaps ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
"M-x" 'smex
|
||||
"M-X" 'smex-major-mode-commands
|
||||
"M-A-x" 'helm-M-x
|
||||
"M-;" 'eval-expression
|
||||
"C-`" 'popwin:toggle-popup-window
|
||||
"M-=" 'text-scale-increase
|
||||
"M--" 'text-scale-increase
|
||||
"M-w" 'evil-window-delete
|
||||
"M-/" 'evil-commentary-line
|
||||
"M-b" 'narf:build
|
||||
"M-t" 'helm-projectile-find-file
|
||||
|
||||
:m "M-j" "6j"
|
||||
:m "M-k" "6k"
|
||||
:n "M-k" 'narf:eval-buffer
|
||||
:n "M-d" 'dash-at-point
|
||||
:n "M-o" 'narf:ido-find-file
|
||||
:n "M-O" 'narf:ido-find-project-file
|
||||
|
||||
(:when IS-MAC
|
||||
"<A-left>" 'backward-word
|
||||
"<A-right>" 'forward-word
|
||||
"<M-backspace>" 'narf: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" 'clipboard-yank
|
||||
"M-q" 'evil-quit-all
|
||||
"M-z" 'undo
|
||||
"M-Z" 'redo
|
||||
"C-M-f" 'narf:toggle-fullscreen)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Local keymaps ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
:nmv ";" evil-ex
|
||||
|
||||
(:leader "m"
|
||||
:n "," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
|
||||
:n "<" 'helm-buffers-list
|
||||
:n "." 'narf:ido-find-file
|
||||
:n ">" 'narf:ido-find-file-other-window
|
||||
:n "/" 'helm-projectile-find-file
|
||||
:n ";" 'helm-semantic-or-imenu
|
||||
|
||||
:n "]" 'helm-etags-select
|
||||
:n "a" 'helm-projectile-find-other-file
|
||||
:n "E" 'narf::initfiles
|
||||
:n "h" 'helm-apropos
|
||||
:n "n" 'narf::notes
|
||||
:n "m" 'helm-recentf
|
||||
:n "M" 'helm-projectile-recentf ; recent PROJECT files
|
||||
:n "p" 'helm-projectile-switch-project
|
||||
:n "r" 'emr-show-refactor-menu
|
||||
|
||||
:n "qq" 'evil-save-and-quit
|
||||
:n "QQ" (λ (let ((confirm-kill-emacs nil)) (narf::kill-buffers t) (evil-quit-all)))
|
||||
|
||||
;; insert lines in-place)
|
||||
:n "jj" (λ (save-excursion (evil-insert-newline-below)))
|
||||
:n "kk" (λ (save-excursion (evil-insert-newline-above)))
|
||||
|
||||
:n "oo" 'narf:open-with
|
||||
:n "ob" (λ (narf:open-with "Google Chrome"))
|
||||
:n "of" (λ (narf:open-with "Finder.app" default-directory))
|
||||
:n "oF" (λ (narf:open-with "Finder.app" (narf/project-root)))
|
||||
:n "ou" (λ (narf:open-with "Transmit"))
|
||||
:n "oU" (λ (narf:open-with "Transmit" default-directory))
|
||||
:n "ol" (λ (narf:open-with "LaunchBar"))
|
||||
:n "oL" (λ (narf:open-with "LaunchBar" default-directory))
|
||||
:n "ot" (λ (narf::tmux-chdir nil t))
|
||||
:n "oT" 'narf::tmux-chdir)
|
||||
|
||||
(:localleader "\\"
|
||||
:n "\\" 'narf:neotree-toggle
|
||||
:n "." 'narf:neotree-find
|
||||
:n ";" 'narf:nlinum-toggle
|
||||
:n "=" 'toggle-transparency
|
||||
:n "E" 'evil-emacs-state
|
||||
|
||||
:n "]" 'next-buffer
|
||||
:n "[" 'previous-buffer
|
||||
|
||||
:n "s" (λ (narf::snippets t)) ; ido snippets dir
|
||||
:n "g" 'diff-hl-diff-goto-hunk
|
||||
:n "e" (λ (call-interactively 'flycheck-buffer) (flycheck-list-errors))
|
||||
:n "p" 'helm-show-kill-ring
|
||||
:n "b" 'helm-bookmarks
|
||||
:n "w" 'helm-wg)
|
||||
|
||||
:m :remap "j" "gj"
|
||||
:m :remap "k" "gk"
|
||||
|
||||
:n "Y" "y$"
|
||||
|
||||
:n "zr" 'narf:open-folds
|
||||
:n "zm" 'narf:close-folds
|
||||
|
||||
:n "zx" 'narf:kill-real-buffer
|
||||
:n "zX" 'bury-buffer
|
||||
|
||||
:n "]b" 'narf:next-real-buffer
|
||||
:n "[b" 'narf:previous-real-buffer
|
||||
:n "]w" 'wg-switch-to-workgroup-right
|
||||
:n "[w" 'wg-switch-to-workgroup-left
|
||||
|
||||
;; don't move cursor on indent
|
||||
:n "=" (λ (save-excursion (call-interactively 'evil-indent)))
|
||||
|
||||
;; Increment/decrement number under cursor
|
||||
:n "g=" 'evil-numbers/inc-at-pt
|
||||
:n "g-" 'evil-numbers/dec-at-pt
|
||||
:n "gR" 'narf::eval-buffer
|
||||
:n "gc" 'evil-commentary
|
||||
:n "gy" 'evil-commentary-yank
|
||||
|
||||
;; VISUAL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
:v "." 'evil-repeat
|
||||
:v "gR" 'narf::eval-region-and-replace
|
||||
:v ",=" 'align-regexp
|
||||
|
||||
;; vnoremap < <gv
|
||||
:v "<" (λ (evil-shift-left (region-beginning) (region-end))
|
||||
(evil-normal-state)
|
||||
(evil-visual-restore))
|
||||
;; vnoremap > >gv
|
||||
:v ">" (λ (evil-shift-right (region-beginning) (region-end))
|
||||
(evil-normal-state)
|
||||
(evil-visual-restore))
|
||||
|
||||
;; undo/redo for regions
|
||||
;; "u" 'undo-tree-undo
|
||||
;; "C-r" 'redo-tree-redo
|
||||
|
||||
:v "*" 'evil-visualstar/begin-search-forward
|
||||
:v "#" 'evil-visualstar/begin-search-backward
|
||||
|
||||
;; paste from recent yank register; which isn't overwritten by deletes or
|
||||
;; other operations.
|
||||
:v "P" "\"0p"
|
||||
|
||||
:v "S" 'evil-surround-region
|
||||
:v "R" 'evil-iedit-state/iedit-mode ; edit all instances of marked region
|
||||
:v "v" 'er/expand-region
|
||||
:v "V" 'er/contract-region
|
||||
|
||||
;; aliases for %
|
||||
:m "%" 'evilmi-jump-items
|
||||
:m [tab] (λ (if (ignore-errors (hs-already-hidden-p))
|
||||
(hs-toggle-hiding)
|
||||
(call-interactively 'evilmi-jump-items)))
|
||||
|
||||
:m "]g" 'diff-hl-next-hunk
|
||||
:m "[g" 'diff-hl-previous-hunk
|
||||
|
||||
:m "]e" (λ (call-interactively (if (bound-and-true-p flycheck-mode) 'flycheck-next-error 'next-error)))
|
||||
:m "[e" (λ (call-interactively (if (bound-and-true-p flycheck-mode) 'flycheck-previous-error 'previous-error)))
|
||||
|
||||
:m "gl" 'narf:goto-line
|
||||
:m "gs" 'evil-ace-jump-two-chars-mode
|
||||
:m "gx" 'evil-exchange
|
||||
:m "gr" 'narf::eval-region
|
||||
:m "g]" 'smart-down
|
||||
:m "g[" 'smart-up
|
||||
|
||||
:i "<A-backspace>" 'evil-delete-backward-word
|
||||
:i "<A-delete>" (λ (evil-forward-word) (evil-delete-backward-word))
|
||||
|
||||
:i ;; Newline magic
|
||||
:i "<backspace>" 'backward-delete-char-untabify
|
||||
:i "<M-backspace>" 'narf:backward-kill-to-bol-and-indent
|
||||
:i "<C-return>" 'evil-ret-and-indent
|
||||
|
||||
:i ;; Textmate-esque indent shift left/right
|
||||
:i "M-[" "C-o m l C-o I DEL C-o ` l"
|
||||
:i "M-]" (λ (evil-shift-right (point-at-bol) (point-at-eol)))
|
||||
:i "<backtab>" "M-["
|
||||
|
||||
;; escape from insert mode (more responsive than using key-chord-define)
|
||||
:ir "j" 'narf:exit-mode-maybe
|
||||
:irv "C-g" 'evil-normal-state
|
||||
|
||||
:o "s" 'evil-surround-edit
|
||||
:o "S" 'evil-Surround-edit
|
||||
|
||||
:n "!" 'rotate-word-at-point
|
||||
:v "!" 'rotate-region
|
||||
:e [escape] 'evil-normal-state
|
||||
|
||||
:i "C-SPC" 'company-complete-common
|
||||
:i "C-x C-k" 'company-dictionary
|
||||
:i "C-x C-f" 'company-files
|
||||
:i "C-x C-]" 'company-tags
|
||||
:i "C-x s" 'company-ispell
|
||||
:i "C-x C-s" 'company-yasnippet
|
||||
:i "C-x C-o" 'company-semantic
|
||||
:i "C-x C-n" 'company-dabbrev-code
|
||||
:i "C-x C-p" (λ (let ((company-selection-wrap-around t))
|
||||
(call-interactively 'company-dabbrev-code)
|
||||
(company-select-previous-or-abort)))
|
||||
|
||||
(:map company-active-map
|
||||
"C-o" 'company-search-kill-others
|
||||
"C-n" 'company-select-next-or-abort
|
||||
"C-p" 'company-select-previous-or-abort
|
||||
"C-h" 'company-show-doc-buffer
|
||||
"C-S-h" 'company-show-location
|
||||
"C-S-s" 'company-search-candidates
|
||||
"C-s" 'company-filter-candidates
|
||||
"C-SPC" 'company-complete-common
|
||||
[tab] 'company-complete
|
||||
"<backtab>" 'company-select-previous
|
||||
[escape] 'company-abort
|
||||
"<C-return>" 'helm-company
|
||||
:unset "C-w")
|
||||
(:map company-search-map
|
||||
"C-n" 'company-search-repeat-forward
|
||||
"C-p" 'company-search-repeat-backward
|
||||
[escape] 'company-abort
|
||||
:unset "C-w")
|
||||
|
||||
(keymap evil-window-map
|
||||
"u" 'winner-undo
|
||||
"C-u" 'winner-undo
|
||||
"C-r" 'winner-redo
|
||||
|
||||
"C-w" 'ace-window
|
||||
"C-S-w" (λ (ace-window 4)) ; swap windows
|
||||
"C-C" (λ (ace-window 16))) ; delete windows
|
||||
|
||||
(:after help-mode
|
||||
(:map help-mode-map
|
||||
:n "]]" 'help-go-forward
|
||||
:n "[[" 'help-go-back
|
||||
:n "<escape>" (λ (kill-buffer)
|
||||
(if (eq popwin:popup-buffer (current-buffer))
|
||||
(popwin:close-popup-window)
|
||||
(evil-window-delete)))))
|
||||
|
||||
(:map evil-ex-completion-map
|
||||
"C-r" 'evil-ex-paste-from-register ; registers in ex-mode
|
||||
"C-a" 'move-beginning-of-line
|
||||
"<s-left>" 'move-beginning-of-line
|
||||
"<s-right>" 'move-beginning-of-line
|
||||
"<s-backspace>" 'evil-delete-whole-line)
|
||||
|
||||
(:map evil-snipe-override-mode-map
|
||||
"C-;" 'evil-snipe-repeat
|
||||
"C-," 'evil-snipe-repeat-reverse))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Keymap fixes ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; This section is dedicated to keymaps that "fix" certain keys so
|
||||
;; that they behave more like vim (or how I like it).
|
||||
|
||||
;; Restores "dumb" indentation to the tab key. This rustles a lot of
|
||||
;; peoples' jimmies, apparently, but it's how I like it.
|
||||
(@map :i "<tab>" 'narf:dumb-indent
|
||||
:i "<C-tab>" 'indent-for-tab-command
|
||||
|
||||
;; No dumb-tab for lisp
|
||||
:i :map lisp-mode-map [remap narf:dumb-indent] 'indent-for-tab-command
|
||||
:i :map emacs-lisp-mode-map [remap narf:dumb-indent] 'indent-for-tab-command
|
||||
|
||||
;; Highjacks space/backspace to:
|
||||
;; a) delete spaces on either side of the cursor, if present ( | ) -> (|)
|
||||
;; b) allow backspace to delete space-indented blocks intelligently
|
||||
;; c) and not do any of this magic when inside a string
|
||||
:i "SPC" 'narf:inflate-space-maybe
|
||||
:i [remap backward-delete-char-untabify] 'narf:deflate-space-maybe
|
||||
:i [remap newline] 'narf:newline-and-indent
|
||||
|
||||
;; Smarter move-to-beginning-of-line
|
||||
:i [remap move-beginning-of-line] 'narf:move-to-bol
|
||||
|
||||
;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist
|
||||
:i "C-e" 'narf:move-to-eol
|
||||
:i "C-u" 'narf:backward-kill-to-bol-and-indent
|
||||
|
||||
;; Fixes delete
|
||||
:i "<kp-delete>" 'delete-char
|
||||
|
||||
;; Fix osx keymappings and then some
|
||||
:i "<M-left>" 'narf:move-to-bol
|
||||
:i "<M-right>" 'narf:move-to-eol
|
||||
:i "<M-up>" 'beginning-of-buffer
|
||||
:i "<M-down>" 'end-of-buffer
|
||||
:i "<C-up>" 'smart-up
|
||||
:i "<C-down>" 'smart-down
|
||||
|
||||
;; Fix emacs motion keys
|
||||
:i "A-b" 'evil-backward-word-begin
|
||||
:i "A-w" 'evil-forward-word-begin
|
||||
:i "A-e" 'evil-forward-word-end
|
||||
|
||||
;; Textmate-esque insert-line before/after
|
||||
:ni "<M-return>" 'evil-open-below
|
||||
:ni "<S-M-return>" 'evil-open-above
|
||||
|
||||
;; Make ESC quit all the things
|
||||
:e [escape] narf/minibuffer-quit
|
||||
(:map (minibuffer-local-map
|
||||
minibuffer-local-ns-map
|
||||
minibuffer-local-completion-map
|
||||
minibuffer-local-must-match-map
|
||||
minibuffer-local-isearch-map)
|
||||
[escape] 'narf/minibuffer-quit)
|
||||
|
||||
:map read-expression-map "C-w" 'evil-delete-backward-word
|
||||
|
||||
;; Line selection via linum
|
||||
"<left-margin> <down-mouse-1>" 'narf/mouse-select-line
|
||||
"<left-margin> <mouse-1>" 'narf/mouse-select-line
|
||||
"<left-margin> <drag-mouse-1>" 'narf/mouse-select-line
|
||||
"<left-margin> <double-mouse-1>" 'narf/mouse-select-block)
|
||||
|
||||
(provide 'my-bindings)
|
||||
;;; my-bindings.el ends here
|
72
private/my-commands.el
Normal file
72
private/my-commands.el
Normal file
|
@ -0,0 +1,72 @@
|
|||
;;; my-commands.el
|
||||
|
||||
(! (require 'core-defuns))
|
||||
|
||||
(@exmap "settr[im]" 'narf:toggle-delete-trailing-whitespace)
|
||||
|
||||
(@exmap "l[ast]" 'popwin:popup-last-buffer)
|
||||
(@exmap "m[sg]" 'popwin:messages)
|
||||
|
||||
(@exmap "bcomp[ile]" 'narf:byte-compile)
|
||||
(@exmap "acomp[ile]" 'narf:autoload-compile)
|
||||
|
||||
(@exmap "echo" 'narf:echo)
|
||||
(@exmap "full[scr]" 'narf/toggle-fullscreen)
|
||||
(@exmap "ini" 'narf:initfiles)
|
||||
(@exmap "cd" 'narf:cd)
|
||||
(@exmap "en[ew]" 'narf:create-file)
|
||||
(@exmap "ren[ame]" 'narf:rename-this-file) ; rename [NEWNAME] # rename file
|
||||
(@exmap "del[ete]" 'narf:delete-this-file) ; delete[!]
|
||||
(@exmap "al[ign]" 'narf:align)
|
||||
(@exmap "retab" 'narf:retab)
|
||||
(@exmap "na[rrow]" 'narf:narrow-indirect-or-widen) ; Narrow buffer to selection
|
||||
(@exmap "x" 'narf:scratch-buffer)
|
||||
(@exmap "k[ill]" 'kill-this-buffer) ; Kill current buffer
|
||||
(@exmap "k[ill]o" 'narf:cleanup-buffers) ; Kill current project buffers
|
||||
(@exmap "k[ill]all" 'narf:kill-buffers) ; Kill all buffers (bang = project buffers only)
|
||||
(@exmap "k[ill]buried" 'narf:kill-buried-buffers) ; Kill all buffers (bang = project buffers only)
|
||||
(@exmap "ma[ke]" 'narf:build)
|
||||
(@exmap "t" 'narf:tmux-run)
|
||||
(@exmap "tcd" 'narf:tmux-chdir)
|
||||
(@exmap "a" 'helm-projectile-find-other-file)
|
||||
(@exmap "proj[ect]" 'helm-projectile-switch-project)
|
||||
(@exmap "ag" 'narf:ag-search)
|
||||
(@exmap "agr" 'narf:ag-regex-search)
|
||||
(@exmap "ag[cw]d" 'narf:ag-search-cwd)
|
||||
(@exmap "agr[cw]d" 'narf:ag-regex-search-cwd)
|
||||
(@exmap "sw[oop]" 'narf:swoop)
|
||||
(@exmap "rec[ent]" 'narf:recentf)
|
||||
(@exmap "ref[actor]" 'emr-show-refactor-menu)
|
||||
(@exmap "snip[pets]" 'narf::snippets) ; snip[!]
|
||||
(@exmap "cap[ture]" 'helm-org-capture-templates)
|
||||
(@exmap "n[otes]" 'helm-org-agenda-files-headings)
|
||||
(after "flycheck"
|
||||
(@exmap "er[rors]" (λ (flycheck-buffer) (flycheck-list-errors))))
|
||||
(after "re-builder"
|
||||
(@exmap "re[gex]" 'narf::regex))
|
||||
(after "org"
|
||||
(@exmap "o[rg]edit" 'org-edit-special)
|
||||
(@exmap "o[rg]refile" 'org-refile)
|
||||
(@exmap "o[rg]archive" 'org-archive-subtree)
|
||||
(@exmap "o[rg]agenda" 'org-agenda)
|
||||
(@exmap "o[rg]todo" 'org-show-todo-tree)
|
||||
(@exmap "o[rg]link" 'org-link)
|
||||
(@exmap "o[rg]align" 'org-align-all-tags))
|
||||
(after "workgroups2"
|
||||
(@exmap "sl[oad]" 'narf:load-session)
|
||||
(@exmap "ss[ave]" 'narf:save-session)
|
||||
(@exmap "wg" (λ (message (wg-workgroup-list-display))))
|
||||
(@exmap "wnew" 'narf:new-workgroup)
|
||||
(@exmap "wre[name]" 'narf:rename-workgroup)
|
||||
(@exmap "wn[ext]" 'wg-switch-to-workgroup-right)
|
||||
(@exmap "wp[rev]" 'wg-switch-to-workgroup-left)
|
||||
(@exmap "wl[ast]" 'wg-switch-to-previous-workgroup)
|
||||
(@exmap "k[ill]w" 'wg-kill-workgroup)
|
||||
(@exmap "k[ill]ow" (λ (let (workgroup (wg-current-workgroup))
|
||||
(dolist (w (wg-workgroup-list))
|
||||
(unless (wg-current-workgroup-p w)
|
||||
(wg-kill-workgroup w)))))))
|
||||
|
||||
|
||||
(provide 'my-commands)
|
||||
;;; my-commands.el ends here
|
0
private/themes/README.md
Normal file
0
private/themes/README.md
Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue