Add emacs directory
git-svn-id: http://photonzero.com/dotfiles/trunk@54 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
parent
e50f8f4bc8
commit
5b6729933d
100 changed files with 37586 additions and 0 deletions
56
.emacs.d/ac-comphist.dat
Normal file
56
.emacs.d/ac-comphist.dat
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
((("color-theme-barak" .
|
||||
[3 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0])
|
||||
("else" .
|
||||
[1 0 0 0])
|
||||
("if" .
|
||||
[1 0])
|
||||
(":bold" .
|
||||
[1 0 0 0 0])
|
||||
("set-default" .
|
||||
[0 0 0 1 0 0 0 0 0 0 0])
|
||||
("argc" .
|
||||
[1 0 1 0])
|
||||
("int" .
|
||||
[2 0 0])
|
||||
("return" .
|
||||
[0 0 0 1 0 0])
|
||||
("require" .
|
||||
[3 0 0 1 0 0 2])
|
||||
("auto" .
|
||||
[1 0 0 0])
|
||||
("ac-expand" .
|
||||
[1 0 0 0 0 0 0 0 1])
|
||||
("rest" .
|
||||
[0 0 0 3])
|
||||
("first" .
|
||||
[0 0 0 0 2])
|
||||
("ac-complete" .
|
||||
[1 0 0 0 0 0 1 0 0 0 0])
|
||||
("ac-completing-map" .
|
||||
[0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0])
|
||||
("setq" .
|
||||
[2 0 0 1])
|
||||
("autoload" .
|
||||
[0 0 0 1 0 0 0 0])
|
||||
("ac-auto-start" .
|
||||
[0 0 0 0 0 0 0 0 0 0 0 0 1])
|
||||
("nil" .
|
||||
[2 0 0])
|
||||
("defun" .
|
||||
[0 0 0 1 0])
|
||||
("ac-dwim" .
|
||||
[0 0 0 0 0 0 1])
|
||||
("t" .
|
||||
[1])
|
||||
("set-buffer" .
|
||||
[0 0 0 1 0 0 0 0 0 0])
|
||||
("ac-expand-on-auto-complete" .
|
||||
[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0])
|
||||
("setcdr" .
|
||||
[0 0 0 1 0 0])
|
||||
("color-theme-blackboard" .
|
||||
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
|
||||
("color-theme-tangotango" .
|
||||
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0])
|
||||
("color-theme-tty-dark" .
|
||||
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0])))
|
||||
24
.emacs.d/auto-complete/Makefile
Normal file
24
.emacs.d/auto-complete/Makefile
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
VERSION=`perl -ne 'print $$1 if /;; Version: (.*)/' auto-complete.el`
|
||||
PACKAGE=auto-complete-${VERSION}
|
||||
|
||||
byte-compile:
|
||||
emacs -Q -L . -batch -f batch-byte-compile *.el
|
||||
|
||||
install:
|
||||
emacs -Q -L . -batch -l etc/install ${DIR}
|
||||
|
||||
clean:
|
||||
rm -f *.elc
|
||||
rm -f doc/*.html
|
||||
rm -rf ${PACKAGE}
|
||||
rm -f ${PACKAGE}.zip ${PACKAGE}.tar.bz2
|
||||
|
||||
package: clean
|
||||
mkdir ${PACKAGE}
|
||||
cp -r *.el Makefile README.txt TODO.txt doc etc dict ${PACKAGE}
|
||||
|
||||
tar.bz2: package
|
||||
tar cjf ${PACKAGE}.tar.bz2 ${PACKAGE}
|
||||
|
||||
zip: package
|
||||
zip -r ${PACKAGE}.zip ${PACKAGE}
|
||||
13
.emacs.d/auto-complete/README.txt
Normal file
13
.emacs.d/auto-complete/README.txt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
Auto Complete Mode
|
||||
==================
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
* http://cx4a.org/software/auto-complete/
|
||||
* doc/index.txt
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Auto Complete Mode is distributed under the term of GPLv3. And its documentations under doc directory is distributed under the term of GFDL.
|
||||
10
.emacs.d/auto-complete/TODO.txt
Normal file
10
.emacs.d/auto-complete/TODO.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
- etags, ctags
|
||||
- emacswiki
|
||||
- test facility
|
||||
- support composed chars
|
||||
- minibuffer completion
|
||||
- performance issue (cache issue)
|
||||
- asynchronous processing
|
||||
- kanji henkan support
|
||||
- create menu if needed
|
||||
- quick help positioning on tabs (bug)
|
||||
480
.emacs.d/auto-complete/auto-complete-config.el
Normal file
480
.emacs.d/auto-complete/auto-complete-config.el
Normal file
|
|
@ -0,0 +1,480 @@
|
|||
;;; auto-complete-config.el --- auto-complete additional configuations
|
||||
|
||||
;; Copyright (C) 2009, 2010 Tomohiro Matsuyama
|
||||
|
||||
;; Author: Tomohiro Matsuyama <m2ym.pub@gmail.com>
|
||||
;; Keywords: convenience
|
||||
;; Version: 1.3
|
||||
|
||||
;; 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:
|
||||
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
|
||||
(require 'auto-complete)
|
||||
|
||||
|
||||
|
||||
;;;; Additional sources
|
||||
|
||||
;; imenu
|
||||
|
||||
(defvar ac-imenu-index nil)
|
||||
|
||||
(ac-clear-variable-every-10-minutes 'ac-imenu-index)
|
||||
|
||||
(defun ac-imenu-candidates ()
|
||||
(loop with i = 0
|
||||
with stack = (progn
|
||||
(unless (local-variable-p 'ac-imenu-index)
|
||||
(make-local-variable 'ac-imenu-index))
|
||||
(or ac-imenu-index
|
||||
(setq ac-imenu-index
|
||||
(ignore-errors
|
||||
(with-no-warnings
|
||||
(imenu--make-index-alist))))))
|
||||
with result
|
||||
while (and stack (or (not (integerp ac-limit))
|
||||
(< i ac-limit)))
|
||||
for node = (pop stack)
|
||||
if (consp node)
|
||||
do
|
||||
(let ((car (car node))
|
||||
(cdr (cdr node)))
|
||||
(if (consp cdr)
|
||||
(mapc (lambda (child)
|
||||
(push child stack))
|
||||
cdr)
|
||||
(when (and (stringp car)
|
||||
(string-match (concat "^" (regexp-quote ac-prefix)) car))
|
||||
;; Remove extra characters
|
||||
(if (string-match "^.*\\(()\\|=\\|<>\\)$" car)
|
||||
(setq car (substring car 0 (match-beginning 1))))
|
||||
(push car result)
|
||||
(incf i))))
|
||||
finally return (nreverse result)))
|
||||
|
||||
(ac-define-source imenu
|
||||
'((depends imenu)
|
||||
(candidates . ac-imenu-candidates)
|
||||
(symbol . "s")))
|
||||
|
||||
;; gtags
|
||||
|
||||
(defface ac-gtags-candidate-face
|
||||
'((t (:background "lightgray" :foreground "navy")))
|
||||
"Face for gtags candidate"
|
||||
:group 'auto-complete)
|
||||
|
||||
(defface ac-gtags-selection-face
|
||||
'((t (:background "navy" :foreground "white")))
|
||||
"Face for the gtags selected candidate."
|
||||
:group 'auto-complete)
|
||||
|
||||
(defun ac-gtags-candidate ()
|
||||
(ignore-errors
|
||||
(split-string (shell-command-to-string (format "global -ci %s" ac-prefix)) "\n")))
|
||||
|
||||
(ac-define-source gtags
|
||||
'((candidates . ac-gtags-candidate)
|
||||
(candidate-face . ac-gtags-candidate-face)
|
||||
(selection-face . ac-gtags-selection-face)
|
||||
(requires . 3)
|
||||
(symbol . "s")))
|
||||
|
||||
;; yasnippet
|
||||
|
||||
(defface ac-yasnippet-candidate-face
|
||||
'((t (:background "sandybrown" :foreground "black")))
|
||||
"Face for yasnippet candidate."
|
||||
:group 'auto-complete)
|
||||
|
||||
(defface ac-yasnippet-selection-face
|
||||
'((t (:background "coral3" :foreground "white")))
|
||||
"Face for the yasnippet selected candidate."
|
||||
:group 'auto-complete)
|
||||
|
||||
(defun ac-yasnippet-table-hash (table)
|
||||
(cond
|
||||
((fboundp 'yas/snippet-table-hash)
|
||||
(yas/snippet-table-hash table))
|
||||
((fboundp 'yas/table-hash)
|
||||
(yas/table-hash table))))
|
||||
|
||||
(defun ac-yasnippet-table-parent (table)
|
||||
(cond
|
||||
((fboundp 'yas/snippet-table-parent)
|
||||
(yas/snippet-table-parent table))
|
||||
((fboundp 'yas/table-parent)
|
||||
(yas/table-parent table))))
|
||||
|
||||
(defun ac-yasnippet-candidate-1 (table)
|
||||
(with-no-warnings
|
||||
(let ((hashtab (ac-yasnippet-table-hash table))
|
||||
(parent (ac-yasnippet-table-parent table))
|
||||
candidates)
|
||||
(maphash (lambda (key value)
|
||||
(push key candidates))
|
||||
hashtab)
|
||||
(setq candidates (all-completions ac-prefix (nreverse candidates)))
|
||||
(if parent
|
||||
(setq candidates
|
||||
(append candidates (ac-yasnippet-candidate-1 parent))))
|
||||
candidates)))
|
||||
|
||||
(defun ac-yasnippet-candidates ()
|
||||
(with-no-warnings
|
||||
(if (fboundp 'yas/get-snippet-tables)
|
||||
;; >0.6.0
|
||||
(apply 'append (mapcar 'ac-yasnippet-candidate-1 (yas/get-snippet-tables major-mode)))
|
||||
(let ((table
|
||||
(if (fboundp 'yas/snippet-table)
|
||||
;; <0.6.0
|
||||
(yas/snippet-table major-mode)
|
||||
;; 0.6.0
|
||||
(yas/current-snippet-table))))
|
||||
(if table
|
||||
(ac-yasnippet-candidate-1 table))))))
|
||||
|
||||
(ac-define-source yasnippet
|
||||
'((depends yasnippet)
|
||||
(candidates . ac-yasnippet-candidates)
|
||||
(action . yas/expand)
|
||||
(candidate-face . ac-yasnippet-candidate-face)
|
||||
(selection-face . ac-yasnippet-selection-face)
|
||||
(symbol . "a")))
|
||||
|
||||
;; semantic
|
||||
|
||||
(defun ac-semantic-candidates (prefix)
|
||||
(with-no-warnings
|
||||
(delete "" ; semantic sometimes returns an empty string
|
||||
(mapcar 'semantic-tag-name
|
||||
(ignore-errors
|
||||
(or (semantic-analyze-possible-completions
|
||||
(semantic-analyze-current-context))
|
||||
(senator-find-tag-for-completion prefix)))))))
|
||||
|
||||
(ac-define-source semantic
|
||||
'((available . (or (require 'semantic-ia nil t)
|
||||
(require 'semantic/ia nil t)))
|
||||
(candidates . (ac-semantic-candidates ac-prefix))
|
||||
(prefix . c-dot-ref)
|
||||
(requires . 0)
|
||||
(symbol . "m")))
|
||||
|
||||
(ac-define-source semantic-raw
|
||||
'((available . (or (require 'semantic-ia nil t)
|
||||
(require 'semantic/ia nil t)))
|
||||
(candidates . (ac-semantic-candidates ac-prefix))
|
||||
(symbol . "s")))
|
||||
|
||||
;; eclim
|
||||
|
||||
(defun ac-eclim-candidates ()
|
||||
(with-no-warnings
|
||||
(loop for c in (eclim/java-complete)
|
||||
collect (nth 1 c))))
|
||||
|
||||
(ac-define-source eclim
|
||||
'((candidates . ac-eclim-candidates)
|
||||
(prefix . c-dot)
|
||||
(requires . 0)
|
||||
(symbol . "f")))
|
||||
|
||||
;; css
|
||||
|
||||
;; Copied from company-css.el
|
||||
(defconst ac-css-property-alist
|
||||
;; see http://www.w3.org/TR/CSS21/propidx.html
|
||||
'(("azimuth" angle "left-side" "far-left" "left" "center-left" "center"
|
||||
"center-right" "right" "far-right" "right-side" "behind" "leftwards"
|
||||
"rightwards")
|
||||
("background" background-color background-image background-repeat
|
||||
background-attachment background-position)
|
||||
("background-attachment" "scroll" "fixed")
|
||||
("background-color" color "transparent")
|
||||
("background-image" uri "none")
|
||||
("background-position" percentage length "left" "center" "right" percentage
|
||||
length "top" "center" "bottom" "left" "center" "right" "top" "center"
|
||||
"bottom")
|
||||
("background-repeat" "repeat" "repeat-x" "repeat-y" "no-repeat")
|
||||
("border" border-width border-style border-color)
|
||||
("border-bottom" border)
|
||||
("border-bottom-color" border-color)
|
||||
("border-bottom-style" border-style)
|
||||
("border-bottom-width" border-width)
|
||||
("border-collapse" "collapse" "separate")
|
||||
("border-color" color "transparent")
|
||||
("border-left" border)
|
||||
("border-left-color" border-color)
|
||||
("border-left-style" border-style)
|
||||
("border-left-width" border-width)
|
||||
("border-right" border)
|
||||
("border-right-color" border-color)
|
||||
("border-right-style" border-style)
|
||||
("border-right-width" border-width)
|
||||
("border-spacing" length length)
|
||||
("border-style" border-style)
|
||||
("border-top" border)
|
||||
("border-top-color" border-color)
|
||||
("border-top-style" border-style)
|
||||
("border-top-width" border-width)
|
||||
("border-width" border-width)
|
||||
("bottom" length percentage "auto")
|
||||
("caption-side" "top" "bottom")
|
||||
("clear" "none" "left" "right" "both")
|
||||
("clip" shape "auto")
|
||||
("color" color)
|
||||
("content" "normal" "none" string uri counter "attr()" "open-quote"
|
||||
"close-quote" "no-open-quote" "no-close-quote")
|
||||
("counter-increment" identifier integer "none")
|
||||
("counter-reset" identifier integer "none")
|
||||
("cue" cue-before cue-after)
|
||||
("cue-after" uri "none")
|
||||
("cue-before" uri "none")
|
||||
("cursor" uri "*" "auto" "crosshair" "default" "pointer" "move" "e-resize"
|
||||
"ne-resize" "nw-resize" "n-resize" "se-resize" "sw-resize" "s-resize"
|
||||
"w-resize" "text" "wait" "help" "progress")
|
||||
("direction" "ltr" "rtl")
|
||||
("display" "inline" "block" "list-item" "run-in" "inline-block" "table"
|
||||
"inline-table" "table-row-group" "table-header-group" "table-footer-group"
|
||||
"table-row" "table-column-group" "table-column" "table-cell"
|
||||
"table-caption" "none")
|
||||
("elevation" angle "below" "level" "above" "higher" "lower")
|
||||
("empty-cells" "show" "hide")
|
||||
("float" "left" "right" "none")
|
||||
("font" font-style font-variant font-weight font-size "/" line-height
|
||||
font-family "caption" "icon" "menu" "message-box" "small-caption"
|
||||
"status-bar")
|
||||
("font-family" family-name generic-family)
|
||||
("font-size" absolute-size relative-size length percentage)
|
||||
("font-style" "normal" "italic" "oblique")
|
||||
("font-variant" "normal" "small-caps")
|
||||
("font-weight" "normal" "bold" "bolder" "lighter" "100" "200" "300" "400"
|
||||
"500" "600" "700" "800" "900")
|
||||
("height" length percentage "auto")
|
||||
("left" length percentage "auto")
|
||||
("letter-spacing" "normal" length)
|
||||
("line-height" "normal" number length percentage)
|
||||
("list-style" list-style-type list-style-position list-style-image)
|
||||
("list-style-image" uri "none")
|
||||
("list-style-position" "inside" "outside")
|
||||
("list-style-type" "disc" "circle" "square" "decimal" "decimal-leading-zero"
|
||||
"lower-roman" "upper-roman" "lower-greek" "lower-latin" "upper-latin"
|
||||
"armenian" "georgian" "lower-alpha" "upper-alpha" "none")
|
||||
("margin" margin-width)
|
||||
("margin-bottom" margin-width)
|
||||
("margin-left" margin-width)
|
||||
("margin-right" margin-width)
|
||||
("margin-top" margin-width)
|
||||
("max-height" length percentage "none")
|
||||
("max-width" length percentage "none")
|
||||
("min-height" length percentage)
|
||||
("min-width" length percentage)
|
||||
("orphans" integer)
|
||||
("outline" outline-color outline-style outline-width)
|
||||
("outline-color" color "invert")
|
||||
("outline-style" border-style)
|
||||
("outline-width" border-width)
|
||||
("overflow" "visible" "hidden" "scroll" "auto")
|
||||
("padding" padding-width)
|
||||
("padding-bottom" padding-width)
|
||||
("padding-left" padding-width)
|
||||
("padding-right" padding-width)
|
||||
("padding-top" padding-width)
|
||||
("page-break-after" "auto" "always" "avoid" "left" "right")
|
||||
("page-break-before" "auto" "always" "avoid" "left" "right")
|
||||
("page-break-inside" "avoid" "auto")
|
||||
("pause" time percentage)
|
||||
("pause-after" time percentage)
|
||||
("pause-before" time percentage)
|
||||
("pitch" frequency "x-low" "low" "medium" "high" "x-high")
|
||||
("pitch-range" number)
|
||||
("play-during" uri "mix" "repeat" "auto" "none")
|
||||
("position" "static" "relative" "absolute" "fixed")
|
||||
("quotes" string string "none")
|
||||
("richness" number)
|
||||
("right" length percentage "auto")
|
||||
("speak" "normal" "none" "spell-out")
|
||||
("speak-header" "once" "always")
|
||||
("speak-numeral" "digits" "continuous")
|
||||
("speak-punctuation" "code" "none")
|
||||
("speech-rate" number "x-slow" "slow" "medium" "fast" "x-fast" "faster"
|
||||
"slower")
|
||||
("stress" number)
|
||||
("table-layout" "auto" "fixed")
|
||||
("text-align" "left" "right" "center" "justify")
|
||||
("text-decoration" "none" "underline" "overline" "line-through" "blink")
|
||||
("text-indent" length percentage)
|
||||
("text-transform" "capitalize" "uppercase" "lowercase" "none")
|
||||
("top" length percentage "auto")
|
||||
("unicode-bidi" "normal" "embed" "bidi-override")
|
||||
("vertical-align" "baseline" "sub" "super" "top" "text-top" "middle"
|
||||
"bottom" "text-bottom" percentage length)
|
||||
("visibility" "visible" "hidden" "collapse")
|
||||
("voice-family" specific-voice generic-voice "*" specific-voice
|
||||
generic-voice)
|
||||
("volume" number percentage "silent" "x-soft" "soft" "medium" "loud"
|
||||
"x-loud")
|
||||
("white-space" "normal" "pre" "nowrap" "pre-wrap" "pre-line")
|
||||
("widows" integer)
|
||||
("width" length percentage "auto")
|
||||
("word-spacing" "normal" length)
|
||||
("z-index" "auto" integer))
|
||||
"A list of CSS properties and their possible values.")
|
||||
|
||||
(defconst ac-css-value-classes
|
||||
'((absolute-size "xx-small" "x-small" "small" "medium" "large" "x-large"
|
||||
"xx-large")
|
||||
(border-style "none" "hidden" "dotted" "dashed" "solid" "double" "groove"
|
||||
"ridge" "inset" "outset")
|
||||
(color "aqua" "black" "blue" "fuchsia" "gray" "green" "lime" "maroon" "navy"
|
||||
"olive" "orange" "purple" "red" "silver" "teal" "white" "yellow"
|
||||
"rgb")
|
||||
(counter "counter")
|
||||
(family-name "Courier" "Helvetica" "Times")
|
||||
(generic-family "serif" "sans-serif" "cursive" "fantasy" "monospace")
|
||||
(generic-voice "male" "female" "child")
|
||||
(margin-width "auto") ;; length percentage
|
||||
(relative-size "larger" "smaller")
|
||||
(shape "rect")
|
||||
(uri "url"))
|
||||
"A list of CSS property value classes and their contents.")
|
||||
|
||||
(defconst ac-css-pseudo-classes
|
||||
'("active" "after" "before" "first" "first-child" "first-letter" "first-line"
|
||||
"focus" "hover" "lang" "left" "link" "right" "visited")
|
||||
"Identifiers for CSS pseudo-elements and pseudo-classes.")
|
||||
|
||||
(defvar ac-css-property nil
|
||||
"Current editing property.")
|
||||
|
||||
(defun ac-css-prefix ()
|
||||
(when (save-excursion (re-search-backward "\\_<\\(.+?\\)\\_>\\s *:.*\\=" nil t))
|
||||
(setq ac-css-property (match-string 1))
|
||||
(or (ac-prefix-symbol) (point))))
|
||||
|
||||
(defun ac-css-property-candidates ()
|
||||
(or (loop with list = (assoc-default ac-css-property ac-css-property-alist)
|
||||
with value
|
||||
while (setq value (pop list))
|
||||
if (symbolp value)
|
||||
do (setq list
|
||||
(append list
|
||||
(or (assoc-default value ac-css-value-classes)
|
||||
(assoc-default (symbol-name value) ac-css-property-alist))))
|
||||
else collect value)
|
||||
ac-css-pseudo-classes))
|
||||
|
||||
(defvar ac-source-css-property
|
||||
'((candidates . ac-css-property-candidates)
|
||||
(prefix . ac-css-prefix)
|
||||
(requires . 0)))
|
||||
|
||||
|
||||
|
||||
;;;; Not maintained sources
|
||||
|
||||
;; ropemacs
|
||||
|
||||
(defvar ac-ropemacs-loaded nil)
|
||||
(defun ac-ropemacs-require ()
|
||||
(with-no-warnings
|
||||
(unless ac-ropemacs-loaded
|
||||
(pymacs-load "ropemacs" "rope-")
|
||||
(if (boundp 'ropemacs-enable-autoimport)
|
||||
(setq ropemacs-enable-autoimport t))
|
||||
(setq ac-ropemacs-loaded t))))
|
||||
|
||||
(defun ac-ropemacs-setup ()
|
||||
(ac-ropemacs-require)
|
||||
;(setq ac-sources (append (list 'ac-source-ropemacs) ac-sources))
|
||||
(setq ac-omni-completion-sources '(("\\." ac-source-ropemacs))))
|
||||
|
||||
(defun ac-ropemacs-initialize ()
|
||||
(autoload 'pymacs-apply "pymacs")
|
||||
(autoload 'pymacs-call "pymacs")
|
||||
(autoload 'pymacs-eval "pymacs" nil t)
|
||||
(autoload 'pymacs-exec "pymacs" nil t)
|
||||
(autoload 'pymacs-load "pymacs" nil t)
|
||||
(add-hook 'python-mode-hook 'ac-ropemacs-setup)
|
||||
t)
|
||||
|
||||
(defvar ac-ropemacs-completions-cache nil)
|
||||
(defvar ac-source-ropemacs
|
||||
'((init
|
||||
. (lambda ()
|
||||
(setq ac-ropemacs-completions-cache
|
||||
(mapcar
|
||||
(lambda (completion)
|
||||
(concat ac-prefix completion))
|
||||
(ignore-errors
|
||||
(rope-completions))))))
|
||||
(candidates . ac-ropemacs-completions-cache)))
|
||||
|
||||
;; rcodetools
|
||||
|
||||
(defvar ac-source-rcodetools
|
||||
'((init . (lambda ()
|
||||
(require 'rcodetools)
|
||||
(condition-case x
|
||||
(save-excursion
|
||||
(rct-exec-and-eval rct-complete-command-name "--completion-emacs-icicles"))
|
||||
(error) (setq rct-method-completion-table nil))))
|
||||
(candidates . (lambda ()
|
||||
(all-completions
|
||||
ac-prefix
|
||||
(mapcar
|
||||
(lambda (completion)
|
||||
(replace-regexp-in-string "\t.*$" "" (car completion)))
|
||||
rct-method-completion-table))))))
|
||||
|
||||
|
||||
|
||||
;;;; Default settings
|
||||
|
||||
(defun ac-common-setup ()
|
||||
(add-to-list 'ac-sources 'ac-source-filename))
|
||||
|
||||
(defun ac-emacs-lisp-mode-setup ()
|
||||
(setq ac-sources (append '(ac-source-features ac-source-functions ac-source-yasnippet ac-source-variables ac-source-symbols) ac-sources)))
|
||||
|
||||
(defun ac-cc-mode-setup ()
|
||||
(setq ac-sources (append '(ac-source-yasnippet ac-source-gtags) ac-sources)))
|
||||
|
||||
(defun ac-ruby-mode-setup ()
|
||||
(make-local-variable 'ac-ignores)
|
||||
(add-to-list 'ac-ignores "end"))
|
||||
|
||||
(defun ac-css-mode-setup ()
|
||||
(setq ac-sources (append '(ac-source-css-property) ac-sources)))
|
||||
|
||||
(defun ac-config-default ()
|
||||
(setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
|
||||
(add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
|
||||
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
|
||||
(add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
|
||||
(add-hook 'css-mode-hook 'ac-css-mode-setup)
|
||||
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
|
||||
(global-auto-complete-mode t))
|
||||
|
||||
(provide 'auto-complete-config)
|
||||
;;; auto-complete-config.el ends here
|
||||
BIN
.emacs.d/auto-complete/auto-complete-config.elc
Normal file
BIN
.emacs.d/auto-complete/auto-complete-config.elc
Normal file
Binary file not shown.
1897
.emacs.d/auto-complete/auto-complete.el
Normal file
1897
.emacs.d/auto-complete/auto-complete.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
.emacs.d/auto-complete/auto-complete.elc
Normal file
BIN
.emacs.d/auto-complete/auto-complete.elc
Normal file
Binary file not shown.
74
.emacs.d/auto-complete/dict/c++-mode
Normal file
74
.emacs.d/auto-complete/dict/c++-mode
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
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
|
||||
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
.emacs.d/auto-complete/dict/c-mode
Normal file
37
.emacs.d/auto-complete/dict/c-mode
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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
|
||||
475
.emacs.d/auto-complete/dict/clojure-mode
Normal file
475
.emacs.d/auto-complete/dict/clojure-mode
Normal file
|
|
@ -0,0 +1,475 @@
|
|||
*agent*
|
||||
*clojure-version*
|
||||
*command-line-args*
|
||||
*compile-files*
|
||||
*compile-path*
|
||||
*err*
|
||||
*file*
|
||||
*flush-on-newline*
|
||||
*in*
|
||||
*ns*
|
||||
*out*
|
||||
*print-dup*
|
||||
*print-length*
|
||||
*print-level*
|
||||
*print-meta*
|
||||
*print-readably*
|
||||
*read-eval*
|
||||
*warn-on-reflection*
|
||||
accessor
|
||||
aclone
|
||||
add-classpath
|
||||
add-watch
|
||||
agent
|
||||
agent-error
|
||||
agent-errors
|
||||
aget
|
||||
alength
|
||||
alias
|
||||
all-ns
|
||||
alter
|
||||
alter-meta!
|
||||
alter-var-root
|
||||
amap
|
||||
ancestors
|
||||
and
|
||||
apply
|
||||
areduce
|
||||
array-map
|
||||
aset
|
||||
aset-boolean
|
||||
aset-byte
|
||||
aset-char
|
||||
aset-double
|
||||
aset-float
|
||||
aset-int
|
||||
aset-long
|
||||
aset-short
|
||||
assert
|
||||
assoc
|
||||
assoc!
|
||||
assoc-in
|
||||
associative?
|
||||
atom
|
||||
await
|
||||
await-for
|
||||
bases
|
||||
bean
|
||||
bigdec
|
||||
bigint
|
||||
binding
|
||||
bit-and
|
||||
bit-and-not
|
||||
bit-clear
|
||||
bit-flip
|
||||
bit-not
|
||||
bit-or
|
||||
bit-set
|
||||
bit-shift-left
|
||||
bit-shift-right
|
||||
bit-test
|
||||
bit-xor
|
||||
boolean
|
||||
boolean-array
|
||||
booleans
|
||||
bound-fn
|
||||
bound-fn*
|
||||
butlast
|
||||
byte
|
||||
byte-array
|
||||
bytes
|
||||
case
|
||||
cast
|
||||
char
|
||||
char-array
|
||||
char-escape-string
|
||||
char-name-string
|
||||
char?
|
||||
chars
|
||||
class
|
||||
class?
|
||||
clear-agent-errors
|
||||
clojure-version
|
||||
coll?
|
||||
comment
|
||||
commute
|
||||
comp
|
||||
comparator
|
||||
compare
|
||||
compare-and-set!
|
||||
compile
|
||||
complement
|
||||
concat
|
||||
cond
|
||||
condp
|
||||
conj
|
||||
conj!
|
||||
cons
|
||||
constantly
|
||||
construct-proxy
|
||||
contains?
|
||||
count
|
||||
counted?
|
||||
create-ns
|
||||
create-struct
|
||||
cycle
|
||||
dec
|
||||
decimal?
|
||||
declare
|
||||
definline
|
||||
defmacro
|
||||
defmethod
|
||||
defmulti
|
||||
defn
|
||||
defn-
|
||||
defonce
|
||||
defprotocol
|
||||
defstruct
|
||||
deftype
|
||||
delay
|
||||
delay?
|
||||
deliver
|
||||
deref
|
||||
derive
|
||||
descendants
|
||||
disj
|
||||
disj!
|
||||
dissoc
|
||||
dissoc!
|
||||
distinct
|
||||
distinct?
|
||||
doall
|
||||
doc
|
||||
dorun
|
||||
doseq
|
||||
dosync
|
||||
dotimes
|
||||
doto
|
||||
double
|
||||
double-array
|
||||
doubles
|
||||
drop
|
||||
drop-last
|
||||
drop-while
|
||||
dtype
|
||||
empty
|
||||
empty?
|
||||
ensure
|
||||
enumeration-seq
|
||||
error-handler
|
||||
error-mode
|
||||
eval
|
||||
even?
|
||||
every?
|
||||
extend
|
||||
extend-class
|
||||
extend-protocol
|
||||
extend-type
|
||||
extenders
|
||||
extends?
|
||||
false?
|
||||
ffirst
|
||||
file-seq
|
||||
filter
|
||||
find
|
||||
find-doc
|
||||
find-ns
|
||||
find-var
|
||||
first
|
||||
float
|
||||
float-array
|
||||
float?
|
||||
floats
|
||||
flush
|
||||
fn
|
||||
fn?
|
||||
fnext
|
||||
for
|
||||
force
|
||||
format
|
||||
future
|
||||
future-call
|
||||
future-cancel
|
||||
future-cancelled?
|
||||
future-done?
|
||||
future?
|
||||
gen-class
|
||||
gen-interface
|
||||
gensym
|
||||
get
|
||||
get-in
|
||||
get-method
|
||||
get-proxy-class
|
||||
get-thread-bindings
|
||||
get-validator
|
||||
hash
|
||||
hash-map
|
||||
hash-set
|
||||
identical?
|
||||
identity
|
||||
if-let
|
||||
if-not
|
||||
ifn?
|
||||
import
|
||||
in-ns
|
||||
inc
|
||||
init-proxy
|
||||
instance?
|
||||
int
|
||||
int-array
|
||||
integer?
|
||||
interleave
|
||||
intern
|
||||
interpose
|
||||
into
|
||||
into-array
|
||||
ints
|
||||
io!
|
||||
isa?
|
||||
iterate
|
||||
iterator-seq
|
||||
juxt
|
||||
key
|
||||
keys
|
||||
keyword
|
||||
keyword?
|
||||
last
|
||||
lazy-cat
|
||||
lazy-seq
|
||||
let
|
||||
letfn
|
||||
line-seq
|
||||
list
|
||||
list*
|
||||
list?
|
||||
load
|
||||
load-file
|
||||
load-reader
|
||||
load-string
|
||||
loaded-libs
|
||||
locking
|
||||
long
|
||||
long-array
|
||||
longs
|
||||
loop
|
||||
macroexpand
|
||||
macroexpand-1
|
||||
make-array
|
||||
make-hierarchy
|
||||
map
|
||||
map?
|
||||
mapcat
|
||||
max
|
||||
max-key
|
||||
memfn
|
||||
memoize
|
||||
merge
|
||||
merge-with
|
||||
meta
|
||||
methods
|
||||
min
|
||||
min-key
|
||||
mod
|
||||
name
|
||||
namespace
|
||||
neg?
|
||||
newline
|
||||
next
|
||||
nfirst
|
||||
nil?
|
||||
nnext
|
||||
not
|
||||
not-any?
|
||||
not-empty
|
||||
not-every?
|
||||
not=
|
||||
ns
|
||||
ns-aliases
|
||||
ns-imports
|
||||
ns-interns
|
||||
ns-map
|
||||
ns-name
|
||||
ns-publics
|
||||
ns-refers
|
||||
ns-resolve
|
||||
ns-unalias
|
||||
ns-unmap
|
||||
nth
|
||||
nthnext
|
||||
num
|
||||
number?
|
||||
object-array
|
||||
odd?
|
||||
or
|
||||
parents
|
||||
partial
|
||||
partition
|
||||
pcalls
|
||||
peek
|
||||
persistent!
|
||||
pmap
|
||||
pop
|
||||
pop!
|
||||
pop-thread-bindings
|
||||
pos?
|
||||
pr
|
||||
pr-str
|
||||
prefer-method
|
||||
prefers
|
||||
print
|
||||
print-namespace-doc
|
||||
print-str
|
||||
printf
|
||||
println
|
||||
println-str
|
||||
prn
|
||||
prn-str
|
||||
promise
|
||||
proxy
|
||||
proxy-mappings
|
||||
proxy-super
|
||||
push-thread-bindings
|
||||
pvalues
|
||||
quot
|
||||
rand
|
||||
rand-int
|
||||
range
|
||||
ratio?
|
||||
rationalize
|
||||
re-find
|
||||
re-groups
|
||||
re-matcher
|
||||
re-matches
|
||||
re-pattern
|
||||
re-seq
|
||||
read
|
||||
read-line
|
||||
read-string
|
||||
reduce
|
||||
ref
|
||||
ref-history-count
|
||||
ref-max-history
|
||||
ref-min-history
|
||||
ref-set
|
||||
refer
|
||||
refer-clojure
|
||||
reify
|
||||
release-pending-sends
|
||||
rem
|
||||
remove
|
||||
remove-method
|
||||
remove-ns
|
||||
remove-watch
|
||||
repeat
|
||||
repeatedly
|
||||
replace
|
||||
replicate
|
||||
require
|
||||
reset!
|
||||
reset-meta!
|
||||
resolve
|
||||
rest
|
||||
restart-agent
|
||||
resultset-seq
|
||||
reverse
|
||||
reversible?
|
||||
rseq
|
||||
rsubseq
|
||||
satisfies?
|
||||
second
|
||||
select-keys
|
||||
send
|
||||
send-off
|
||||
seq
|
||||
seq?
|
||||
seque
|
||||
sequence
|
||||
sequential?
|
||||
set
|
||||
set-error-handler!
|
||||
set-error-mode!
|
||||
set-validator!
|
||||
set?
|
||||
short
|
||||
short-array
|
||||
shorts
|
||||
shutdown-agents
|
||||
slurp
|
||||
some
|
||||
sort
|
||||
sort-by
|
||||
sorted-map
|
||||
sorted-map-by
|
||||
sorted-set
|
||||
sorted-set-by
|
||||
sorted?
|
||||
special-form-anchor
|
||||
special-symbol?
|
||||
split-at
|
||||
split-with
|
||||
str
|
||||
stream?
|
||||
string?
|
||||
struct
|
||||
struct-map
|
||||
subs
|
||||
subseq
|
||||
subvec
|
||||
supers
|
||||
swap!
|
||||
symbol
|
||||
symbol?
|
||||
sync
|
||||
syntax-symbol-anchor
|
||||
take
|
||||
take-last
|
||||
take-nth
|
||||
take-while
|
||||
test
|
||||
the-ns
|
||||
time
|
||||
to-array
|
||||
to-array-2d
|
||||
trampoline
|
||||
transient
|
||||
tree-seq
|
||||
true?
|
||||
type
|
||||
unchecked-add
|
||||
unchecked-dec
|
||||
unchecked-divide
|
||||
unchecked-inc
|
||||
unchecked-multiply
|
||||
unchecked-negate
|
||||
unchecked-remainder
|
||||
unchecked-subtract
|
||||
underive
|
||||
update-in
|
||||
update-proxy
|
||||
use
|
||||
val
|
||||
vals
|
||||
var-get
|
||||
var-set
|
||||
var?
|
||||
vary-meta
|
||||
vec
|
||||
vector
|
||||
vector-of
|
||||
vector?
|
||||
when
|
||||
when-first
|
||||
when-let
|
||||
when-not
|
||||
while
|
||||
with-bindings
|
||||
with-bindings*
|
||||
with-in-str
|
||||
with-local-vars
|
||||
with-meta
|
||||
with-open
|
||||
with-out-str
|
||||
with-precision
|
||||
xml-seq
|
||||
zero?
|
||||
zipmap
|
||||
747
.emacs.d/auto-complete/dict/css-mode
Normal file
747
.emacs.d/auto-complete/dict/css-mode
Normal file
File diff suppressed because it is too large
Load diff
50
.emacs.d/auto-complete/dict/java-mode
Normal file
50
.emacs.d/auto-complete/dict/java-mode
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
abstract
|
||||
assert
|
||||
boolean
|
||||
break
|
||||
byte
|
||||
case
|
||||
catch
|
||||
char
|
||||
class
|
||||
const
|
||||
continue
|
||||
default
|
||||
do
|
||||
double
|
||||
else
|
||||
enum
|
||||
extends
|
||||
final
|
||||
finally
|
||||
float
|
||||
for
|
||||
goto
|
||||
if
|
||||
implements
|
||||
import
|
||||
instanceof
|
||||
int
|
||||
interface
|
||||
long
|
||||
native
|
||||
new
|
||||
package
|
||||
private
|
||||
protected
|
||||
public
|
||||
return
|
||||
short
|
||||
static
|
||||
strictfp
|
||||
super
|
||||
switch
|
||||
synchronized
|
||||
this
|
||||
throw
|
||||
throws
|
||||
transient
|
||||
try
|
||||
void
|
||||
volatile
|
||||
while
|
||||
148
.emacs.d/auto-complete/dict/javascript-mode
Normal file
148
.emacs.d/auto-complete/dict/javascript-mode
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
Anchor
|
||||
Area
|
||||
Array
|
||||
Boolean
|
||||
Button
|
||||
Checkbox
|
||||
Date
|
||||
Document
|
||||
Element
|
||||
FileUpload
|
||||
Form
|
||||
Frame
|
||||
Function
|
||||
Hidden
|
||||
History
|
||||
Image
|
||||
Infinity
|
||||
JavaArray
|
||||
JavaClass
|
||||
JavaObject
|
||||
JavaPackage
|
||||
Link
|
||||
Location
|
||||
Math
|
||||
MimeType
|
||||
NaN
|
||||
Navigator
|
||||
Number
|
||||
Object
|
||||
Option
|
||||
Packages
|
||||
Password
|
||||
Plugin
|
||||
Radio
|
||||
RegExp
|
||||
Reset
|
||||
Select
|
||||
String
|
||||
Submit
|
||||
Text
|
||||
Textarea
|
||||
Window
|
||||
alert
|
||||
arguments
|
||||
assign
|
||||
blur
|
||||
break
|
||||
callee
|
||||
caller
|
||||
captureEvents
|
||||
case
|
||||
clearInterval
|
||||
clearTimeout
|
||||
close
|
||||
closed
|
||||
comment
|
||||
confirm
|
||||
constructor
|
||||
continue
|
||||
default
|
||||
defaultStatus
|
||||
delete
|
||||
do
|
||||
document
|
||||
else
|
||||
escape
|
||||
eval
|
||||
export
|
||||
find
|
||||
focus
|
||||
for
|
||||
frames
|
||||
function
|
||||
getClass
|
||||
history
|
||||
home
|
||||
if
|
||||
import
|
||||
in
|
||||
innerHeight
|
||||
innerWidth
|
||||
isFinite
|
||||
isNan
|
||||
java
|
||||
label
|
||||
length
|
||||
location
|
||||
locationbar
|
||||
menubar
|
||||
moveBy
|
||||
moveTo
|
||||
name
|
||||
navigate
|
||||
navigator
|
||||
netscape
|
||||
new
|
||||
onBlur
|
||||
onError
|
||||
onFocus
|
||||
onLoad
|
||||
onUnload
|
||||
open
|
||||
opener
|
||||
outerHeight
|
||||
outerWidth
|
||||
pageXoffset
|
||||
pageYoffset
|
||||
parent
|
||||
parseFloat
|
||||
parseInt
|
||||
personalbar
|
||||
print
|
||||
prompt
|
||||
prototype
|
||||
ref
|
||||
releaseEvents
|
||||
resizeBy
|
||||
resizeTo
|
||||
return
|
||||
routeEvent
|
||||
scroll
|
||||
scrollBy
|
||||
scrollTo
|
||||
scrollbars
|
||||
self
|
||||
setInterval
|
||||
setTimeout
|
||||
status
|
||||
statusbar
|
||||
stop
|
||||
sun
|
||||
switch
|
||||
taint
|
||||
this
|
||||
toString
|
||||
toolbar
|
||||
top
|
||||
typeof
|
||||
unescape
|
||||
untaint
|
||||
unwatch
|
||||
valueOf
|
||||
var
|
||||
void
|
||||
watch
|
||||
while
|
||||
window
|
||||
with
|
||||
62
.emacs.d/auto-complete/dict/php-mode
Normal file
62
.emacs.d/auto-complete/dict/php-mode
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
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
|
||||
104
.emacs.d/auto-complete/dict/python-mode
Normal file
104
.emacs.d/auto-complete/dict/python-mode
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
__import__
|
||||
abs
|
||||
and
|
||||
any
|
||||
apply
|
||||
as
|
||||
assert
|
||||
basestring
|
||||
bin
|
||||
bool
|
||||
break
|
||||
buffer
|
||||
class
|
||||
cmp
|
||||
coerce
|
||||
complex
|
||||
continue
|
||||
def
|
||||
del
|
||||
delattr
|
||||
dict
|
||||
dir
|
||||
divmod
|
||||
elif
|
||||
else
|
||||
enumerate
|
||||
eval
|
||||
except
|
||||
exec
|
||||
execfile
|
||||
file
|
||||
filter
|
||||
finally
|
||||
float
|
||||
for
|
||||
format
|
||||
from
|
||||
frozenset
|
||||
getattr
|
||||
global
|
||||
globals
|
||||
hasattr
|
||||
hash
|
||||
help
|
||||
hex
|
||||
id
|
||||
if
|
||||
import
|
||||
in
|
||||
input
|
||||
int
|
||||
intern
|
||||
is
|
||||
isinstance
|
||||
issubclass
|
||||
iter
|
||||
lambda
|
||||
len
|
||||
list
|
||||
locals
|
||||
long
|
||||
map
|
||||
max
|
||||
min
|
||||
next
|
||||
not
|
||||
object
|
||||
oct
|
||||
open
|
||||
or
|
||||
ord
|
||||
pass
|
||||
pow
|
||||
print
|
||||
print
|
||||
property
|
||||
raise
|
||||
range
|
||||
raw_input
|
||||
reduce
|
||||
reload
|
||||
repr
|
||||
return
|
||||
reversed
|
||||
round
|
||||
set
|
||||
setattr
|
||||
slice
|
||||
sorted
|
||||
staticmethod
|
||||
str
|
||||
sum
|
||||
super
|
||||
try
|
||||
tuple
|
||||
type
|
||||
unichr
|
||||
unicode
|
||||
vars
|
||||
while
|
||||
with
|
||||
xrange
|
||||
yield
|
||||
zip
|
||||
181
.emacs.d/auto-complete/dict/ruby-mode
Normal file
181
.emacs.d/auto-complete/dict/ruby-mode
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
$!
|
||||
$"
|
||||
$$
|
||||
$&
|
||||
$'
|
||||
$*
|
||||
$+
|
||||
$,
|
||||
$-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
|
||||
216
.emacs.d/auto-complete/dict/scheme-mode
Normal file
216
.emacs.d/auto-complete/dict/scheme-mode
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
case-lambda
|
||||
call/cc
|
||||
class
|
||||
define-class
|
||||
exit-handler
|
||||
field
|
||||
import
|
||||
inherit
|
||||
init-field
|
||||
interface
|
||||
let*-values
|
||||
let-values
|
||||
let/ec
|
||||
mixin
|
||||
opt-lambda
|
||||
override
|
||||
protect
|
||||
provide
|
||||
public
|
||||
rename
|
||||
require
|
||||
require-for-syntax
|
||||
syntax
|
||||
syntax-case
|
||||
syntax-error
|
||||
unit/sig
|
||||
unless
|
||||
when
|
||||
with-syntax
|
||||
and
|
||||
begin
|
||||
call-with-current-continuation
|
||||
call-with-input-file
|
||||
call-with-output-file
|
||||
case
|
||||
cond
|
||||
define
|
||||
define-syntax
|
||||
delay
|
||||
do
|
||||
dynamic-wind
|
||||
else
|
||||
for-each
|
||||
if
|
||||
lambda
|
||||
let
|
||||
let*
|
||||
let-syntax
|
||||
letrec
|
||||
letrec-syntax
|
||||
map
|
||||
or
|
||||
syntax-rules
|
||||
abs
|
||||
acos
|
||||
angle
|
||||
append
|
||||
apply
|
||||
asin
|
||||
assoc
|
||||
assq
|
||||
assv
|
||||
atan
|
||||
boolean?
|
||||
caar
|
||||
cadr
|
||||
call-with-input-file
|
||||
call-with-output-file
|
||||
call-with-values
|
||||
car
|
||||
cdddar
|
||||
cddddr
|
||||
cdr
|
||||
ceiling
|
||||
char->integer
|
||||
char-alphabetic?
|
||||
char-ci<=?
|
||||
char-ci<?
|
||||
char-ci=?
|
||||
char-ci>=?
|
||||
char-ci>?
|
||||
char-downcase
|
||||
char-lower-case?
|
||||
char-numeric?
|
||||
char-ready?
|
||||
char-upcase
|
||||
char-upper-case?
|
||||
char-whitespace?
|
||||
char<=?
|
||||
char<?
|
||||
char=?
|
||||
char>=?
|
||||
char>?
|
||||
char?
|
||||
close-input-port
|
||||
close-output-port
|
||||
complex?
|
||||
cons
|
||||
cos
|
||||
current-input-port
|
||||
current-output-port
|
||||
denominator
|
||||
display
|
||||
eof-object?
|
||||
eq?
|
||||
equal?
|
||||
eqv?
|
||||
eval
|
||||
even?
|
||||
exact->inexact
|
||||
exact?
|
||||
exp
|
||||
expt
|
||||
#f
|
||||
floor
|
||||
force
|
||||
gcd
|
||||
imag-part
|
||||
inexact->exact
|
||||
inexact?
|
||||
input-port?
|
||||
integer->char
|
||||
integer?
|
||||
interaction-environment
|
||||
lcm
|
||||
length
|
||||
list
|
||||
list->string
|
||||
list->vector
|
||||
list-ref
|
||||
list-tail
|
||||
list?
|
||||
load
|
||||
log
|
||||
magnitude
|
||||
make-polar
|
||||
make-rectangular
|
||||
make-string
|
||||
make-vector
|
||||
max
|
||||
member
|
||||
memq
|
||||
memv
|
||||
min
|
||||
modulo
|
||||
negative?
|
||||
newline
|
||||
not
|
||||
null-environment
|
||||
null?
|
||||
number->string
|
||||
number?
|
||||
numerator
|
||||
odd?
|
||||
open-input-file
|
||||
open-output-file
|
||||
output-port?
|
||||
pair?
|
||||
peek-char
|
||||
port?
|
||||
positive?
|
||||
procedure?
|
||||
quasiquote
|
||||
quote
|
||||
quotient
|
||||
rational?
|
||||
rationalize
|
||||
read
|
||||
read-char
|
||||
real-part
|
||||
real?
|
||||
remainder
|
||||
reverse
|
||||
round
|
||||
scheme-report-environment
|
||||
set!
|
||||
set-car!
|
||||
set-cdr!
|
||||
sin
|
||||
sqrt
|
||||
string
|
||||
string->list
|
||||
string->number
|
||||
string->symbol
|
||||
string-append
|
||||
string-ci<=?
|
||||
string-ci<?
|
||||
string-ci=?
|
||||
string-ci>=?
|
||||
string-ci>?
|
||||
string-copy
|
||||
string-fill!
|
||||
string-length
|
||||
string-ref
|
||||
string-set!
|
||||
string<=?
|
||||
string<?
|
||||
string=?
|
||||
string>=?
|
||||
string>?
|
||||
string?
|
||||
substring
|
||||
symbol->string
|
||||
symbol?
|
||||
#t
|
||||
tan
|
||||
transcript-off
|
||||
transcript-on
|
||||
truncate
|
||||
values
|
||||
vector
|
||||
vector->list
|
||||
vector-fill!
|
||||
vector-length
|
||||
vector-ref
|
||||
vector-set!
|
||||
172
.emacs.d/auto-complete/dict/tcl-mode
Normal file
172
.emacs.d/auto-complete/dict/tcl-mode
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
after
|
||||
append
|
||||
apply
|
||||
array
|
||||
auto_execok
|
||||
auto_import
|
||||
auto_load
|
||||
auto_load_index
|
||||
auto_mkindex
|
||||
auto_mkindex_old
|
||||
auto_qualify
|
||||
auto_reset
|
||||
bell
|
||||
binary
|
||||
bind
|
||||
bindtags
|
||||
break
|
||||
button
|
||||
canvas
|
||||
case
|
||||
catch
|
||||
cd
|
||||
chan
|
||||
checkbutton
|
||||
clipboard
|
||||
clock
|
||||
close
|
||||
concat
|
||||
continue
|
||||
destroy
|
||||
dict
|
||||
encoding
|
||||
entry
|
||||
eof
|
||||
error
|
||||
eval
|
||||
event
|
||||
exec
|
||||
exit
|
||||
expr
|
||||
fblocked
|
||||
fconfigure
|
||||
fcopy
|
||||
file
|
||||
fileevent
|
||||
flush
|
||||
focus
|
||||
font
|
||||
for
|
||||
foreach
|
||||
format
|
||||
frame
|
||||
gets
|
||||
glob
|
||||
global
|
||||
grab
|
||||
grid
|
||||
if
|
||||
image
|
||||
incr
|
||||
info
|
||||
interp
|
||||
join
|
||||
label
|
||||
labelframe
|
||||
lappend
|
||||
lassign
|
||||
lindex
|
||||
linsert
|
||||
list
|
||||
listbox
|
||||
llength
|
||||
load
|
||||
lower
|
||||
lrange
|
||||
lrepeat
|
||||
lreplace
|
||||
lreverse
|
||||
lsearch
|
||||
lset
|
||||
lsort
|
||||
menu
|
||||
menubutton
|
||||
message
|
||||
namespace
|
||||
open
|
||||
option
|
||||
pack
|
||||
package
|
||||
panedwindow
|
||||
pid
|
||||
pkg_mkIndex
|
||||
place
|
||||
proc
|
||||
puts
|
||||
pwd
|
||||
radiobutton
|
||||
raise
|
||||
read
|
||||
regexp
|
||||
registry
|
||||
regsub
|
||||
rename
|
||||
return
|
||||
scale
|
||||
scan
|
||||
scrollbar
|
||||
seek
|
||||
selection
|
||||
set
|
||||
socket
|
||||
source
|
||||
spinbox
|
||||
split
|
||||
string
|
||||
subst
|
||||
switch
|
||||
tclLog
|
||||
tclPkgSetup
|
||||
tclPkgUnknown
|
||||
tcl_findLibrary
|
||||
tell
|
||||
text
|
||||
time
|
||||
tk
|
||||
tk_chooseColor
|
||||
tk_chooseDirectory
|
||||
tk_getOpenFile
|
||||
tk_getSaveFile
|
||||
tk_menuSetFocus
|
||||
tk_messageBox
|
||||
tk_popup
|
||||
tk_textCopy
|
||||
tk_textCut
|
||||
tk_textPaste
|
||||
tkwait
|
||||
toplevel
|
||||
ttk::button
|
||||
ttk::checkbutton
|
||||
ttk::combobox
|
||||
ttk::entry
|
||||
ttk::focusFirst
|
||||
ttk::frame
|
||||
ttk::label
|
||||
ttk::labelframe
|
||||
ttk::menubutton
|
||||
ttk::notebook
|
||||
ttk::paned
|
||||
ttk::panedwindow
|
||||
ttk::progressbar
|
||||
ttk::radiobutton
|
||||
ttk::scale
|
||||
ttk::scrollbar
|
||||
ttk::separator
|
||||
ttk::setTheme
|
||||
ttk::sizegrip
|
||||
ttk::style
|
||||
ttk::takefocus
|
||||
ttk::themes
|
||||
ttk::treeview
|
||||
trace
|
||||
unknown
|
||||
unload
|
||||
unset
|
||||
update
|
||||
uplevel
|
||||
upvar
|
||||
variable
|
||||
vwait
|
||||
while
|
||||
winfo
|
||||
wm
|
||||
BIN
.emacs.d/auto-complete/doc/ac-fuzzy.png
Normal file
BIN
.emacs.d/auto-complete/doc/ac-fuzzy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
.emacs.d/auto-complete/doc/ac-isearch.png
Normal file
BIN
.emacs.d/auto-complete/doc/ac-isearch.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
.emacs.d/auto-complete/doc/ac.png
Normal file
BIN
.emacs.d/auto-complete/doc/ac.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
96
.emacs.d/auto-complete/doc/changes.ja.txt
Normal file
96
.emacs.d/auto-complete/doc/changes.ja.txt
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
Title: Auto Complete Mode - 変更点
|
||||
CSS: style.css
|
||||
|
||||
Auto Complete Mode 変更点
|
||||
=========================
|
||||
|
||||
[Index](index.ja.txt)
|
||||
|
||||
\[[English](changes.txt)]
|
||||
|
||||
[ユーザーマニュアル](manual.ja.txt)も参照してください。
|
||||
|
||||
v1.3の変更点 {#Changes_v1.3}
|
||||
------------
|
||||
|
||||
v1.3の主な変更点は次のようになります。
|
||||
|
||||
### 新しいオプション ### {#New_Options_v1.3}
|
||||
|
||||
* [`ac-disable-faces`](manual.ja.txt#ac-disable-faces)
|
||||
* [`ac-show-menu-immediately-on-auto-complete`](manual.ja.txt#ac-show-menu-immediately-on-auto-complete)
|
||||
* [`ac-expand-on-auto-complete`](manual.ja.txt#ac-expand-on-auto-complete)
|
||||
* [`ac-use-menu-map`](manual.ja.txt#ac-use-menu-map)
|
||||
|
||||
### 新しい情報源 ### {#New_Sources_v1.3}
|
||||
|
||||
* [`ac-source-semantic-raw`](manual.ja.txt#ac-source-semantic-raw)
|
||||
* [`ac-source-css-property`](manual.ja.txt#ac-source-css-property)
|
||||
|
||||
### 新しい情報源のプロパティ ### {#New_Source_Properties_v1.3}
|
||||
|
||||
* [`summary`](manual.ja.txt#summary)
|
||||
* [`available`](manual.ja.txt#available)
|
||||
|
||||
### 新しい辞書 ### {#New_Dictionaries_v1.3}
|
||||
|
||||
* tcl-mode
|
||||
* scheme-mode
|
||||
|
||||
### 変更された挙動 ### {#Changed_Behaviors_v1.3}
|
||||
|
||||
* 補完候補の長さを考慮したスコアリング(文字列長でソート)
|
||||
|
||||
### 修正されたバグ ### {#Fixed_Bugs_v1.3}
|
||||
|
||||
* Emacs 22.1でのエラー
|
||||
* `flyspell-mode`との衝突(`M-x flyspell-workaround`で解決)
|
||||
|
||||
### その他 ### {#Others_v1.3}
|
||||
|
||||
* 単語収集の速度を改善 (#18)
|
||||
* [pos-tip.el](manual.ja.txt#.E3.83.98.E3.83.AB.E3.83.97.E3.82.92.E7.B6.BA.E9.BA.97.E3.81.AB.E8.A1.A8.E7.A4.BA.E3.81.99.E3.82.8B)との協調
|
||||
* Yasnippet 0.61のサポート
|
||||
* 多くのバグ修正
|
||||
|
||||
v1.2の変更点 {#Changes_v1.2}
|
||||
------------
|
||||
|
||||
v1.0からv1.2の主な変更点は次のようになります。
|
||||
|
||||
### 新機能 ### {#New_Features_v1.2}
|
||||
|
||||
* [曖昧マッチによる補完](manual.ja.txt#.E6.9B.96.E6.98.A7.E3.83.9E.E3.83.83.E3.83.81.E3.81.AB.E3.82.88.E3.82.8B.E8.A3.9C.E5.AE.8C)
|
||||
* [辞書による補完](manual.ja.txt#.E8.BE.9E.E6.9B.B8.E3.81.AB.E3.82.88.E3.82.8B.E8.A3.9C.E5.AE.8C)
|
||||
* [補完候補の絞り込み](manual.ja.txt#.E8.A3.9C.E5.AE.8C.E5.80.99.E8.A3.9C.E3.81.AE.E7.B5.9E.E3.82.8A.E8.BE.BC.E3.81.BF)
|
||||
* [補完推測機能](manual.ja.txt#.E8.A3.9C.E5.AE.8C.E6.8E.A8.E6.B8.AC.E6.A9.9F.E8.83.BD)
|
||||
* [トリガーキー](manual.ja.txt#.E3.83.88.E3.83.AA.E3.82.AC.E3.83.BC.E3.82.AD.E3.83.BC)
|
||||
* [ヘルプ](manual.ja.txt#.E3.83.98.E3.83.AB.E3.83.97)
|
||||
|
||||
### 新しいコマンド ### {#New_Commands_v1.2}
|
||||
|
||||
* [`auto-complete`](manual.ja.txt#auto-complete.E3.82.B3.E3.83.9E.E3.83.B3.E3.83.89)
|
||||
|
||||
### 新しいオプション ### {#New_Options_v1.2}
|
||||
|
||||
* [`ac-delay`](manual.ja.txt#ac-delay)
|
||||
* [`ac-auto-show-menu`](manual.ja.txt#ac-auto-show-menu)
|
||||
* [`ac-use-fuzzy`](manual.ja.txt#ac-use-fuzzy)
|
||||
* [`ac-use-comphist`](manual.ja.txt#ac-use-comphist)
|
||||
* [`ac-ignores`](manual.ja.txt#ac-ignores)
|
||||
* [`ac-ignore-case`](manual.ja.txt#ac-ignore-case)
|
||||
* [`ac-mode-map`](manual.ja.txt#ac-mode-map)
|
||||
|
||||
### 新しい情報源 ### {#New_Sources_v1.2}
|
||||
|
||||
* [`ac-source-dictionary`](manual.ja.txt#ac-source-dictionary)
|
||||
|
||||
### 変更された挙動 ### {#Changed_Behaviors_v1.2}
|
||||
|
||||
* 補完の開始が遅延されるようになりました ([`ac-delay`](manual.ja.txt#ac-delay))
|
||||
* 補完メニューの表示が遅延されるようになりました ([`ac-auto-show-menu`](manual.ja.txt#ac-auto-show-menu))
|
||||
|
||||
### その他 ### {#Others_v1.2}
|
||||
|
||||
* 多くのバグ修正
|
||||
* パフォーマンスの改善
|
||||
96
.emacs.d/auto-complete/doc/changes.txt
Normal file
96
.emacs.d/auto-complete/doc/changes.txt
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
Title: Auto Complete Mode - Changes
|
||||
CSS: style.css
|
||||
|
||||
Auto Complete Mode Changes
|
||||
==========================
|
||||
|
||||
[Index](index.txt)
|
||||
|
||||
\[[Japanese](changes.ja.txt)]
|
||||
|
||||
See also [documentation](manual.txt).
|
||||
|
||||
v1.3 Changes {#Changes_v1.3}
|
||||
------------
|
||||
|
||||
Major changes in v1.3.
|
||||
|
||||
### New Options ### {#New_Options_v1.3}
|
||||
|
||||
* [`ac-disable-faces`](manual.txt#ac-disable-faces)
|
||||
* [`ac-show-menu-immediately-on-auto-complete`](manual.txt#ac-show-menu-immediately-on-auto-complete)
|
||||
* [`ac-expand-on-auto-complete`](manual.txt#ac-expand-on-auto-complete)
|
||||
* [`ac-use-menu-map`](manual.txt#ac-use-menu-map)
|
||||
|
||||
### New Sources ### {#New_Sources_v1.3}
|
||||
|
||||
* [`ac-source-semantic-raw`](manual.txt#ac-source-semantic-raw)
|
||||
* [`ac-source-css-property`](manual.txt#ac-source-css-property)
|
||||
|
||||
### New Source Properties ### {#New_Source_Properties_v1.3}
|
||||
|
||||
* [`summary`](manual.txt#summary)
|
||||
* [`available`](manual.txt#available)
|
||||
|
||||
### New Dictionaries ### {#New_Dictionaries_v1.3}
|
||||
|
||||
* tcl-mode
|
||||
* scheme-mode
|
||||
|
||||
### Changed Behaviors ### {#Changed_Behaviors_v1.3}
|
||||
|
||||
* Scoring regarding to candidate length (sort by length)
|
||||
|
||||
### Fixed Bugs ### {#Fixed_Bugs_v1.3}
|
||||
|
||||
* Error on Emacs 22.1
|
||||
* `flyspell-mode` confliction (`M-x flyspell-workaround`)
|
||||
|
||||
### Others ### {#Others_v1.3}
|
||||
|
||||
* Improved word completion performance (#18)
|
||||
* Cooperate with [pos-tip.el](manual.txt#Show_help_beautifully)
|
||||
* Yasnippet 0.61 support
|
||||
* Fix many bugs
|
||||
|
||||
v1.2 Changes {#Changes_v1.2}
|
||||
------------
|
||||
|
||||
Major changes in v1.2 since v1.0.
|
||||
|
||||
### New Features ### {#New_Features_v1.2}
|
||||
|
||||
* [Completion by Fuzzy Matching](manual.txt#Completion_by_Fuzzy_Matching)
|
||||
* [Completion by Dictionary](manual.txt#Completion_by_Dictionary)
|
||||
* [Incremental Filtering](manual.txt#Filtering_Completion_Candidates)
|
||||
* [Intelligent Candidate Suggestion](manual.txt#Candidate_Suggestion)
|
||||
* [Trigger Key](manual.txt#Trigger_Key)
|
||||
* [Help](manual.txt#Help)
|
||||
|
||||
### New Commands ### {#New_Commands_v1.2}
|
||||
|
||||
* [`auto-complete`](manual.txt#auto-complete_command)
|
||||
|
||||
### New Options ### {#New_Options_v1.2}
|
||||
|
||||
* [`ac-delay`](manual.txt#ac-delay)
|
||||
* [`ac-auto-show-menu`](manual.txt#ac-auto-show-menu)
|
||||
* [`ac-use-fuzzy`](manual.txt#ac-use-fuzzy)
|
||||
* [`ac-use-comphist`](manual.txt#ac-use-comphist)
|
||||
* [`ac-ignores`](manual.txt#ac-ignores)
|
||||
* [`ac-ignore-case`](manual.txt#ac-ignore-case)
|
||||
* [`ac-mode-map`](manual.txt#ac-mode-map)
|
||||
|
||||
### New Sources ### {#New_Sources_v1.2}
|
||||
|
||||
* [`ac-source-dictionary`](manual.txt#ac-source-dictionary)
|
||||
|
||||
### Changed Behaviors ### {#Changed_Behaviors_v1.2}
|
||||
|
||||
* Completion is now delayed to start ([`ac-delay`](manual.txt#ac-delay))
|
||||
* Completion menu is now delayed to show ([`ac-auto-show-menu`](manual.txt#ac-auto-show-menu))
|
||||
|
||||
### Others ### {#Others_v1.2}
|
||||
|
||||
* Fix many bugs
|
||||
* Improve performance
|
||||
11
.emacs.d/auto-complete/doc/demo.txt
Normal file
11
.emacs.d/auto-complete/doc/demo.txt
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Title: Auto Complete Mode - Demo
|
||||
CSS: style.css
|
||||
|
||||
Auto Complete Mode Demo
|
||||
=======================
|
||||
|
||||
[Index](index.txt)
|
||||
|
||||
[YouTube mirror](http://www.youtube.com/watch?v=rGVVnDxwJYE)
|
||||
|
||||
<video src="ac-demo.ogv" controls="true" width="720" height="672" />
|
||||
86
.emacs.d/auto-complete/doc/index.ja.txt
Normal file
86
.emacs.d/auto-complete/doc/index.ja.txt
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
Title: Auto Complete Mode - GNU Emacsのための最も賢い自動補完機能
|
||||
CSS: style.css
|
||||
|
||||
Auto Complete Mode
|
||||
==================
|
||||
|
||||
*[GNU Emacs][]のための最も賢い自動補完機能*
|
||||
|
||||
\[[English](index.txt)]
|
||||
|
||||
* * * *
|
||||
|
||||
{toc}
|
||||
|
||||
* * * *
|
||||
|
||||
Auto Complete Modeとは
|
||||
----------------------
|
||||
|
||||
Auto Complete Modeは[GNU Emacs][]のための最も賢い自動補完機能です。従来の使いづらい補完インターフェースを一新し、ユーザーがより本質的な作業に集中できる環境を提供します。
|
||||
|
||||
特徴
|
||||
----
|
||||
|
||||
* 視覚的な操作感
|
||||
* 統計的手法による補完オーバーヘッドの削減
|
||||
* 拡張性
|
||||
|
||||
スクリーンショット
|
||||
------------------
|
||||
|
||||
  
|
||||
|
||||
デモ
|
||||
----
|
||||
|
||||
* [YouTube](http://www.youtube.com/watch?v=rGVVnDxwJYE)
|
||||
* [Ogg Theora with video tag](demo.txt)
|
||||
|
||||
ダウンロード
|
||||
------------
|
||||
|
||||
### 最新安定板 (v1.3) ### {#Latest_Stable}
|
||||
|
||||
[v1.3の変更点](changes.ja.txt#Changes_v1.3)
|
||||
|
||||
* [auto-complete-1.3.tar.bz2](http://cx4a.org/pub/auto-complete/auto-complete-1.3.tar.bz2)
|
||||
* [auto-complete-1.3.tar.zip](http://cx4a.org/pub/auto-complete/auto-complete-1.3.zip)
|
||||
|
||||
### v1.2 ###
|
||||
|
||||
[v1.2の変更点](changes.ja.txt#Changes_v1.2)
|
||||
|
||||
* [auto-complete-1.2.tar.bz2](http://cx4a.org/pub/auto-complete/auto-complete-1.2.tar.bz2)
|
||||
* [auto-complete-1.2.tar.zip](http://cx4a.org/pub/auto-complete/auto-complete-1.2.zip)
|
||||
|
||||
ユーザーマニュアル
|
||||
------------------
|
||||
|
||||
[Auto Complete Modeユーザーマニュアル](manual.ja.txt)
|
||||
|
||||
利用者の声
|
||||
----------
|
||||
|
||||
利用者の声をぜひお聞かせください。あなたの名前(匿名希望可)とコメントをそえて[tomo@cx4a.org](mailto: tomo@cx4a.org)までメールでお願いします。どんなコメントでも歓迎です。
|
||||
|
||||
ソースコード
|
||||
------------
|
||||
|
||||
ソースコードは以下のGitリポジトリから取得できます。
|
||||
|
||||
* <http://cx4a.org/repo/auto-complete.git>
|
||||
* <http://github.com/m2ym/auto-complete> (GitHubミラー)
|
||||
|
||||
バグレポート
|
||||
------------
|
||||
|
||||
[Auto Complete Modeのバグトラッキングシステム](http://cx4a.org/redmine/projects/auto-complete-mode)に新しいチケットを登録してください。
|
||||
|
||||
ライセンス
|
||||
----------
|
||||
|
||||
このソフトウェアは[GPLv3][]のもとで配布されます。
|
||||
|
||||
[GNU Emacs]: http://www.gnu.org/software/emacs/
|
||||
[GPLv3]: http://gplv3.fsf.org/
|
||||
86
.emacs.d/auto-complete/doc/index.txt
Normal file
86
.emacs.d/auto-complete/doc/index.txt
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
Title: Auto Complete Mode - The most intelligent auto-completion extension for GNU Emacs
|
||||
CSS: style.css
|
||||
|
||||
Auto Complete Mode
|
||||
==================
|
||||
|
||||
*The most intelligent auto-completion extension for [GNU Emacs][]*
|
||||
|
||||
\[[Japanese](index.ja.txt)]
|
||||
|
||||
* * * *
|
||||
|
||||
{toc}
|
||||
|
||||
* * * *
|
||||
|
||||
What is Auto Complete Mode?
|
||||
---------------------------
|
||||
|
||||
Auto Complete Mode is the most intelligent auto-completion extension for [GNU Emacs][]. Auto Complete Mode renews an old completion interface and provides an environment that makes users could be more concentrate on their own works.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Visual interface
|
||||
* Reduce overhead of completion by using statistic method
|
||||
* Extensibility
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
|
||||
  
|
||||
|
||||
Demo
|
||||
----
|
||||
|
||||
* [YouTube](http://www.youtube.com/watch?v=rGVVnDxwJYE)
|
||||
* [Ogg Theora with video tag](demo.txt)
|
||||
|
||||
Downloads
|
||||
---------
|
||||
|
||||
### Latest Stable (v1.3) ### {#Latest_Stable}
|
||||
|
||||
[Changes v1.3](changes.txt#Changes_v1.3)
|
||||
|
||||
* [auto-complete-1.3.tar.bz2](/pub/auto-complete/auto-complete-1.3.tar.bz2)
|
||||
* [auto-complete-1.3.zip](/pub/auto-complete/auto-complete-1.3.zip)
|
||||
|
||||
### v1.2 ###
|
||||
|
||||
[Changes v1.2](changes.txt#Changes_v1.2)
|
||||
|
||||
* [auto-complete-1.2.tar.bz2](/pub/auto-complete/auto-complete-1.2.tar.bz2)
|
||||
* [auto-complete-1.2.zip](/pub/auto-complete/auto-complete-1.2.zip)
|
||||
|
||||
User Manual
|
||||
-----------
|
||||
|
||||
[Auto Complete Mode User Manual](manual.txt)
|
||||
|
||||
User's Voice
|
||||
------------
|
||||
|
||||
Please send me a comment with your name (or anonymous) to [tomo@cx4a.org](mailto: tomo@cx4a.org) if you like it. Any comments are welcome.
|
||||
|
||||
Source Code
|
||||
-----------
|
||||
|
||||
Git repositories are available:
|
||||
|
||||
* <http://cx4a.org/repo/auto-complete.git>
|
||||
* <http://github.com/m2ym/auto-complete> (GitHub mirror)
|
||||
|
||||
Reporting Bugs
|
||||
--------------
|
||||
|
||||
Visit [Auto Complete Mode Bug Tracking System](http://cx4a.org/redmine/projects/auto-complete-mode) and create a new ticket.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This software is distributed under the term of [GPLv3][]+.
|
||||
|
||||
[GNU Emacs]: http://www.gnu.org/software/emacs/
|
||||
[GPLv3]: http://gplv3.fsf.org/
|
||||
1067
.emacs.d/auto-complete/doc/manual.ja.txt
Normal file
1067
.emacs.d/auto-complete/doc/manual.ja.txt
Normal file
File diff suppressed because it is too large
Load diff
1062
.emacs.d/auto-complete/doc/manual.txt
Normal file
1062
.emacs.d/auto-complete/doc/manual.txt
Normal file
File diff suppressed because it is too large
Load diff
27
.emacs.d/auto-complete/doc/style.css
Normal file
27
.emacs.d/auto-complete/doc/style.css
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
body {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0.5em 2em;
|
||||
padding: 0.5em;
|
||||
background-color: #eee;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
table {
|
||||
margin-left: 1em;
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
td, th {
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
td {
|
||||
background-color: white;
|
||||
}
|
||||
45
.emacs.d/auto-complete/etc/install.el
Normal file
45
.emacs.d/auto-complete/etc/install.el
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
(require 'cl)
|
||||
|
||||
(when (or (not (featurep 'auto-complete))
|
||||
(yes-or-no-p "You are trying to upgrade auto-complete within an existed Emacs which has loaded its older version.
|
||||
It causes sometimes errors or installation fault. Are you sure? "))
|
||||
(let* ((basedir (file-name-directory (directory-file-name (file-name-directory load-file-name))))
|
||||
(default-dir "~/.emacs.d/")
|
||||
(todir (or (car command-line-args-left)
|
||||
(read-file-name "Install to: " default-dir default-dir)))
|
||||
(basedictdir (concat basedir "/dict"))
|
||||
(todictdir (concat todir "/ac-dict")))
|
||||
(cond
|
||||
((not (file-directory-p basedir))
|
||||
(error "Base directory is not found"))
|
||||
((or (eq (length todir) 0)
|
||||
(not (file-directory-p todir)))
|
||||
(error "To directory is empty or not found"))
|
||||
(t
|
||||
(message "Installing to %s from %s" todir basedir)
|
||||
(add-to-list 'load-path basedir)
|
||||
(make-directory todictdir t)
|
||||
(loop for file in (directory-files basedir t "^.*\\.el$")
|
||||
do (byte-compile-file file))
|
||||
(loop for file in (directory-files basedir t "^.*\\.elc?$")
|
||||
do (copy-file file todir t))
|
||||
(loop for file in (directory-files basedictdir t "^[^\\.]")
|
||||
do (copy-file file todictdir t))
|
||||
|
||||
(let ((msg (concat "Successfully installed!
|
||||
|
||||
Add the following code to your .emacs:
|
||||
|
||||
"
|
||||
(if (and (not (member (expand-file-name todir) load-path))
|
||||
(not (member (concat (expand-file-name todir) "/") load-path)))
|
||||
(format "(add-to-list 'load-path \"%s\")\n" todir)
|
||||
"")
|
||||
"(require 'auto-complete-config)\n"
|
||||
(format "(add-to-list 'ac-dictionary-directories \"%s\")\n" todictdir)
|
||||
"(ac-config-default)\n")))
|
||||
(if noninteractive
|
||||
(princ-list msg)
|
||||
(switch-to-buffer "*Installation Result*")
|
||||
(erase-buffer)
|
||||
(insert msg)))))))
|
||||
202
.emacs.d/auto-complete/etc/test.txt
Normal file
202
.emacs.d/auto-complete/etc/test.txt
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
-*- org -*-
|
||||
|
||||
* How to test
|
||||
You can read this testcase document by following some rules.
|
||||
|
||||
- (Code) is a code you should evaluate for testing the fixture.
|
||||
- (Expect) is a expected result of your test.
|
||||
If no (Expect) is given, it means Emacs doesn't display any errors.
|
||||
- (Assume) is a code you should evaluate before test.
|
||||
|
||||
If no sources you should use are not given in each fixture, we assumes that
|
||||
you use following sources.
|
||||
|
||||
Code:
|
||||
(defvar ac-source-test
|
||||
'((candidates list "Foo" "FooBar" "Bar" "Baz" "LongLongLine")))
|
||||
(defvar ac-source-action-test
|
||||
'((candidates list "Action1" "Action2")
|
||||
(action . (lambda () (message "Done!")))))
|
||||
(setq ac-sources '(ac-source-test ac-source-action-test))
|
||||
|
||||
* Setup
|
||||
|
||||
** Load auto-complete
|
||||
Code:
|
||||
(require 'auto-complete)
|
||||
(require 'auto-complete-config)
|
||||
|
||||
** Enable/disable auto-complete by M-x auto-complete-mode
|
||||
|
||||
** Use global-auto-complete-mode
|
||||
Code:
|
||||
(global-auto-complete-mode t)
|
||||
|
||||
Expect:
|
||||
No errors. auto-complete-mode will be enabled automatically.
|
||||
|
||||
* Auto-completion
|
||||
|
||||
** Type some string at *scratch* buffer
|
||||
Expect:
|
||||
Menu contains words in the current buffer.
|
||||
|
||||
** Type some string at right of the window
|
||||
Expect:
|
||||
Menu will be shown in right-to-left direction without any window scrolling.
|
||||
|
||||
** Continue to type some string above case
|
||||
Expect:
|
||||
Menu will never be disrupted.
|
||||
|
||||
** Type some string at the right of window with truncate-lines enabled
|
||||
Assume:
|
||||
(setq truncate-lines t)
|
||||
|
||||
** Type some string at the bottom of window
|
||||
Expect:
|
||||
Menu will be shown in bottom-to-top direction without any window scrolling.
|
||||
|
||||
** Delete a character at the word
|
||||
Expect:
|
||||
Completion will be started.
|
||||
|
||||
** Type some string so that a menu overlaps the end of buffer that doesn't have newline at the end
|
||||
Expect:
|
||||
Menu will be shown correctly.
|
||||
Newline at the end is not seen.
|
||||
|
||||
** Type some string with ac-auto-start nil
|
||||
Assume:
|
||||
(setq ac-auto-start nil)
|
||||
|
||||
Expect:
|
||||
Completion will never be started automatically.
|
||||
|
||||
** Type some string with ac-auto-start t
|
||||
Assume:
|
||||
(setq ac-auto-start t)
|
||||
|
||||
Expect:
|
||||
Completion will be started automatically if possible.
|
||||
|
||||
** Type 1 character with ac-auto-start 2
|
||||
Assume:
|
||||
(setq ac-auto-start 2)
|
||||
|
||||
Expect:
|
||||
Completion will never be started automatically.
|
||||
|
||||
** Type 2 characters with ac-auto-start 2
|
||||
Assume:
|
||||
(setq ac-auto-start 2)
|
||||
|
||||
Expect:
|
||||
Completion will be started automatically if possible.
|
||||
|
||||
** Type F
|
||||
Expect:
|
||||
Menu contains "Foo" and "FooBar" as candidates.
|
||||
Inline completion appears and it contains "oo" as common-part.
|
||||
|
||||
** Type TAB while completion with ac-dwim disabled
|
||||
Assume:
|
||||
(setq ac-dwim nil)
|
||||
|
||||
Expect:
|
||||
(a) If there is common-part of candidates, auto-complete expands it.
|
||||
(b) If the prefix equals to the first of candidates, auto-complete selects next candidate.
|
||||
(c) Othewise, auto-complete expands selected candidate.
|
||||
|
||||
** Type TAB while completion with ac-dwim enabled
|
||||
Assume:
|
||||
(setq ac-dwim t)
|
||||
|
||||
Expect:
|
||||
(a) If there is common-part of candidates, auto-complete expands it.
|
||||
(b) If only one candidate remains, or if it is done after selecting be ac-previous/ac-next,
|
||||
auto-complete simulates ac-complete.
|
||||
- If its candidate has an action, the action will be invoked. ("Action1" and "Action2" have an action)
|
||||
- Expand its candidate.
|
||||
(c) If the prefix equals to the first of candidates, auto-complete selects next candidate.
|
||||
(d) Othewise, auto-complete expands selected candidate.
|
||||
|
||||
** Type RET while completion
|
||||
Expect:
|
||||
Completion will be done for selected candidate.
|
||||
If its candidate has an action, the action will be invoked.
|
||||
Use "Action" for the prefix for test.
|
||||
|
||||
* Configuration
|
||||
|
||||
** Change menu height
|
||||
Code:
|
||||
(setq ac-menu-height 20)
|
||||
|
||||
Expect:
|
||||
Up to 20 candidates will be shown in a menu.
|
||||
|
||||
** Use trigger key facility
|
||||
Code:
|
||||
(ac-set-trigger-key "TAB")
|
||||
|
||||
Expect:
|
||||
Now you can use TAB for auto-completion.
|
||||
It is enabled only when
|
||||
(a) After insertion/deletion command
|
||||
(b) With prefix (C-u TAB)
|
||||
Otherwise, it behaves as default.
|
||||
Generally, it is used with ac-auto-start disabled.
|
||||
|
||||
** Use ac-mode-map
|
||||
Code:
|
||||
(define-key ac-mode-map (kbd "M-TAB") 'auto-complete)
|
||||
|
||||
Expect:
|
||||
Now you can start auto-complete with typing M-TAB anywhere.
|
||||
|
||||
** Change default ac-sources
|
||||
Code:
|
||||
(setq-default ac-sources '(ac-source-words-in-all-buffer))
|
||||
|
||||
Expect:
|
||||
Now default ac-sources has been changed for newly opened buffers.
|
||||
|
||||
* Builtin sources
|
||||
|
||||
** ac-source-words-in-buffer
|
||||
Expect:
|
||||
Candidates will be words in the current buffer.
|
||||
|
||||
** ac-source-words-in-all-buffer
|
||||
Expect:
|
||||
Candidates will be words in all buffer.
|
||||
|
||||
** ac-source-words-in-same-mode-buffers
|
||||
Expect:
|
||||
Candidates will be words for buffers which major-mode same to
|
||||
the current buffer's one.
|
||||
|
||||
** ac-source-symbols
|
||||
Expect:
|
||||
Candidates will be all Emacs Lisp symbols.
|
||||
|
||||
** ac-source-abbrev
|
||||
Expect:
|
||||
Candidates will be abbreviations of local-abbrev-table and global-abbrev-table.
|
||||
|
||||
** ac-source-files-in-current-dir
|
||||
Expect:
|
||||
Candidates will be files contained by the current directory (default-directory).
|
||||
|
||||
** ac-source-filename
|
||||
Expect:
|
||||
Candidates will be absolute/relative file name.
|
||||
This source will be executed when the prefix seems to be file name.
|
||||
That is, the prefix contains slash (/) and a string between first to
|
||||
last flash is a valid directory.
|
||||
When ac-complete, this continues to complete if the prefix is a valid directory.
|
||||
|
||||
** ac-source-imenu
|
||||
Expect:
|
||||
Candidates will be a node of imenu tree.
|
||||
255
.emacs.d/auto-complete/fuzzy.el
Normal file
255
.emacs.d/auto-complete/fuzzy.el
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
;;; fuzzy.el --- Fuzzy matching utilities
|
||||
|
||||
;; Copyright (C) 2010 Tomohiro Matsuyama
|
||||
|
||||
;; Author: Tomohiro Matsuyama <m2ym.pub@gmail.com>
|
||||
;; Keywords: convenience
|
||||
|
||||
;; 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:
|
||||
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
(require 'regexp-opt)
|
||||
|
||||
(defgroup fuzzy nil
|
||||
"Fuzzy matching utilities."
|
||||
:group 'convenience
|
||||
:prefix "fuzzy-")
|
||||
|
||||
(defcustom fuzzy-accept-error-rate 0.10
|
||||
"Error threshold."
|
||||
:group 'fuzzy)
|
||||
|
||||
(defvar fuzzy-accept-length-difference 2)
|
||||
|
||||
(defvar fuzzy-regexp-some-char (format "\\w\\{0,%s\\}" fuzzy-accept-length-difference))
|
||||
|
||||
|
||||
|
||||
;;; Functions
|
||||
|
||||
(defun fuzzy-reverse-string (string)
|
||||
(apply 'string (nreverse (append string nil))))
|
||||
|
||||
(defun fuzzy-regexp-compile (string)
|
||||
(labels ((oddp (n) (eq (logand n 1) 1))
|
||||
(evenp (n) (eq (logand n 1) 0))
|
||||
(opt (n) (regexp-opt-charset (append (substring string
|
||||
(max 0 (- n 1))
|
||||
(min (length string) (+ n 2))) nil))))
|
||||
(concat
|
||||
"\\("
|
||||
(loop for i below (length string)
|
||||
for c = (if (evenp i) (opt i) fuzzy-regexp-some-char)
|
||||
concat c)
|
||||
"\\|"
|
||||
(loop for i below (length string)
|
||||
for c = (if (oddp i) (opt i) fuzzy-regexp-some-char)
|
||||
concat c)
|
||||
"\\)")))
|
||||
|
||||
(defalias 'fuzzy-edit-distance 'fuzzy-jaro-winkler-distance)
|
||||
|
||||
(defun fuzzy-jaro-winkler-distance (s1 s2)
|
||||
"http://en.wikipedia.org/wiki/Jaro-Winkler_distance"
|
||||
(let* ((l1 (length s1))
|
||||
(l2 (length s2))
|
||||
(r (max 1 (1- (/ (max l1 l2) 2))))
|
||||
(m 0)
|
||||
(tr 0)
|
||||
(p 0)
|
||||
cs1 cs2)
|
||||
(loop with seen = (make-vector l2 nil)
|
||||
for i below l1
|
||||
for c1 = (aref s1 i) do
|
||||
(loop for j from (max 0 (- i r)) below (min l2 (+ i r))
|
||||
for c2 = (aref s2 j)
|
||||
if (and (char-equal c1 c2)
|
||||
(null (aref seen j))) do
|
||||
(push c1 cs1)
|
||||
(aset seen j c2)
|
||||
(incf m)
|
||||
and return nil)
|
||||
finally
|
||||
(setq cs1 (nreverse cs1)
|
||||
cs2 (loop for i below l2
|
||||
for c = (aref seen i)
|
||||
if c collect c)))
|
||||
(loop for c1 in cs1
|
||||
for c2 in cs2
|
||||
if (not (char-equal c1 c2)) do
|
||||
(incf tr))
|
||||
(loop for i below (min m 5)
|
||||
for c1 across s1
|
||||
for c2 across s2
|
||||
while (char-equal c1 c2) do
|
||||
(incf p))
|
||||
(if (eq m 0)
|
||||
0.0
|
||||
(setq m (float m))
|
||||
(let* ((dj (/ (+ (/ m l1) (/ m l2) (/ (- m (/ tr 2)) m)) 3))
|
||||
(dw (+ dj (* p 0.1 (- 1 dj)))))
|
||||
dw))))
|
||||
|
||||
;; this function should be compiled
|
||||
(byte-compile 'fuzzy-jaro-winkler-distance)
|
||||
|
||||
(defun fuzzy-match (s1 s2 &optional function)
|
||||
(or function (setq function 'fuzzy-edit-distance))
|
||||
(and (<= (abs (- (length s1) (length s2)))
|
||||
fuzzy-accept-length-difference)
|
||||
(>= (funcall function s1 s2)
|
||||
(- 1 fuzzy-accept-error-rate))))
|
||||
|
||||
(defun fuzzy-all-completions (string collection)
|
||||
"all-completions family with fuzzy matching."
|
||||
(loop with length = (length string)
|
||||
for str in collection
|
||||
for s = (substring str 0 (min (length str)
|
||||
(+ length fuzzy-accept-length-difference)))
|
||||
if (fuzzy-match string s)
|
||||
collect str))
|
||||
|
||||
|
||||
|
||||
;;; Search and Incremental Search
|
||||
|
||||
(defvar fuzzy-search-cache nil)
|
||||
(defvar fuzzy-search-cache-string nil)
|
||||
|
||||
(defun fuzzy-search-cache-activate ()
|
||||
(setq fuzzy-search-cache (make-hash-table))
|
||||
(setq fuzzy-search-cache-string nil))
|
||||
|
||||
(defun fuzzy-search-cache-deactive ()
|
||||
(setq fuzzy-search-cache nil)
|
||||
(setq fuzzy-search-cache-string nil))
|
||||
|
||||
(defun fuzzy-search-edit-distance (s1 s2)
|
||||
(or (and fuzzy-search-cache
|
||||
(cond
|
||||
((null fuzzy-search-cache-string)
|
||||
(setq fuzzy-search-cache-string s1)
|
||||
nil)
|
||||
((not (equal fuzzy-search-cache-string s1))
|
||||
(setq fuzzy-search-cache-string s1)
|
||||
(clrhash fuzzy-search-cache)
|
||||
nil)
|
||||
(t))
|
||||
(gethash s2 fuzzy-search-cache))
|
||||
(let ((d (fuzzy-edit-distance s1 s2)))
|
||||
(if fuzzy-search-cache
|
||||
(puthash s2 d fuzzy-search-cache))
|
||||
d)))
|
||||
|
||||
(defun fuzzy-search-match (s1 s2)
|
||||
(fuzzy-match s1 s2 'fuzzy-search-edit-distance))
|
||||
|
||||
(defun fuzzy-search-forward (string &optional bound noerror count)
|
||||
(let* ((regexp (fuzzy-regexp-compile string))
|
||||
match-data)
|
||||
(save-excursion
|
||||
(while (and (null match-data)
|
||||
(re-search-forward regexp bound t))
|
||||
(if (fuzzy-search-match string (match-string 1))
|
||||
(setq match-data (match-data))
|
||||
(goto-char (1+ (match-beginning 1))))))
|
||||
(when match-data
|
||||
(store-match-data match-data)
|
||||
(goto-char (match-end 1)))))
|
||||
|
||||
(defun fuzzy-search-backward (string &optional bound noerror count)
|
||||
(let* ((regexp (fuzzy-regexp-compile string))
|
||||
match-data begin end)
|
||||
(save-excursion
|
||||
(while (and (null match-data)
|
||||
(re-search-backward regexp bound t))
|
||||
(setq begin (match-beginning 1)
|
||||
end (match-end 1))
|
||||
(store-match-data nil)
|
||||
(goto-char (max (point-min) (- begin (* (length string) 2))))
|
||||
(while (re-search-forward regexp end t)
|
||||
(if (fuzzy-search-match string (match-string 1))
|
||||
(setq match-data (match-data))
|
||||
(goto-char (1+ (match-beginning 1)))))
|
||||
(unless match-data
|
||||
(goto-char begin)))
|
||||
(if match-data
|
||||
(progn
|
||||
(store-match-data match-data)
|
||||
(goto-char (match-beginning 1)))
|
||||
(store-match-data nil)))))
|
||||
|
||||
(defvar fuzzy-isearch nil)
|
||||
(defvar fuzzy-isearch-failed-count 0)
|
||||
(defvar fuzzy-isearch-enabled 'on-failed)
|
||||
(defvar fuzzy-isearch-original-search-fun nil)
|
||||
(defvar fuzzy-isearch-prefix "[FUZZY] ")
|
||||
|
||||
(defun fuzzy-isearch-activate ()
|
||||
(setq fuzzy-isearch t)
|
||||
(setq fuzzy-isearch-failed-count 0)
|
||||
(fuzzy-search-cache-activate))
|
||||
|
||||
(defun fuzzy-isearch-deactivate ()
|
||||
(setq fuzzy-isearch nil)
|
||||
(setq fuzzy-isearch-failed-count 0)
|
||||
(fuzzy-search-cache-deactive))
|
||||
|
||||
(defun fuzzy-isearch ()
|
||||
(cond (isearch-word
|
||||
(if isearch-forward 'word-search-forward 'word-search-backward))
|
||||
(isearch-regexp
|
||||
(if isearch-forward 're-search-forward 're-search-backward))
|
||||
((or fuzzy-isearch
|
||||
(eq fuzzy-isearch-enabled 'always)
|
||||
(and (eq fuzzy-isearch-enabled 'on-failed)
|
||||
(null isearch-success)
|
||||
isearch-wrapped
|
||||
(> (setq fuzzy-isearch-failed-count (1+ fuzzy-isearch-failed-count))
|
||||
1)))
|
||||
(unless fuzzy-isearch
|
||||
;(goto-char isearch-opoint)
|
||||
(fuzzy-isearch-activate))
|
||||
(if isearch-forward 'fuzzy-search-forward 'fuzzy-search-backward))
|
||||
(t
|
||||
(if isearch-forward 'search-forward 'search-backward))))
|
||||
|
||||
(defun fuzzy-isearch-end-hook ()
|
||||
(fuzzy-isearch-deactivate))
|
||||
|
||||
(defun turn-on-fuzzy-isearch ()
|
||||
(interactive)
|
||||
(setq fuzzy-isearch-original-search-fun isearch-search-fun-function)
|
||||
(setq isearch-search-fun-function 'fuzzy-isearch)
|
||||
(add-hook 'isearch-mode-end-hook 'fuzzy-isearch-end-hook))
|
||||
|
||||
(defun turn-off-fuzzy-isearch ()
|
||||
(interactive)
|
||||
(setq isearch-search-fun-function fuzzy-isearch-original-search-fun)
|
||||
(remove-hook 'isearch-mode-end-hook 'fuzzy-isearch-end-hook))
|
||||
|
||||
(defadvice isearch-message-prefix (after fuzzy-isearch-message-prefix activate)
|
||||
(if fuzzy-isearch
|
||||
(setq ad-return-value (concat fuzzy-isearch-prefix ad-return-value))
|
||||
ad-return-value))
|
||||
|
||||
(provide 'fuzzy)
|
||||
;;; fuzzy.el ends here
|
||||
BIN
.emacs.d/auto-complete/fuzzy.elc
Normal file
BIN
.emacs.d/auto-complete/fuzzy.elc
Normal file
Binary file not shown.
1061
.emacs.d/auto-complete/popup.el
Normal file
1061
.emacs.d/auto-complete/popup.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
.emacs.d/auto-complete/popup.elc
Normal file
BIN
.emacs.d/auto-complete/popup.elc
Normal file
Binary file not shown.
159
.emacs.d/color-theme-autoloads.el
Normal file
159
.emacs.d/color-theme-autoloads.el
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
;;; -*-emacs-lisp-*-
|
||||
|
||||
;; Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
(defvar generated-autoload-file)
|
||||
(defvar command-line-args-left)
|
||||
(defun color-theme-generate-autoloads ()
|
||||
(interactive)
|
||||
(require 'autoload)
|
||||
(setq generated-autoload-file (car command-line-args-left))
|
||||
(setq command-line-args-left (cdr command-line-args-left))
|
||||
(batch-update-autoloads))
|
||||
|
||||
(provide 'color-theme-autoloads)
|
||||
;;; Generated autoloads follow (made by autoload.el).
|
||||
|
||||
;;;### (autoloads nil nil ("themes/color-theme-example.el" "themes/color-theme-library.el")
|
||||
;;;;;; (19535 4173 130526))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads (color-theme-initialize color-theme-submit color-theme-install
|
||||
;;;;;; color-theme-compare color-theme-make-snapshot color-theme-analyze-defun
|
||||
;;;;;; color-theme-print color-theme-install-at-point-for-current-frame
|
||||
;;;;;; color-theme-install-at-mouse color-theme-describe color-theme-select)
|
||||
;;;;;; "color-theme" "color-theme.el" (17529 41105))
|
||||
;;; Generated autoloads from color-theme.el
|
||||
|
||||
(autoload (quote color-theme-select) "color-theme" "\
|
||||
Displays a special buffer for selecting and installing a color theme.
|
||||
With optional prefix ARG, this buffer will include color theme libraries
|
||||
as well. A color theme library is in itself not complete, it must be
|
||||
used as part of another color theme to be useful. Thus, color theme
|
||||
libraries are mainly useful for color theme authors.
|
||||
|
||||
\(fn &optional ARG)" t nil)
|
||||
|
||||
(autoload (quote color-theme-describe) "color-theme" "\
|
||||
Describe color theme listed at point.
|
||||
This shows the documentation of the value of text-property color-theme
|
||||
at point. The text-property color-theme should be a color theme
|
||||
function. See `color-themes'.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload (quote color-theme-install-at-mouse) "color-theme" "\
|
||||
Install color theme clicked upon using the mouse.
|
||||
First argument EVENT is used to set point. Then
|
||||
`color-theme-install-at-point' is called.
|
||||
|
||||
\(fn EVENT)" t nil)
|
||||
|
||||
(autoload (quote color-theme-install-at-point-for-current-frame) "color-theme" "\
|
||||
Install color theme at point for current frame only.
|
||||
Binds `color-theme-is-global' to nil and calls
|
||||
`color-theme-install-at-point'.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload (quote color-theme-print) "color-theme" "\
|
||||
Print the current color theme function.
|
||||
|
||||
You can contribute this function to <URL:news:gnu.emacs.sources> or
|
||||
paste it into your .emacs file and call it. That should recreate all
|
||||
the settings necessary for your color theme.
|
||||
|
||||
Example:
|
||||
|
||||
(require 'color-theme)
|
||||
(defun my-color-theme ()
|
||||
\"Color theme by Alex Schroeder, created 2000-05-17.\"
|
||||
(interactive)
|
||||
(color-theme-install
|
||||
'(...
|
||||
...
|
||||
...)))
|
||||
(my-color-theme)
|
||||
|
||||
If you want to use a specific color theme function, you can call the
|
||||
color theme function in your .emacs directly.
|
||||
|
||||
Example:
|
||||
|
||||
(require 'color-theme)
|
||||
(color-theme-gnome2)
|
||||
|
||||
\(fn &optional BUF)" t nil)
|
||||
|
||||
(autoload (quote color-theme-analyze-defun) "color-theme" "\
|
||||
Once you have a color-theme printed, check for missing faces.
|
||||
This is used by maintainers who receive a color-theme submission
|
||||
and want to make sure it follows the guidelines by the color-theme
|
||||
author.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload (quote color-theme-make-snapshot) "color-theme" "\
|
||||
Return the definition of the current color-theme.
|
||||
The function returned will recreate the color-theme in use at the moment.
|
||||
|
||||
\(fn)" nil nil)
|
||||
|
||||
(autoload (quote color-theme-compare) "color-theme" "\
|
||||
Compare two color themes.
|
||||
This will print the differences between installing THEME-A and
|
||||
installing THEME-B. Note that the order is important: If a face is
|
||||
defined in THEME-A and not in THEME-B, then this will not show up as a
|
||||
difference, because there is no reset before installing THEME-B. If a
|
||||
face is defined in THEME-B and not in THEME-A, then this will show up as
|
||||
a difference.
|
||||
|
||||
\(fn THEME-A THEME-B)" t nil)
|
||||
|
||||
(autoload (quote color-theme-install) "color-theme" "\
|
||||
Install a color theme defined by frame parameters, variables and faces.
|
||||
|
||||
The theme is installed for all present and future frames; any missing
|
||||
faces are created. See `color-theme-install-faces'.
|
||||
|
||||
THEME is a color theme definition. See below for more information.
|
||||
|
||||
If you want to install a color theme from your .emacs, use the output
|
||||
generated by `color-theme-print'. This produces color theme function
|
||||
which you can copy to your .emacs.
|
||||
|
||||
A color theme definition is a list:
|
||||
\([FUNCTION] FRAME-PARAMETERS VARIABLE-SETTINGS FACE-DEFINITIONS)
|
||||
|
||||
FUNCTION is the color theme function which called `color-theme-install'.
|
||||
This is no longer used. There was a time when this package supported
|
||||
automatic factoring of color themes. This has been abandoned.
|
||||
|
||||
FRAME-PARAMETERS is an alist of frame parameters. These are installed
|
||||
with `color-theme-install-frame-params'. These are installed last such
|
||||
that any changes to the default face can be changed by the frame
|
||||
parameters.
|
||||
|
||||
VARIABLE-DEFINITIONS is an alist of variable settings. These are
|
||||
installed with `color-theme-install-variables'.
|
||||
|
||||
FACE-DEFINITIONS is an alist of face definitions. These are installed
|
||||
with `color-theme-install-faces'.
|
||||
|
||||
If `color-theme-is-cumulative' is nil, a color theme will undo face and
|
||||
frame-parameter settings of previous color themes.
|
||||
|
||||
\(fn THEME)" nil nil)
|
||||
|
||||
(autoload (quote color-theme-submit) "color-theme" "\
|
||||
Submit your color-theme to the maintainer.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(autoload (quote color-theme-initialize) "color-theme" "\
|
||||
Initialize the color theme package by loading color-theme-libraries.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
;;;***
|
||||
1668
.emacs.d/color-theme.el
Normal file
1668
.emacs.d/color-theme.el
Normal file
File diff suppressed because it is too large
Load diff
308
.emacs.d/highlight-symbol.el
Normal file
308
.emacs.d/highlight-symbol.el
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
;;; highlight-symbol.el --- automatic and manual symbol highlighting
|
||||
;;
|
||||
;; Copyright (C) 2007-2009 Nikolaj Schumacher
|
||||
;;
|
||||
;; Author: Nikolaj Schumacher <bugs * nschum de>
|
||||
;; Version: 1.1
|
||||
;; Keywords: faces, matching
|
||||
;; URL: http://nschum.de/src/emacs/highlight-symbol/
|
||||
;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x
|
||||
;;
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
;;
|
||||
;; 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, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Add the following to your .emacs file:
|
||||
;; (require 'highlight-symbol)
|
||||
;; (global-set-key [(control f3)] 'highlight-symbol-at-point)
|
||||
;; (global-set-key [f3] 'highlight-symbol-next)
|
||||
;; (global-set-key [(shift f3)] 'highlight-symbol-prev)
|
||||
;; (global-set-key [(meta f3)] 'highlight-symbol-prev)))
|
||||
;; (global-set-key [(control meta f3)] 'highlight-symbol-query-replace)
|
||||
;;
|
||||
;; Use `highlight-symbol-at-point' to toggle highlighting of the symbol at
|
||||
;; point throughout the current buffer. Use `highlight-symbol-mode' to keep the
|
||||
;; symbol at point highlighted.
|
||||
;;
|
||||
;; The functions `highlight-symbol-next', `highlight-symbol-prev',
|
||||
;; `highlight-symbol-next-in-defun' and `highlight-symbol-prev-in-defun' allow
|
||||
;; for cycling through the locations of any symbol at point.
|
||||
;; When `highlight-symbol-on-navigation-p' is set, highlighting is triggered
|
||||
;; regardless of `highlight-symbol-idle-delay'.
|
||||
;;
|
||||
;; `highlight-symbol-query-replace' can be used to replace the symbol.
|
||||
;;
|
||||
;;; Change Log:
|
||||
;;
|
||||
;; 2009-04-13 (1.1)
|
||||
;; Added `highlight-symbol-query-replace'.
|
||||
;;
|
||||
;; 2009-03-19 (1.0.5)
|
||||
;; Fixed `highlight-symbol-idle-delay' void variable message.
|
||||
;; Fixed color repetition bug. (thanks to Hugo Schmitt)
|
||||
;;
|
||||
;; 2008-05-02 (1.0.4)
|
||||
;; Added `highlight-symbol-on-navigation-p' option.
|
||||
;;
|
||||
;; 2008-02-26 (1.0.3)
|
||||
;; Added `highlight-symbol-remove-all'.
|
||||
;;
|
||||
;; 2007-09-06 (1.0.2)
|
||||
;; Fixed highlighting with delay set to 0. (thanks to Stefan Persson)
|
||||
;;
|
||||
;; 2007-09-05 (1.0.1)
|
||||
;; Fixed completely broken temporary highlighting.
|
||||
;;
|
||||
;; 2007-07-30 (1.0)
|
||||
;; Keep temp highlight while jumping.
|
||||
;; Replaced `highlight-symbol-faces' with `highlight-symbol-colors'.
|
||||
;; Fixed dependency and Emacs 21 bug. (thanks to Gregor Gorjanc)
|
||||
;; Prevent calling `highlight-symbol-at-point' on nil.
|
||||
;;
|
||||
;; 2007-04-20 (0.9.1)
|
||||
;; Fixed bug in `highlight-symbol-jump'. (thanks to Per Nordlöw)
|
||||
;;
|
||||
;; 2007-04-06 (0.9)
|
||||
;; Initial release.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(require 'thingatpt)
|
||||
(require 'hi-lock)
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(push "^No symbol at point$" debug-ignored-errors)
|
||||
|
||||
(defgroup highlight-symbol nil
|
||||
"Automatic and manual symbols highlighting"
|
||||
:group 'faces
|
||||
:group 'matching)
|
||||
|
||||
(defface highlight-symbol-face
|
||||
'((((class color) (background dark))
|
||||
(:background "gray30"))
|
||||
(((class color) (background light))
|
||||
(:background "gray90")))
|
||||
"*Face used by `highlight-symbol-mode'."
|
||||
:group 'highlight-symbol)
|
||||
|
||||
(defvar highlight-symbol-timer nil)
|
||||
|
||||
(defun highlight-symbol-update-timer (value)
|
||||
(when highlight-symbol-timer
|
||||
(cancel-timer highlight-symbol-timer))
|
||||
(setq highlight-symbol-timer
|
||||
(and value (/= value 0)
|
||||
(run-with-idle-timer value t 'highlight-symbol-temp-highlight))))
|
||||
|
||||
(defvar highlight-symbol-mode nil)
|
||||
|
||||
(defun highlight-symbol-set (symbol value)
|
||||
(when symbol (set symbol value))
|
||||
(when highlight-symbol-mode
|
||||
(highlight-symbol-update-timer value)))
|
||||
|
||||
(defcustom highlight-symbol-idle-delay 1.5
|
||||
"*Number of seconds of idle time before highlighting the current symbol.
|
||||
If this variable is set to 0, no idle time is required.
|
||||
Changing this does not take effect until `highlight-symbol-mode' has been
|
||||
disabled for all buffers."
|
||||
:type 'number
|
||||
:set 'highlight-symbol-set
|
||||
:group 'highlight-symbol)
|
||||
|
||||
(defcustom highlight-symbol-colors
|
||||
'("yellow" "DeepPink" "cyan" "MediumPurple1" "SpringGreen1"
|
||||
"DarkOrange" "HotPink1" "RoyalBlue1" "OliveDrab")
|
||||
"*Colors used by `highlight-symbol-at-point'.
|
||||
highlighting the symbols will use these colors in order."
|
||||
:type '(repeat color)
|
||||
:group 'highlight-symbol)
|
||||
|
||||
(defcustom highlight-symbol-on-navigation-p nil
|
||||
"*Wether or not to temporary highlight the symbol when using
|
||||
`highlight-symbol-jump' family of functions."
|
||||
:type 'boolean
|
||||
:group 'highlight-symbol)
|
||||
|
||||
(defvar highlight-symbol-color-index 0)
|
||||
(make-variable-buffer-local 'highlight-symbol-color-index)
|
||||
|
||||
(defvar highlight-symbol nil)
|
||||
(make-variable-buffer-local 'highlight-symbol)
|
||||
|
||||
(defvar highlight-symbol-list nil)
|
||||
(make-variable-buffer-local 'highlight-symbol-list)
|
||||
|
||||
(defconst highlight-symbol-border-pattern
|
||||
(if (>= emacs-major-version 22) '("\\_<" . "\\_>") '("\\<" . "\\>")))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode highlight-symbol-mode
|
||||
"Minor mode that highlights the symbol under point throughout the buffer.
|
||||
Highlighting takes place after `highlight-symbol-idle-delay'."
|
||||
nil " hl-s" nil
|
||||
(if highlight-symbol-mode
|
||||
;; on
|
||||
(let ((hi-lock-archaic-interface-message-used t))
|
||||
(unless hi-lock-mode (hi-lock-mode 1))
|
||||
(highlight-symbol-update-timer highlight-symbol-idle-delay)
|
||||
(add-hook 'post-command-hook 'highlight-symbol-mode-post-command nil t))
|
||||
;; off
|
||||
(remove-hook 'post-command-hook 'highlight-symbol-mode-post-command t)
|
||||
(highlight-symbol-mode-remove-temp)
|
||||
(kill-local-variable 'highlight-symbol)))
|
||||
|
||||
;;;###autoload
|
||||
(defun highlight-symbol-at-point ()
|
||||
"Toggle highlighting of the symbol at point.
|
||||
This highlights or unhighlights the symbol at point using the first
|
||||
element in of `highlight-symbol-faces'."
|
||||
(interactive)
|
||||
(let ((symbol (highlight-symbol-get-symbol)))
|
||||
(unless symbol (error "No symbol at point"))
|
||||
(unless hi-lock-mode (hi-lock-mode 1))
|
||||
(if (member symbol highlight-symbol-list)
|
||||
;; remove
|
||||
(progn
|
||||
(setq highlight-symbol-list (delete symbol highlight-symbol-list))
|
||||
(hi-lock-unface-buffer symbol))
|
||||
;; add
|
||||
(when (equal symbol highlight-symbol)
|
||||
(highlight-symbol-mode-remove-temp))
|
||||
(let ((color (nth highlight-symbol-color-index
|
||||
highlight-symbol-colors)))
|
||||
(if color ;; wrap
|
||||
(incf highlight-symbol-color-index)
|
||||
(setq highlight-symbol-color-index 1
|
||||
color (car highlight-symbol-colors)))
|
||||
(setq color `((background-color . ,color)
|
||||
(foreground-color . "black")))
|
||||
;; highlight
|
||||
(with-no-warnings
|
||||
(if (< emacs-major-version 22)
|
||||
(hi-lock-set-pattern `(,symbol (0 (quote ,color) t)))
|
||||
(hi-lock-set-pattern symbol color)))
|
||||
(push symbol highlight-symbol-list)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun highlight-symbol-remove-all ()
|
||||
"Remove symbol highlighting in buffer."
|
||||
(interactive)
|
||||
(mapc 'hi-lock-unface-buffer highlight-symbol-list)
|
||||
(setq highlight-symbol-list nil))
|
||||
|
||||
;;;###autoload
|
||||
(defun highlight-symbol-next ()
|
||||
"Jump to the next location of the symbol at point within the function."
|
||||
(interactive)
|
||||
(highlight-symbol-jump 1))
|
||||
|
||||
;;;###autoload
|
||||
(defun highlight-symbol-prev ()
|
||||
"Jump to the previous location of the symbol at point within the function."
|
||||
(interactive)
|
||||
(highlight-symbol-jump -1))
|
||||
|
||||
;;;###autoload
|
||||
(defun highlight-symbol-next-in-defun ()
|
||||
"Jump to the next location of the symbol at point within the defun."
|
||||
(interactive)
|
||||
(save-restriction
|
||||
(narrow-to-defun)
|
||||
(highlight-symbol-jump 1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun highlight-symbol-prev-in-defun ()
|
||||
"Jump to the previous location of the symbol at point within the defun."
|
||||
(interactive)
|
||||
(save-restriction
|
||||
(narrow-to-defun)
|
||||
(highlight-symbol-jump -1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun highlight-symbol-query-replace (replacement)
|
||||
"*Replace the symbol at point."
|
||||
(interactive (let ((symbol (or (thing-at-point 'symbol)
|
||||
(error "No symbol at point"))))
|
||||
(highlight-symbol-temp-highlight)
|
||||
(set query-replace-to-history-variable
|
||||
(cons (substring-no-properties symbol)
|
||||
(eval query-replace-to-history-variable)))
|
||||
(list
|
||||
(read-from-minibuffer "Replacement: " nil nil nil
|
||||
query-replace-to-history-variable))))
|
||||
(goto-char (beginning-of-thing 'symbol))
|
||||
(query-replace-regexp (highlight-symbol-get-symbol) replacement))
|
||||
|
||||
(defun highlight-symbol-get-symbol ()
|
||||
"Return a regular expression dandifying the symbol at point."
|
||||
(let ((symbol (thing-at-point 'symbol)))
|
||||
(when symbol (concat (car highlight-symbol-border-pattern)
|
||||
(regexp-quote symbol)
|
||||
(cdr highlight-symbol-border-pattern)))))
|
||||
|
||||
(defun highlight-symbol-temp-highlight ()
|
||||
"Highlight the current symbol until a command is executed."
|
||||
(when highlight-symbol-mode
|
||||
(let ((symbol (highlight-symbol-get-symbol)))
|
||||
(unless (or (equal symbol highlight-symbol)
|
||||
(member symbol highlight-symbol-list))
|
||||
(highlight-symbol-mode-remove-temp)
|
||||
(when symbol
|
||||
(setq highlight-symbol symbol)
|
||||
(hi-lock-set-pattern symbol 'highlight-symbol-face))))))
|
||||
|
||||
(defun highlight-symbol-mode-remove-temp ()
|
||||
"Remove the temporary symbol highlighting."
|
||||
(when highlight-symbol
|
||||
(hi-lock-unface-buffer highlight-symbol)
|
||||
(setq highlight-symbol nil)))
|
||||
|
||||
(defun highlight-symbol-mode-post-command ()
|
||||
"After a command, change the temporary highlighting.
|
||||
Remove the temporary symbol highlighting and, unless a timeout is specified,
|
||||
create the new one."
|
||||
(if (eq this-command 'highlight-symbol-jump)
|
||||
(when highlight-symbol-on-navigation-p
|
||||
(highlight-symbol-temp-highlight))
|
||||
(if (eql highlight-symbol-idle-delay 0)
|
||||
(highlight-symbol-temp-highlight)
|
||||
(highlight-symbol-mode-remove-temp))))
|
||||
|
||||
(defun highlight-symbol-jump (dir)
|
||||
"Jump to the next or previous occurence of the symbol at point.
|
||||
DIR has to be 1 or -1."
|
||||
(let ((symbol (highlight-symbol-get-symbol)))
|
||||
(if symbol
|
||||
(let* ((case-fold-search nil)
|
||||
(bounds (bounds-of-thing-at-point 'symbol))
|
||||
(offset (- (point) (if (< 0 dir) (cdr bounds) (car bounds)))))
|
||||
(unless (eq last-command 'highlight-symbol-jump)
|
||||
(push-mark))
|
||||
;; move a little, so we don't find the same instance again
|
||||
(goto-char (- (point) offset))
|
||||
(let ((target (re-search-forward symbol nil t dir)))
|
||||
(unless target
|
||||
(goto-char (if (< 0 dir) (point-min) (point-max)))
|
||||
(setq target (re-search-forward symbol nil nil dir)))
|
||||
(goto-char (+ target offset)))
|
||||
(setq this-command 'highlight-symbol-jump))
|
||||
(error "No symbol at point"))))
|
||||
|
||||
(provide 'highlight-symbol)
|
||||
|
||||
;;; highlight-symbol.el ends here
|
||||
75
.emacs.d/init.el
Normal file
75
.emacs.d/init.el
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
(add-to-list 'load-path "~/.emacs.d")
|
||||
(add-to-list 'load-path "~/.emacs.d/auto-complete")
|
||||
|
||||
; Requires
|
||||
(require 'vimpulse)
|
||||
(require 'color-theme)
|
||||
(require 'color-theme-autoloads)
|
||||
(require 'tabbar)
|
||||
;(require 'highlight-symbol)
|
||||
(require 'auto-complete-config)
|
||||
|
||||
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
|
||||
(ac-config-default)
|
||||
(setq ac-dwim t)
|
||||
(setq ac-expand-on-auto-complete nil)
|
||||
(setq ac-use-fuzzy t)
|
||||
;(define-key ac-completing-map "\t" 'ac-fuzzy-complete)
|
||||
;(define-key ac-completing-map "\r" nil)
|
||||
|
||||
; This is the other Vim-mode. Maybe should delete this..
|
||||
;
|
||||
;(add-to-list 'load-path "~/.emacs.d/vim-mode")
|
||||
;(require 'vim)
|
||||
;(vim-mode 1)
|
||||
|
||||
; Tabbar settings (Simple groups)
|
||||
(defun tabbar-buffer-groups ()
|
||||
"Return the list of group names the current buffer belongs to.
|
||||
This function is a custom function for tabbar-mode's tabbar-buffer-groups.
|
||||
This function group all buffers into 3 groups:
|
||||
Those Dired, those user buffer, and those emacs buffer.
|
||||
Emacs buffer are those starting with “*”."
|
||||
(list
|
||||
(cond
|
||||
((string-equal "*" (substring (buffer-name) 0 1))
|
||||
"Emacs Buffer"
|
||||
)
|
||||
((eq major-mode 'dired-mode)
|
||||
"Dired"
|
||||
)
|
||||
(t
|
||||
"User Buffer"
|
||||
)
|
||||
))) ;; from Xah Lee
|
||||
(setq tabbar-buffer-groups-function 'tabbar-buffer-groups)
|
||||
|
||||
(tabbar-mode)
|
||||
|
||||
; Basic frame defaults
|
||||
(let ((background-color "#2F2F2F")
|
||||
(foreground-color "LightGrey")
|
||||
(fname "Inconsolata-13")
|
||||
(fheight 45)
|
||||
(fwidth 115))
|
||||
|
||||
(set-default-font fname)
|
||||
(add-to-list 'default-frame-alist (cons 'font fname))
|
||||
; (set-background-color background-color)
|
||||
; (add-to-list 'default-frame-alist (cons 'background-color background-color))
|
||||
; (set-foreground-color foreground-color)
|
||||
(add-to-list 'default-frame-alist (cons 'foreground-color foreground-color))
|
||||
(add-to-list 'default-frame-alist (cons 'height fheight))
|
||||
(add-to-list 'default-frame-alist (cons 'width fwidth))
|
||||
)
|
||||
(custom-set-variables '(inhibit-startup-screen t))
|
||||
(custom-set-faces)
|
||||
|
||||
; Run color-theme
|
||||
(color-theme-initialize)
|
||||
;(require 'color-theme-barak)
|
||||
|
||||
(if window-system
|
||||
(color-theme-barak))
|
||||
|
||||
;(defun my-emacs-startup-hook () (my-close-scratch)) (add-hook 'emacs-startup-hook 'my-emacs-startup-hook)
|
||||
44
.emacs.d/themes/color-theme-barak.el
Normal file
44
.emacs.d/themes/color-theme-barak.el
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
(defun color-theme-barak ()
|
||||
"Color theme by Barak Michener, created 08-11-2010"
|
||||
(interactive)
|
||||
(color-theme-install
|
||||
'(color-theme-barak
|
||||
((background-color . "#121212")
|
||||
(background-mode . dark)
|
||||
(border-color . "black")
|
||||
(cursor-color . "#A7A7A7")
|
||||
(foreground-color . "#E0E0E0")
|
||||
(mouse-color . "sienna1"))
|
||||
(default ((t (:background "#121212" :foreground "#E0E0E0"))))
|
||||
(blue ((t (:foreground "blue"))))
|
||||
(bold ((t (:bold t))))
|
||||
(bold-italic ((t (:bold t))))
|
||||
(border-glyph ((t (nil))))
|
||||
(buffers-tab ((t (:background "#121212" :foreground "#E0E0E0"))))
|
||||
(font-lock-builtin-face ((t (:foreground "#E0E0E0"))))
|
||||
(font-lock-comment-face ((t (:foreground "#238E23"))))
|
||||
(font-lock-constant-face ((t (:foreground "#E3AC3D"))))
|
||||
(font-lock-doc-string-face ((t (:foreground "DarkOrange"))))
|
||||
(font-lock-function-name-face ((t (:foreground "#C5A6FF"))))
|
||||
(font-lock-keyword-face ((t (:bold t :foreground "#4876FF"))))
|
||||
(font-lock-preprocessor-face ((t (:foreground "#E9DFEF"))))
|
||||
(font-lock-reference-face ((t (:foreground "#E1634F"))))
|
||||
|
||||
(font-lock-regexp-grouping-backslash ((t (:foreground "#E9C062"))))
|
||||
(font-lock-regexp-grouping-construct ((t (:foreground "red"))))
|
||||
|
||||
(font-lock-string-face ((t (:foreground "#F05656"))))
|
||||
(font-lock-type-face ((t (:foreground "#73E1E6"))))
|
||||
(font-lock-variable-name-face ((t (:foreground "#00BFFF"))))
|
||||
(font-lock-warning-face ((t (:bold t :foreground "Pink"))))
|
||||
(gui-element ((t (:background "#D4D0C8" :foreground "black"))))
|
||||
(region ((t (:background "#364458"))))
|
||||
(mode-line ((t (:background "grey75" :foreground "black"))))
|
||||
(highlight ((t (:background "#222222"))))
|
||||
(highline-face ((t (:background "SeaGreen"))))
|
||||
(italic ((t (nil))))
|
||||
(left-margin ((t (nil))))
|
||||
(text-cursor ((t (:background "yellow" :foreground "black"))))
|
||||
(toolbar ((t (nil))))
|
||||
(underline ((nil (:underline nil))))
|
||||
(zmacs-region ((t (:background "snow" :foreground "ble")))))))
|
||||
60
.emacs.d/themes/color-theme-blackboard.el
Normal file
60
.emacs.d/themes/color-theme-blackboard.el
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
;; Blackboard Colour Theme for Emacs.
|
||||
;;
|
||||
;; Defines a colour scheme resembling that of the original TextMate Blackboard colour theme.
|
||||
;; To use add the following to your .emacs file (requires the color-theme package):
|
||||
;;
|
||||
;; (require 'color-theme)
|
||||
;; (color-theme-initialize)
|
||||
;; (load-file "~/.emacs.d/themes/color-theme-blackboard.el")
|
||||
;;
|
||||
;; And then (color-theme-blackboard) to activate it.
|
||||
;;
|
||||
;; MIT License Copyright (c) 2008 JD Huntington <jdhuntington at gmail dot com>
|
||||
;; Credits due to the excellent TextMate Blackboard theme
|
||||
;;
|
||||
;; All patches welcome
|
||||
|
||||
(defun color-theme-blackboard ()
|
||||
"Color theme by JD Huntington, based off the TextMate Blackboard theme, created 2008-11-27"
|
||||
(interactive)
|
||||
(color-theme-install
|
||||
'(color-theme-blackboard
|
||||
((background-color . "#0C1021")
|
||||
(background-mode . dark)
|
||||
(border-color . "black")
|
||||
(cursor-color . "#A7A7A7")
|
||||
(foreground-color . "#F8F8F8")
|
||||
(mouse-color . "sienna1"))
|
||||
(default ((t (:background "#0C1021" :foreground "#F8F8F8"))))
|
||||
(blue ((t (:foreground "blue"))))
|
||||
(bold ((t (:bold t))))
|
||||
(bold-italic ((t (:bold t))))
|
||||
(border-glyph ((t (nil))))
|
||||
(buffers-tab ((t (:background "#0C1021" :foreground "#F8F8F8"))))
|
||||
(font-lock-builtin-face ((t (:foreground "#F8F8F8"))))
|
||||
(font-lock-comment-face ((t (:italic t :foreground "#AEAEAE"))))
|
||||
(font-lock-constant-face ((t (:foreground "#D8FA3C"))))
|
||||
(font-lock-doc-string-face ((t (:foreground "DarkOrange"))))
|
||||
(font-lock-function-name-face ((t (:foreground "#FF6400"))))
|
||||
(font-lock-keyword-face ((t (:foreground "#FBDE2D"))))
|
||||
(font-lock-preprocessor-face ((t (:foreground "Aquamarine"))))
|
||||
(font-lock-reference-face ((t (:foreground "SlateBlue"))))
|
||||
|
||||
(font-lock-regexp-grouping-backslash ((t (:foreground "#E9C062"))))
|
||||
(font-lock-regexp-grouping-construct ((t (:foreground "red"))))
|
||||
|
||||
(font-lock-string-face ((t (:foreground "#61CE3C"))))
|
||||
(font-lock-type-face ((t (:foreground "#8DA6CE"))))
|
||||
(font-lock-variable-name-face ((t (:foreground "#FF6400"))))
|
||||
(font-lock-warning-face ((t (:bold t :foreground "Pink"))))
|
||||
(gui-element ((t (:background "#D4D0C8" :foreground "black"))))
|
||||
(region ((t (:background "#253B76"))))
|
||||
(mode-line ((t (:background "grey75" :foreground "black"))))
|
||||
(highlight ((t (:background "#222222"))))
|
||||
(highline-face ((t (:background "SeaGreen"))))
|
||||
(italic ((t (nil))))
|
||||
(left-margin ((t (nil))))
|
||||
(text-cursor ((t (:background "yellow" :foreground "black"))))
|
||||
(toolbar ((t (nil))))
|
||||
(underline ((nil (:underline nil))))
|
||||
(zmacs-region ((t (:background "snow" :foreground "ble")))))))
|
||||
22
.emacs.d/themes/color-theme-example.el
Normal file
22
.emacs.d/themes/color-theme-example.el
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(eval-when-compile
|
||||
(require 'color-theme))
|
||||
|
||||
(defun color-theme-example ()
|
||||
"Example theme. Carbon copy of color-theme-gnome contributed by Jonadab."
|
||||
(interactive)
|
||||
(color-theme-install
|
||||
'(color-theme-example
|
||||
((foreground-color . "wheat")
|
||||
(background-color . "darkslategrey")
|
||||
(background-mode . dark))
|
||||
(default ((t (nil))))
|
||||
(region ((t (:foreground "cyan" :background "dark cyan"))))
|
||||
(underline ((t (:foreground "yellow" :underline t))))
|
||||
(modeline ((t (:foreground "dark cyan" :background "wheat"))))
|
||||
(modeline-buffer-id ((t (:foreground "dark cyan" :background "wheat"))))
|
||||
(modeline-mousable ((t (:foreground "dark cyan" :background "wheat"))))
|
||||
(modeline-mousable-minor-mode ((t (:foreground "dark cyan" :background "wheat"))))
|
||||
(italic ((t (:foreground "dark red" :italic t))))
|
||||
(bold-italic ((t (:foreground "dark red" :bold t :italic t))))
|
||||
(font-lock-comment-face ((t (:foreground "Firebrick"))))
|
||||
(bold ((t (:bold)))))))
|
||||
13539
.emacs.d/themes/color-theme-library.el
Normal file
13539
.emacs.d/themes/color-theme-library.el
Normal file
File diff suppressed because it is too large
Load diff
194
.emacs.d/themes/color-theme-tangotango.el
Normal file
194
.emacs.d/themes/color-theme-tangotango.el
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
;;; Emacs Color theme based on the Tango Palette colors.
|
||||
;;; First derived from color-theme-tango.el, created by danranx@gmail.com :
|
||||
;;; http://www.emacswiki.org/emacs/color-theme-tango.el
|
||||
|
||||
;; Copyright (C) 2010 Julien Barnier <julien@nozav.org>
|
||||
|
||||
;; Project homepage : http://blog.nozav.org/post/2010/07/12/Updated-tangotango-emacs-color-theme
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This 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 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.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with Emacs; see the file COPYING, or type `C-h C-c'. If not,
|
||||
;; write to the Free Software Foundation at this address:
|
||||
|
||||
;; Free Software Foundation
|
||||
;; 51 Franklin Street, Fifth Floor
|
||||
;; Boston, MA 02110-1301
|
||||
;; USA
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'color-theme))
|
||||
|
||||
(defun color-theme-tangotango ()
|
||||
"A color theme based on Tango Palette colors."
|
||||
;; Color codes :
|
||||
;; - blue : "dodger blue"
|
||||
;; - yellow : "#edd400"
|
||||
;; - green : "#6ac214"
|
||||
;; - orange/red : "tomato"
|
||||
(interactive)
|
||||
(color-theme-install
|
||||
'(color-theme-tangotango
|
||||
((background-color . "#2e3434")
|
||||
(background-mode . dark)
|
||||
(border-color . "#888a85")
|
||||
(cursor-color . "#fce94f")
|
||||
(foreground-color . "#eeeeec")
|
||||
(mouse-color . "#8ae234"))
|
||||
((help-highlight-face . underline)
|
||||
(ibuffer-dired-buffer-face . font-lock-function-name-face)
|
||||
(ibuffer-help-buffer-face . font-lock-comment-face)
|
||||
(ibuffer-hidden-buffer-face . font-lock-warning-face)
|
||||
(ibuffer-occur-match-face . font-lock-warning-face)
|
||||
(ibuffer-read-only-buffer-face . font-lock-type-face)
|
||||
(ibuffer-special-buffer-face . font-lock-keyword-face)
|
||||
(ibuffer-title-face . font-lock-type-face))
|
||||
(highlight ((t (:background "brown4" :foreground nil))))
|
||||
(border ((t (:background "#888a85"))))
|
||||
(fringe ((t (:background "grey10"))))
|
||||
(mode-line ((t (:foreground "#bbbbbc" :background "#222222" :box (:line-width 1 :color nil :style released-button)))))
|
||||
(mode-line-inactive ((t (:foreground "#bbbbbc" :background "#555753"))))
|
||||
(mode-line-buffer-id ((t (:bold t :foreground "orange" :background nil))))
|
||||
(region ((t (:background "dark slate blue"))))
|
||||
(link ((t (:underline t :foreground "dodger blue"))))
|
||||
(custom-link ((t (:inherit 'link))))
|
||||
(match ((t (:bold t :background "#e9b96e" :foreground "#2e3436"))))
|
||||
(tool-tips ((t (:inherit 'variable-pitch :foreground "black" :background "lightyellow"))))
|
||||
(tooltip ((t (:inherit 'variable-pitch :foreground "black" :background "lightyellow"))))
|
||||
(bold ((t (:bold t :underline nil :background nil))))
|
||||
(italic ((t (:italic t :underline nil :background nil))))
|
||||
(font-lock-builtin-face ((t (:foreground "#729fcf"))))
|
||||
(font-lock-comment-face ((t (:foreground "#888a85"))))
|
||||
(font-lock-constant-face ((t (:foreground "#8ae234"))))
|
||||
(font-lock-doc-face ((t (:foreground "#888a85"))))
|
||||
(font-lock-keyword-face ((t (:foreground "#729fcf" :bold t))))
|
||||
(font-lock-string-face ((t (:foreground "#ad7fa8" :italic t))))
|
||||
(font-lock-type-face ((t (:foreground "#8ae234" :bold t))))
|
||||
(font-lock-variable-name-face ((t (:foreground "tomato"))))
|
||||
(font-lock-warning-face ((t (:bold t :foreground "#f57900"))))
|
||||
(font-lock-function-name-face ((t (:foreground "#edd400" :bold t))))
|
||||
(comint-highlight-input ((t (:italic t :bold t))))
|
||||
(comint-highlight-prompt ((t (:foreground "#8ae234"))))
|
||||
(isearch ((t (:background "#f57900" :foreground "#2e3436"))))
|
||||
(isearch-lazy-highlight-face ((t (:foreground "#2e3436" :background "#e9b96e"))))
|
||||
(show-paren-match-face ((t (:foreground "#2e3436" :background "#73d216"))))
|
||||
(show-paren-mismatch-face ((t (:background "#ad7fa8" :foreground "#2e3436"))))
|
||||
(minibuffer-prompt ((t (:foreground "#729fcf" :bold t))))
|
||||
(info-xref ((t (:foreground "#729fcf"))))
|
||||
(info-xref-visited ((t (:foreground "#ad7fa8"))))
|
||||
(diary-face ((t (:bold t :foreground "IndianRed"))))
|
||||
(eshell-ls-clutter-face ((t (:bold t :foreground "DimGray"))))
|
||||
(eshell-ls-executable-face ((t (:bold t :foreground "Coral"))))
|
||||
(eshell-ls-missing-face ((t (:bold t :foreground "black"))))
|
||||
(eshell-ls-special-face ((t (:bold t :foreground "Gold"))))
|
||||
(eshell-ls-symlink-face ((t (:bold t :foreground "White"))))
|
||||
(widget-button ((t (:bold t))))
|
||||
(widget-mouse-face ((t (:bold t :foreground "white" :background "brown4"))))
|
||||
(widget-field ((t (:foreground "orange" :background "gray30"))))
|
||||
(widget-single-line-field ((t (:foreground "orange" :background "gray30"))))
|
||||
(custom-group-tag ((t (:bold t :foreground "#edd400" :height 1.3))))
|
||||
(custom-variable-tag ((t (:bold t :foreground "#edd400" :height 1.1))))
|
||||
(custom-face-tag ((t (:bold t :foreground "#edd400" :height 1.1))))
|
||||
(custom-state-face ((t (:foreground "#729fcf"))))
|
||||
(custom-button ((t (:box (:line-width 1 :style released-button) :background "grey50" :foreground "black"))))
|
||||
(custom-variable-button ((t (:inherit 'custom-button))))
|
||||
(custom-button-mouse ((t (:inherit 'custom-button :background "grey60"))))
|
||||
(custom-button-unraised ((t (:background "grey50" :foreground "black"))))
|
||||
(custom-button-mouse-unraised ((t (:inherit 'custom-button-unraised :background "grey60"))))
|
||||
(custom-button-pressed ((t (:inherit 'custom-button :box (:style pressed-button)))))
|
||||
(custom-button-mouse-pressed-unraised ((t (:inherit 'custom-button-unraised :background "grey60"))))
|
||||
(custom-documentation ((t (:italic t))))
|
||||
(message-cited-text ((t (:foreground "#edd400"))))
|
||||
(gnus-cite-face-1 ((t (:foreground "#ad7fa8"))))
|
||||
(gnus-cite-face-2 ((t (:foreground "sienna4"))))
|
||||
(gnus-cite-face-3 ((t (:foreground "khaki4"))))
|
||||
(gnus-cite-face-4 ((t (:foreground "PaleTurquoise4"))))
|
||||
(gnus-group-mail-1-empty-face ((t (:foreground "light cyan"))))
|
||||
(gnus-group-mail-1-face ((t (:bold t :foreground "light cyan"))))
|
||||
(gnus-group-mail-2-empty-face ((t (:foreground "turquoise"))))
|
||||
(gnus-group-mail-2-face ((t (:bold t :foreground "turquoise"))))
|
||||
(gnus-group-mail-3-empty-face ((t (:foreground "#729fcf"))))
|
||||
(gnus-group-mail-3-face ((t (:bold t :foreground "#edd400"))))
|
||||
(gnus-group-mail-low-empty-face ((t (:foreground "dodger blue"))))
|
||||
(gnus-group-mail-low-face ((t (:bold t :foreground "dodger blue"))))
|
||||
(gnus-group-news-1-empty-face ((t (:foreground "light cyan"))))
|
||||
(gnus-group-news-1-face ((t (:bold t :foreground "light cyan"))))
|
||||
(gnus-group-news-2-empty-face ((t (:foreground "turquoise"))))
|
||||
(gnus-group-news-2-face ((t (:bold t :foreground "turquoise"))))
|
||||
(gnus-group-news-3-empty-face ((t (:foreground "#729fcf"))))
|
||||
(gnus-group-news-3-face ((t (:bold t :foreground "#edd400"))))
|
||||
(gnus-group-news-low-empty-face ((t (:foreground "dodger blue"))))
|
||||
(gnus-group-news-low-face ((t (:bold t :foreground "dodger blue"))))
|
||||
(gnus-header-name-face ((t (:bold t :foreground "#729fcf"))))
|
||||
(gnus-header-from ((t (:bold t :foreground "#edd400"))))
|
||||
(gnus-header-subject ((t (:foreground "#edd400"))))
|
||||
(gnus-header-content ((t (:italic t :foreground "#8ae234"))))
|
||||
(gnus-header-newsgroups-face ((t (:italic t :bold t :foreground "LightSkyBlue3"))))
|
||||
(gnus-signature-face ((t (:italic t :foreground "dark grey"))))
|
||||
(gnus-summary-cancelled-face ((t (:background "black" :foreground "yellow"))))
|
||||
(gnus-summary-high-ancient-face ((t (:bold t :foreground "rotal blue"))))
|
||||
(gnus-summary-high-read-face ((t (:bold t :foreground "lime green"))))
|
||||
(gnus-summary-high-ticked-face ((t (:bold t :foreground "tomato"))))
|
||||
(gnus-summary-high-unread-face ((t (:bold t :foreground "white"))))
|
||||
(gnus-summary-low-ancient-face ((t (:italic t :foreground "lime green"))))
|
||||
(gnus-summary-low-read-face ((t (:italic t :foreground "royal blue"))))
|
||||
(gnus-summary-low-ticked-face ((t (:italic t :foreground "dark red"))))
|
||||
(gnus-summary-low-unread-face ((t (:italic t :foreground "white"))))
|
||||
(gnus-summary-normal-ancient-face ((t (:foreground "royal blue"))))
|
||||
(gnus-summary-normal-read-face ((t (:foreground "lime green"))))
|
||||
(gnus-summary-normal-ticked-face ((t (:foreground "indian red"))))
|
||||
(gnus-summary-normal-unread-face ((t (:foreground "white"))))
|
||||
(gnus-summary-selected ((t (:background "brown4" :foreground "white"))))
|
||||
(message-header-name-face ((t (:foreground "tomato"))))
|
||||
(message-header-newsgroups-face ((t (:italic t :bold t :foreground "LightSkyBlue3"))))
|
||||
(message-header-other-face ((t (:foreground "LightSkyBlue3"))))
|
||||
(message-header-xheader-face ((t (:foreground "DodgerBlue3"))))
|
||||
(message-header-subject ((t (:foreground "white"))))
|
||||
(message-header-to ((t (:foreground "white"))))
|
||||
(message-header-cc ((t (:foreground "white"))))
|
||||
(org-hide ((t (:foreground "#2e3436"))))
|
||||
(org-level-1 ((t (:bold t :foreground "dodger blue" :height 1.5))))
|
||||
(org-level-2 ((t (:bold nil :foreground "#edd400" :height 1.2))))
|
||||
(org-level-3 ((t (:bold t :foreground "#6ac214" :height 1.0))))
|
||||
(org-level-4 ((t (:bold nil :foreground "tomato" :height 1.0))))
|
||||
(org-date ((t (:underline t :foreground "magenta3"))))
|
||||
(org-footnote ((t (:underline t :foreground "magenta3"))))
|
||||
(org-link ((t (:foreground "skyblue2" :background "#2e3436"))))
|
||||
(org-special-keyword ((t (:foreground "brown"))))
|
||||
(org-verbatim ((t (:foreground "#eeeeec" :underline t :slant italic))))
|
||||
(org-block ((t (:foreground "#bbbbbc"))))
|
||||
(org-quote ((t (:inherit org-block :slant italic))))
|
||||
(org-verse ((t (:inherit org-block :slant italic))))
|
||||
(org-todo ((t (:bold t :foreground "Red"))))
|
||||
(org-done ((t (:bold t :foreground "ForestGreen"))))
|
||||
(org-agenda-structure ((t (:weight bold :foreground "tomato"))))
|
||||
(org-agenda-date ((t (:foreground "#6ac214"))))
|
||||
(org-agenda-date-weekend ((t (:weight normal :foreground "dodger blue"))))
|
||||
(org-agenda-date-today ((t (:weight bold :foreground "#edd400"))))
|
||||
(anything-header ((t (:bold t :background "grey15" :foreground "#edd400"))))
|
||||
(ess-jb-comment-face ((t (:background "#2e3436" :foreground "firebrick" :slant italic))))
|
||||
(ess-jb-hide-face ((t (:background "#2e3436" :foreground "#243436"))))
|
||||
(ess-jb-h1-face ((t (:height 1.6 :foreground "dodger blue" :slant normal))))
|
||||
(ess-jb-h2-face ((t (:height 1.4 :foreground "#6ac214" :slant normal))))
|
||||
(ess-jb-h3-face ((t (:height 1.2 :foreground "#edd400" :slant normal))))
|
||||
(ecb-default-highlight-face ((t (:background "#729fcf"))))
|
||||
(ecb-tag-header-face ((t (:background "#f57900"))))
|
||||
(magit-header ((t (:foreground "#edd400"))))
|
||||
(magit-diff-add ((t (:foreground "#729fcf"))))
|
||||
(magit-item-highlight ((t (:weight extra-bold :inverse-video t))))
|
||||
)))
|
||||
|
||||
(provide 'color-theme-tangotango)
|
||||
BIN
.emacs.d/vim-mode/.hg/00changelog.i
Normal file
BIN
.emacs.d/vim-mode/.hg/00changelog.i
Normal file
Binary file not shown.
1
.emacs.d/vim-mode/.hg/branch
Normal file
1
.emacs.d/vim-mode/.hg/branch
Normal file
|
|
@ -0,0 +1 @@
|
|||
default
|
||||
2
.emacs.d/vim-mode/.hg/branchheads.cache
Normal file
2
.emacs.d/vim-mode/.hg/branchheads.cache
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
9c9e1bf0c4a2ed90304bab5e7b00bbbe23ea1fe7 286
|
||||
9c9e1bf0c4a2ed90304bab5e7b00bbbe23ea1fe7 default
|
||||
BIN
.emacs.d/vim-mode/.hg/dirstate
Normal file
BIN
.emacs.d/vim-mode/.hg/dirstate
Normal file
Binary file not shown.
2
.emacs.d/vim-mode/.hg/hgrc
Normal file
2
.emacs.d/vim-mode/.hg/hgrc
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[paths]
|
||||
default = http://bitbucket.org/lyro/vim-mode
|
||||
3
.emacs.d/vim-mode/.hg/requires
Normal file
3
.emacs.d/vim-mode/.hg/requires
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
revlogv1
|
||||
store
|
||||
fncache
|
||||
BIN
.emacs.d/vim-mode/.hg/store/00changelog.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/00changelog.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/00manifest.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/00manifest.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/.hgignore.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/.hgignore.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/.hgtags.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/.hgtags.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-combat.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-combat.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-commands.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-commands.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-compat.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-compat.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-ex-commands.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-ex-commands.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-ex.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-ex.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-insert-mode.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-insert-mode.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-keymap.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-keymap.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-keys.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-keys.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-maps.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-maps.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-modes.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-modes.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-motions.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-motions.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-node.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-node.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-normal-mode.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-normal-mode.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-scroll.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-scroll.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-search.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-search.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-undo.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-undo.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-vim.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-vim.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-visual-mode.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-visual-mode.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim-window.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim-window.el.i
Normal file
Binary file not shown.
BIN
.emacs.d/vim-mode/.hg/store/data/vim.el.i
Normal file
BIN
.emacs.d/vim-mode/.hg/store/data/vim.el.i
Normal file
Binary file not shown.
22
.emacs.d/vim-mode/.hg/store/fncache
Normal file
22
.emacs.d/vim-mode/.hg/store/fncache
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
data/.hgignore.i
|
||||
data/.hgtags.i
|
||||
data/vim-combat.el.i
|
||||
data/vim-commands.el.i
|
||||
data/vim-compat.el.i
|
||||
data/vim-ex-commands.el.i
|
||||
data/vim-ex.el.i
|
||||
data/vim-insert-mode.el.i
|
||||
data/vim-keymap.el.i
|
||||
data/vim-keys.el.i
|
||||
data/vim-maps.el.i
|
||||
data/vim-modes.el.i
|
||||
data/vim-motions.el.i
|
||||
data/vim-node.el.i
|
||||
data/vim-normal-mode.el.i
|
||||
data/vim-scroll.el.i
|
||||
data/vim-search.el.i
|
||||
data/vim-undo.el.i
|
||||
data/vim-vim.el.i
|
||||
data/vim-visual-mode.el.i
|
||||
data/vim-window.el.i
|
||||
data/vim.el.i
|
||||
BIN
.emacs.d/vim-mode/.hg/store/undo
Normal file
BIN
.emacs.d/vim-mode/.hg/store/undo
Normal file
Binary file not shown.
5
.emacs.d/vim-mode/.hg/tags.cache
Normal file
5
.emacs.d/vim-mode/.hg/tags.cache
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
286 9c9e1bf0c4a2ed90304bab5e7b00bbbe23ea1fe7 e20b66a15626ce3c3dedc3de035c0d65915f1159
|
||||
|
||||
1f59539819aa706d915e97ecdf7a513d1e5e664e v0.1
|
||||
9c22feb593237c76560cfc1b817c2ece500e6ac9 v0.2
|
||||
15dff001f097be2ffc0b717edb7fd019a36e407a v0.3
|
||||
1
.emacs.d/vim-mode/.hg/undo.branch
Normal file
1
.emacs.d/vim-mode/.hg/undo.branch
Normal file
|
|
@ -0,0 +1 @@
|
|||
default
|
||||
0
.emacs.d/vim-mode/.hg/undo.dirstate
Normal file
0
.emacs.d/vim-mode/.hg/undo.dirstate
Normal file
2
.emacs.d/vim-mode/.hgignore
Normal file
2
.emacs.d/vim-mode/.hgignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
~$
|
||||
\.elc$
|
||||
3
.emacs.d/vim-mode/.hgtags
Normal file
3
.emacs.d/vim-mode/.hgtags
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
1f59539819aa706d915e97ecdf7a513d1e5e664e v0.1
|
||||
9c22feb593237c76560cfc1b817c2ece500e6ac9 v0.2
|
||||
15dff001f097be2ffc0b717edb7fd019a36e407a v0.3
|
||||
698
.emacs.d/vim-mode/vim-commands.el
Normal file
698
.emacs.d/vim-mode/vim-commands.el
Normal file
File diff suppressed because it is too large
Load diff
537
.emacs.d/vim-mode/vim-compat.el
Normal file
537
.emacs.d/vim-mode/vim-compat.el
Normal file
File diff suppressed because it is too large
Load diff
132
.emacs.d/vim-mode/vim-ex-commands.el
Normal file
132
.emacs.d/vim-mode/vim-ex-commands.el
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
;;; vim-ex-commands.el - Implementation of some ex-mode commands.
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defun* vim:save-buffer (file-name &key begin end mustbenew append)
|
||||
"Saves the lines from `begin' to `end' to file `file-name'."
|
||||
(with-current-buffer vim:ex-current-buffer
|
||||
(when (null file-name)
|
||||
(setq file-name (buffer-file-name))
|
||||
(unless file-name
|
||||
(error "Please specify a file-name for this buffer!")))
|
||||
|
||||
(let (beg-pos end-pos)
|
||||
(when begin
|
||||
(setq beg-pos (save-excursion
|
||||
(goto-line begin)
|
||||
(line-beginning-position)))
|
||||
(setq end-pos (if end
|
||||
(save-excursion
|
||||
(goto-line end)
|
||||
(line-end-position))
|
||||
beg-pos)))
|
||||
|
||||
(cond
|
||||
((and (null beg-pos)
|
||||
(string= file-name (buffer-file-name)))
|
||||
(save-buffer))
|
||||
((and (null beg-pos)
|
||||
(null (buffer-file-name)))
|
||||
(write-file file-name))
|
||||
(t
|
||||
(write-region beg-pos end-pos file-name append nil nil mustbenew))))))
|
||||
|
||||
|
||||
(vim:defcmd vim:cmd-write (motion (argument:file file) nonrepeatable)
|
||||
"Saves file `file'."
|
||||
(vim:save-buffer file
|
||||
:begin (and motion (vim:motion-first-line motion))
|
||||
:end (and motion (vim:motion-last-line motion))
|
||||
:mustbenew t))
|
||||
|
||||
(vim:defcmd vim:cmd-write-q (motion (argument:file file) nonrepeatable)
|
||||
"Overwrites file `file'."
|
||||
(vim:save-buffer file
|
||||
:begin (and motion (vim:motion-first-line motion))
|
||||
:end (and motion (vim:motion-last-line motion))
|
||||
:mustbenew nil))
|
||||
|
||||
(vim:defcmd vim:cmd-write-all (nonrepeatable)
|
||||
"Saves all buffers."
|
||||
(save-some-buffers nil))
|
||||
|
||||
(vim:defcmd vim:cmd-write-all-q (nonrepeatable)
|
||||
"Overwrites all buffers."
|
||||
(save-some-buffers t))
|
||||
|
||||
(vim:defcmd vim:cmd-edit ((argument:file file) nonrepeatable)
|
||||
"Visits a certain file."
|
||||
(if file
|
||||
(find-file file)
|
||||
(when (buffer-file-name)
|
||||
(find-file (buffer-file-name)))))
|
||||
|
||||
(vim:defcmd vim:cmd-buffer ((argument:buffer buffer) nonrepeatable)
|
||||
"Switches to another buffer."
|
||||
(if buffer
|
||||
(when (or (get-buffer buffer)
|
||||
(y-or-n-p (format "No buffer with name \"%s\" exists. Create new buffer? " buffer)))
|
||||
(switch-to-buffer buffer))
|
||||
(switch-to-buffer (other-buffer))))
|
||||
|
||||
(vim:defcmd vim:cmd-delete-buffer ((argument:buffer buffer) nonrepeatable)
|
||||
"Deletes a buffer."
|
||||
(kill-buffer buffer))
|
||||
|
||||
(vim:defcmd vim:cmd-delete-buffer-q ((argument:buffer buffer) nonrepeatable)
|
||||
"Deletes a buffer without saving."
|
||||
(if buffer
|
||||
(with-current-buffer buffer
|
||||
(set-buffer-modified-p nil))
|
||||
(set-buffer-modified-p nil))
|
||||
(kill-buffer buffer))
|
||||
|
||||
(vim:defcmd vim:cmd-quit (nonrepeatable)
|
||||
"Closes the current window, exits Emacs if this is the last window."
|
||||
(condition-case nil
|
||||
(delete-window)
|
||||
(error
|
||||
(condition-case nil
|
||||
(delete-frame)
|
||||
(error (save-buffers-kill-emacs))))))
|
||||
|
||||
(vim:defcmd vim:cmd-quit-q (nonrepeatable)
|
||||
"Closes the current window, exits Emacs if this is the last window."
|
||||
(condition-case nil
|
||||
(delete-window)
|
||||
(error
|
||||
(condition-case nil
|
||||
(delete-frame)
|
||||
(error (kill-emacs))))))
|
||||
|
||||
(vim:defcmd vim:cmd-quit-all (nonrepeatable)
|
||||
"Exits Emacs, asking for saving."
|
||||
(save-buffers-kill-emacs))
|
||||
|
||||
(vim:defcmd vim:cmd-quit-all-q (nonrepeatable)
|
||||
"Exits Emacs, without saving."
|
||||
(kill-emacs))
|
||||
|
||||
(vim:defcmd vim:cmd-save-and-quit (nonrepeatable)
|
||||
"Exits Emacs, without saving."
|
||||
(save-buffers-kill-emacs 1))
|
||||
|
||||
(vim:defcmd vim:cmd-save-and-close ((argument:file file) nonrepeatable)
|
||||
"Saves the current buffer and closes the window."
|
||||
(vim:cmd-write :argument file)
|
||||
(vim:cmd-quit))
|
||||
|
||||
(vim:defcmd vim:cmd-save-and-close-q ((argument:file file) nonrepeatable)
|
||||
"Saves the current buffer and closes the window."
|
||||
(vim:cmd-write-q :argument file)
|
||||
(vim:cmd-quit))
|
||||
|
||||
(provide 'vim-ex-commands)
|
||||
|
||||
;;; vim-ex-commands.el ends here
|
||||
440
.emacs.d/vim-mode/vim-ex.el
Normal file
440
.emacs.d/vim-mode/vim-ex.el
Normal file
|
|
@ -0,0 +1,440 @@
|
|||
;;; vim-ex.el - Ex-mode.
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar vim:ex-commands nil
|
||||
"List of pairs (command . function).")
|
||||
|
||||
(defvar vim:ex-current-buffer)
|
||||
|
||||
(vim:deflocalvar vim:ex-local-commands nil
|
||||
"List of pairs (command . function).")
|
||||
|
||||
(defvar vim:ex-history nil
|
||||
"History of ex-commands.")
|
||||
|
||||
(defun vim:emap (keys command)
|
||||
"Maps an ex-command to some function."
|
||||
(unless (find-if #'(lambda (x) (string= (car x) keys)) vim:ex-commands)
|
||||
(add-to-list 'vim:ex-commands (cons keys command))))
|
||||
|
||||
(defun vim:local-emap (keys command)
|
||||
"Maps an ex-command to some function buffer-local."
|
||||
(unless (find-if #'(lambda (x) (string= (car x) keys)) vim:ex-local-commands)
|
||||
(add-to-list 'vim:ex-local-commands (cons keys command))))
|
||||
|
||||
(defun vim:ex-binding (cmd)
|
||||
"Returns the current binding of `cmd' or nil."
|
||||
(with-current-buffer vim:ex-current-buffer
|
||||
(or (cdr-safe (assoc cmd vim:ex-local-commands))
|
||||
(cdr-safe (assoc cmd vim:ex-commands)))))
|
||||
|
||||
(defvar vim:ex-keymap (make-sparse-keymap)
|
||||
"Keymap used in ex-mode.")
|
||||
|
||||
(define-key vim:ex-keymap "\t" 'minibuffer-complete)
|
||||
(define-key vim:ex-keymap [return] 'exit-minibuffer)
|
||||
(define-key vim:ex-keymap (kbd "RET") 'exit-minibuffer)
|
||||
(define-key vim:ex-keymap " " 'vim:ex-expect-argument)
|
||||
(define-key vim:ex-keymap (kbd "C-j") 'vim:ex-execute-command)
|
||||
(define-key vim:ex-keymap (kbd "C-g") 'abort-recursive-edit)
|
||||
(define-key vim:ex-keymap [up] 'previous-history-element)
|
||||
(define-key vim:ex-keymap [down] 'next-history-element)
|
||||
(define-key vim:ex-keymap "\d" 'vim:ex-delete-backward-char)
|
||||
|
||||
(defun vim:ex-delete-backward-char (n)
|
||||
"Delete the previous `n' characters. If ex-buffer is empty,
|
||||
cancel ex-mode."
|
||||
(interactive "p")
|
||||
(if (and (>= n 1)
|
||||
(zerop (length (minibuffer-contents))))
|
||||
(exit-minibuffer))
|
||||
(delete-backward-char n))
|
||||
|
||||
(defvar vim:ex-keep-reading nil)
|
||||
(defvar vim:ex-cmdline nil)
|
||||
(defvar vim:ex-cmd nil)
|
||||
(defvar vim:ex-beg nil)
|
||||
(defvar vim:ex-end nil)
|
||||
|
||||
(defun vim:ex-split-cmdline (cmdline)
|
||||
(multiple-value-bind (cmd-region beg end) (vim:ex-parse cmdline)
|
||||
(if (null cmd-region)
|
||||
(values cmdline "" cmdline "" beg end)
|
||||
(let ((range (substring cmdline 0 (car cmd-region)))
|
||||
(cmd (substring cmdline (car cmd-region) (cdr cmd-region)))
|
||||
(spaces "")
|
||||
(arg (substring cmdline (cdr cmd-region))))
|
||||
|
||||
;; skip whitespaces
|
||||
(when (string-match "\\`\\s-*" arg)
|
||||
(setq spaces (match-string 0 arg)
|
||||
arg (substring arg (match-end 0))))
|
||||
|
||||
(values range cmd spaces arg beg end)))))
|
||||
|
||||
(defun vim:ex-expect-argument (n)
|
||||
;; called if the space separating the command from the argument has
|
||||
;; been pressed
|
||||
(interactive "p")
|
||||
(let ((cmdline (vim:minibuffer-contents)))
|
||||
(self-insert-command n)
|
||||
(multiple-value-bind (range cmd spaces arg beg end) (vim:ex-split-cmdline cmdline)
|
||||
|
||||
(when (and (= (point) (point-max))
|
||||
(zerop (length spaces))
|
||||
(zerop (length arg)))
|
||||
(while (stringp cmd)
|
||||
(setq cmd (vim:ex-binding cmd)))
|
||||
|
||||
(if (null cmd) (ding)
|
||||
(let ((result (case (vim:cmd-arg cmd)
|
||||
(file
|
||||
(vim:ex-complete-file-argument nil nil nil))
|
||||
(buffer
|
||||
(vim:ex-complete-buffer-argument nil nil nil))
|
||||
((t)
|
||||
(vim:ex-complete-text-argument nil nil nil)))))
|
||||
(when result (insert result))))))))
|
||||
|
||||
(defun vim:ex-complete (cmdline predicate flag)
|
||||
(multiple-value-bind (range cmd spaces arg beg end) (vim:ex-split-cmdline cmdline)
|
||||
(setq vim:ex-cmd cmd)
|
||||
|
||||
(cond
|
||||
;; only complete at the end of the command
|
||||
((< (point) (point-max)) nil)
|
||||
|
||||
;; if at the end of a command, complete the command
|
||||
((and (zerop (length spaces)) (zerop (length arg)))
|
||||
(let ((result (vim:ex-complete-command cmd predicate flag)))
|
||||
(cond
|
||||
((null result) nil)
|
||||
((eq t result) t)
|
||||
((stringp result)
|
||||
(if flag result (concat range result)))
|
||||
((listp result) (if flag result (mapcar #'(lambda (x) (concat range x)) result)))
|
||||
(t (error "Completion returned unexpected value.")))))
|
||||
|
||||
;; otherwise complete the argument
|
||||
(t
|
||||
(let ((result (vim:ex-complete-argument arg predicate flag)))
|
||||
(cond
|
||||
((null result) nil)
|
||||
((eq t result) t)
|
||||
((stringp result) (if flag result (concat range cmd spaces result)))
|
||||
((listp result) (if flag result (mapcar #'(lambda (x) (concat range cmd spaces x)) result)))
|
||||
(t (error "Completion returned unexpected value."))))))))
|
||||
|
||||
|
||||
(defun vim:ex-complete-command (cmd predicate flag)
|
||||
;; completes the command
|
||||
(with-current-buffer vim:ex-current-buffer
|
||||
(cond
|
||||
((null flag) (or (try-completion cmd vim:ex-local-commands predicate)
|
||||
(try-completion cmd vim:ex-commands predicate)))
|
||||
|
||||
((eq t flag) (or (all-completions cmd vim:ex-local-commands predicate)
|
||||
(all-completions cmd vim:ex-commands predicate)))
|
||||
|
||||
((eq 'lambda flag) (or (vim:test-completion cmd vim:ex-local-commands predicate)
|
||||
(vim:test-completion cmd vim:ex-commands predicate))))))
|
||||
|
||||
(defun vim:ex-complete-argument (arg predicate flag)
|
||||
;; completes the argument
|
||||
(let ((cmd vim:ex-cmd))
|
||||
(while (stringp cmd)
|
||||
(setq cmd (vim:ex-binding cmd)))
|
||||
|
||||
(if (null cmd) (ding)
|
||||
(case (vim:cmd-arg cmd)
|
||||
(file
|
||||
(vim:ex-complete-file-argument arg predicate flag))
|
||||
(buffer
|
||||
(vim:ex-complete-buffer-argument arg predicate flag))
|
||||
((t)
|
||||
(vim:ex-complete-text-argument arg predicate flag))
|
||||
(t (ding))))))
|
||||
|
||||
(defun vim:ex-complete-file-argument (arg predicate flag)
|
||||
;; completes a file-name
|
||||
(if (null arg)
|
||||
default-directory
|
||||
(let ((dir (or (file-name-directory arg)
|
||||
(with-current-buffer vim:ex-current-buffer default-directory)))
|
||||
(fname (file-name-nondirectory arg)))
|
||||
(cond
|
||||
((null dir) (ding))
|
||||
((null flag)
|
||||
(let ((result (file-name-completion fname dir)))
|
||||
(case result
|
||||
((nil) nil)
|
||||
((t) t)
|
||||
(t (concat dir result)))))
|
||||
|
||||
((eq t flag)
|
||||
(file-name-all-completions fname dir))
|
||||
|
||||
((eq 'lambda flag)
|
||||
(eq (file-name-completion fname dir) t))))))
|
||||
|
||||
(defun vim:ex-complete-buffer-argument (arg predicate flag)
|
||||
;; completes a buffer name
|
||||
(when arg
|
||||
(let ((buffers (mapcar #'(lambda (buffer) (cons (buffer-name buffer) nil)) (buffer-list t))))
|
||||
(cond
|
||||
((null flag)
|
||||
(try-completion arg buffers predicate))
|
||||
((eq t flag)
|
||||
(all-completions arg buffers predicate))
|
||||
((eq 'lambda flag)
|
||||
(vim:test-completion arg buffers predicate))))))
|
||||
|
||||
(defun vim:ex-complete-text-argument (arg predicate flag)
|
||||
;; completes an arbitrary text-argument
|
||||
(when arg
|
||||
(case flag
|
||||
((nil) t)
|
||||
((t) (list arg))
|
||||
('lambda t))))
|
||||
|
||||
(defun vim:ex-execute-command (cmdline)
|
||||
(interactive)
|
||||
|
||||
(multiple-value-bind (range cmd spaces arg beg end) (vim:ex-split-cmdline cmdline)
|
||||
(setq vim:ex-cmd cmd)
|
||||
|
||||
(let ((cmd vim:ex-cmd)
|
||||
(motion (cond
|
||||
((and beg end)
|
||||
(vim:make-motion :begin (save-excursion
|
||||
(goto-line beg)
|
||||
(line-beginning-position))
|
||||
:end (save-excursion
|
||||
(goto-line end)
|
||||
(line-beginning-position))
|
||||
:has-begin t
|
||||
:type 'linewise))
|
||||
(beg
|
||||
(vim:make-motion :begin (save-excursion
|
||||
(goto-line beg)
|
||||
(line-beginning-position))
|
||||
:end (save-excursion
|
||||
(goto-line beg)
|
||||
(line-beginning-position))
|
||||
:has-begin t
|
||||
:type 'linewise))))
|
||||
(count (and (not end) beg)))
|
||||
|
||||
(while (stringp cmd)
|
||||
(setq cmd (vim:ex-binding cmd)))
|
||||
|
||||
(when (zerop (length arg))
|
||||
(setq arg nil))
|
||||
|
||||
(with-current-buffer vim:ex-current-buffer
|
||||
(cond
|
||||
(cmd (case (vim:cmd-type cmd)
|
||||
('complex
|
||||
(if (vim:cmd-arg-p cmd)
|
||||
(funcall cmd :motion motion :argument arg)
|
||||
(funcall cmd :motion motion)))
|
||||
('simple
|
||||
(when end
|
||||
(error "Command does not take a range: %s" vim:ex-cmd))
|
||||
(if (vim:cmd-arg-p cmd)
|
||||
(if (vim:cmd-count-p cmd)
|
||||
(funcall cmd :count beg :argument arg)
|
||||
(funcall cmd :argument arg))
|
||||
(if (vim:cmd-count-p cmd)
|
||||
(funcall cmd :count count)
|
||||
(funcall cmd))))
|
||||
(t (error "Unexpected command-type bound to %s" vim:ex-cmd))))
|
||||
(beg (vim:motion-go-to-first-non-blank-beg :count (or end beg)))
|
||||
(t (ding)))))))
|
||||
|
||||
|
||||
;; parser for ex-commands
|
||||
(defun vim:ex-parse (text)
|
||||
"Extracts the range-information from `text'.
|
||||
Returns a list of up to three elements: (cmd beg end)"
|
||||
(let (begin
|
||||
(begin-off 0)
|
||||
sep
|
||||
end
|
||||
(end-off 0)
|
||||
(pos 0)
|
||||
(cmd nil))
|
||||
|
||||
(multiple-value-bind (beg npos) (vim:ex-parse-address text pos)
|
||||
(when npos
|
||||
(setq begin beg
|
||||
pos npos)))
|
||||
|
||||
(multiple-value-bind (off npos) (vim:ex-parse-offset text pos)
|
||||
(when npos
|
||||
(unless begin (setq begin 'current-line))
|
||||
(setq begin-off off
|
||||
pos npos)))
|
||||
|
||||
(when (and (< pos (length text))
|
||||
(or (= (aref text pos) ?\,)
|
||||
(= (aref text pos) ?\;)))
|
||||
(setq sep (aref text pos))
|
||||
(incf pos)
|
||||
(multiple-value-bind (e npos) (vim:ex-parse-address text pos)
|
||||
(when npos
|
||||
(setq end e
|
||||
pos npos)))
|
||||
|
||||
(multiple-value-bind (off npos) (vim:ex-parse-offset text pos)
|
||||
(when npos
|
||||
(unless end (setq end 'current-line))
|
||||
(setq end-off off
|
||||
pos npos))))
|
||||
|
||||
;; handle the special '%' range
|
||||
(when (or (eq begin 'all) (eq end 'all))
|
||||
(setq begin 'first-line
|
||||
begin-off 0
|
||||
end 'last-line
|
||||
end-off 0
|
||||
sep ?,))
|
||||
|
||||
(when (= pos (or (string-match "[a-zA-Z0-9!]+" text pos) -1))
|
||||
(setq cmd (cons (match-beginning 0) (match-end 0))))
|
||||
|
||||
(multiple-value-bind (start end) (vim:ex-get-range (and begin (cons begin begin-off)) sep (and end (cons end end-off)))
|
||||
(values cmd start end))))
|
||||
|
||||
|
||||
(defun vim:ex-parse-address (text pos)
|
||||
(cond
|
||||
((>= pos (length text)) nil)
|
||||
|
||||
((= pos (or (string-match "[0-9]+" text pos) -1))
|
||||
(values (cons 'abs (string-to-number (match-string 0 text)))
|
||||
(match-end 0)))
|
||||
|
||||
((= (aref text pos) ?$)
|
||||
(values (cons 'abs (line-number-at-pos (point-max))) (1+ pos)))
|
||||
|
||||
((= (aref text pos) ?\%)
|
||||
(values 'all (1+ pos)))
|
||||
|
||||
((= (aref text pos) ?.)
|
||||
(values 'current-line (1+ pos)))
|
||||
|
||||
((= (aref text pos) ?')
|
||||
(if (>= (1+ pos) (length text))
|
||||
nil
|
||||
(values `(mark ,(aref text (1+ pos))) (+ 2 pos))))
|
||||
|
||||
((= (aref text pos) ?/)
|
||||
(when (string-match "\\([^/]+\\|\\\\.\\)\\(?:/\\|$\\)"
|
||||
text (1+ pos))
|
||||
(values (cons 're-fwd (match-string 1 text))
|
||||
(match-end 0))))
|
||||
|
||||
((= (aref text pos) ??)
|
||||
(when (string-match "\\([^?]+\\|\\\\.\\)\\(?:?\\|$\\)"
|
||||
text (1+ pos))
|
||||
(values (cons 're-bwd (match-string 1 text))
|
||||
(match-end 0))))
|
||||
|
||||
((and (= (aref text pos) ?\\)
|
||||
(< pos (1- (length text))))
|
||||
(case (aref text (1+ pos))
|
||||
(?/ (values 'next-of-prev-search (1+ pos)))
|
||||
(?? (values 'prev-of-prev-search (1+ pos)))
|
||||
(?& (values 'next-of-prev-subst (1+ pos)))))
|
||||
|
||||
(t nil)))
|
||||
|
||||
|
||||
(defun vim:ex-parse-offset (text pos)
|
||||
(let ((off nil))
|
||||
(while (= pos (or (string-match "\\([-+]\\)\\([0-9]+\\)?" text pos) -1))
|
||||
(if (string= (match-string 1 text) "+")
|
||||
(setq off (+ (or off 0) (if (match-beginning 2)
|
||||
(string-to-number (match-string 2 text))
|
||||
1)))
|
||||
|
||||
(setq off (- (or off 0) (if (match-beginning 2)
|
||||
(string-to-number (match-string 2 text))
|
||||
1))))
|
||||
(setq pos (match-end 0)))
|
||||
(and off (values off pos))))
|
||||
|
||||
|
||||
(defun vim:ex-get-range (start sep end)
|
||||
(with-current-buffer vim:ex-current-buffer
|
||||
(when start
|
||||
(setq start (vim:ex-get-line start)))
|
||||
|
||||
(when (and sep end)
|
||||
(save-excursion
|
||||
(when (= sep ?\;) (goto-line start))
|
||||
(setq end (vim:ex-get-line end))))
|
||||
|
||||
(values start end)))
|
||||
|
||||
|
||||
(defun vim:ex-get-line (address)
|
||||
(let ((base (car address))
|
||||
(offset (cdr address)))
|
||||
|
||||
(cond
|
||||
((null base) nil)
|
||||
((consp offset)
|
||||
(let ((line (vim:ex-get-line (car address))))
|
||||
(when line
|
||||
(save-excursion
|
||||
(goto-line line)
|
||||
(vim:ex-get-line (cdr address))))))
|
||||
|
||||
(t
|
||||
(+ offset
|
||||
(case (or (car-safe base) base)
|
||||
(abs (cdr base))
|
||||
|
||||
;; TODO: (1- ...) may be wrong if the match is the empty string
|
||||
(re-fwd (save-excursion
|
||||
(beginning-of-line 2)
|
||||
(and (re-search-forward (cdr base))
|
||||
(line-number-at-pos (1- (match-end 0))))))
|
||||
|
||||
(re-bwd (save-excursion
|
||||
(beginning-of-line 0)
|
||||
(and (re-search-backward (cdr base))
|
||||
(line-number-at-pos (match-beginning 0)))))
|
||||
|
||||
(current-line (line-number-at-pos (point)))
|
||||
(first-line (line-number-at-pos (point-min)))
|
||||
(last-line (line-number-at-pos (point-max)))
|
||||
(mark (line-number-at-pos (vim:get-local-mark (cadr base))))
|
||||
(next-of-prev-search (error "Next-of-prev-search not yet implemented."))
|
||||
(prev-of-prev-search (error "Prev-of-prev-search not yet implemented."))
|
||||
(next-of-prev-subst (error "Next-of-prev-subst not yet implemented."))
|
||||
(t (error "Invalid address: %s" address))))))))
|
||||
|
||||
|
||||
(defun vim:ex-read-command (&optional initial-input)
|
||||
"Starts ex-mode."
|
||||
(interactive)
|
||||
(let ((vim:ex-current-buffer (current-buffer)))
|
||||
(let ((minibuffer-local-completion-map vim:ex-keymap))
|
||||
(let ((result (completing-read ":" 'vim:ex-complete nil nil initial-input 'vim:ex-history)))
|
||||
(when (and result
|
||||
(not (zerop (length result))))
|
||||
(vim:ex-execute-command result))))))
|
||||
|
||||
(provide 'vim-ex)
|
||||
|
||||
;;; vim-ex.el ends here
|
||||
79
.emacs.d/vim-mode/vim-insert-mode.el
Normal file
79
.emacs.d/vim-mode/vim-insert-mode.el
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
;;; vim-insert-mode.el - VIM insert-mode.
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; TODO :
|
||||
;; - for some reason GNU Emacs does not show '-- REPLACE --'
|
||||
|
||||
;;; Code:
|
||||
|
||||
(vim:deflocalvar vim:last-insert-undo nil)
|
||||
|
||||
(defcustom vim:insert-mode-replace-cursor 'hbar
|
||||
"Cursor for replace-mode."
|
||||
:group 'vim-mode)
|
||||
|
||||
(vim:define-keymap insert-mode "insert-mode" :map-command imap)
|
||||
|
||||
(vim:define-mode insert "VIM insert-mode"
|
||||
:ident "I"
|
||||
:message "-- INSERT --"
|
||||
:keymaps '(vim:insert-mode-keymap)
|
||||
:command-function 'vim:insert-mode-command
|
||||
:cursor 'bar)
|
||||
(add-hook 'vim:insert-mode-on-hook 'vim:insert-mode-activated)
|
||||
(add-hook 'vim:insert-mode-off-hook 'vim:insert-mode-deactivated)
|
||||
|
||||
(vim:defcmd vim:insert-mode-toggle-replace ()
|
||||
"Toggles overwrite-mode in insert-mode."
|
||||
(unless (vim:insert-mode-p)
|
||||
(error "Toggling overwrite-mode only allowed in insert-mode."))
|
||||
(overwrite-mode nil)
|
||||
(if overwrite-mode
|
||||
(progn
|
||||
(let (message-log-max) (message "-- REPLACE --"))
|
||||
(setq cursor-type vim:insert-mode-replace-cursor)
|
||||
(vim:update-mode-line "R"))
|
||||
(progn
|
||||
(let (message-log-max) (message "-- INSERT --"))
|
||||
(setq cursor-type vim:insert-mode-cursor)
|
||||
(vim:update-mode-line "I"))))
|
||||
|
||||
(defun vim:insert-mode-command (command)
|
||||
"Executes a simple command in insert mode."
|
||||
(case (vim:cmd-type command)
|
||||
('simple (vim:normal-execute-simple-command command))
|
||||
('complex (error "No complex command allowed in insert-mode."))
|
||||
(t (vim:normal-execute-motion command))))
|
||||
|
||||
(defun vim:insert-mode-activated ()
|
||||
"Called when insert-mode is activated."
|
||||
(overwrite-mode -1)
|
||||
(setq vim:last-insert-undo vim:last-undo)
|
||||
(add-hook 'pre-command-hook 'vim:insert-save-key-sequence))
|
||||
|
||||
(defun vim:insert-mode-deactivated ()
|
||||
"Called when insert-mode is deactivated."
|
||||
(overwrite-mode -1)
|
||||
(vim:set-mark ?^)
|
||||
(remove-hook 'pre-command-hook 'vim:insert-save-key-sequence)
|
||||
;; the command that has just ended insert-mode should NOT be repeatable
|
||||
;; and will therefore NOT override repeat-sequence.
|
||||
(setq vim:repeat-events (vconcat vim:repeat-events
|
||||
vim:current-key-sequence))
|
||||
(setq vim:last-undo vim:last-insert-undo))
|
||||
|
||||
(defun vim:insert-save-key-sequence ()
|
||||
"Called in insert-mode to save key-events."
|
||||
(when (and (vim:toplevel-execution)
|
||||
(not (eq this-command 'vim:intercept-ESC)))
|
||||
(setq vim:current-key-sequence (vconcat vim:current-key-sequence
|
||||
(vim:this-command-keys)))))
|
||||
|
||||
(provide 'vim-insert-mode)
|
||||
|
||||
;;; vim-insert-mode.el ends here
|
||||
144
.emacs.d/vim-mode/vim-keymap.el
Normal file
144
.emacs.d/vim-mode/vim-keymap.el
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
;;; vim-keymap.el - Basic keymapping for vim-mode
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defmacro vim:kbdmacro-to-command (events)
|
||||
"Creates a command passing prefix-argument to given keyboard-macro `events'."
|
||||
(let ((arg (gensym)))
|
||||
`(lambda (,arg)
|
||||
(interactive "P")
|
||||
(execute-kbd-macro
|
||||
(if ,arg
|
||||
(vconcat (number-to-string (prefix-numeric-value ,arg))
|
||||
,events)
|
||||
,events)))))
|
||||
|
||||
|
||||
(defun* vim:map (keys command &key (keymap nil))
|
||||
"Maps the sequence of events `keys' to a `command' in a certain
|
||||
`keymap.'"
|
||||
(if (or (stringp command)
|
||||
(vectorp command))
|
||||
(lexical-let ((kbdevents command))
|
||||
(define-key keymap keys (vim:kbdmacro-to-command kbdevents)))
|
||||
(define-key keymap keys command)))
|
||||
|
||||
(defun vim:make-keymap (&optional parent)
|
||||
"Creates a new keymap with a certain `parent' keymap."
|
||||
(let ((kmap (make-sparse-keymap)))
|
||||
(when parent (set-keymap-parent kmap parent))
|
||||
kmap))
|
||||
|
||||
(defmacro vim:define-keymap (name
|
||||
doc
|
||||
&key
|
||||
map-command)
|
||||
"Defines global and local keymaps for a mode with name
|
||||
vim:`name'-[local-]keymap and a map command vim:`map-command'
|
||||
and vim:local-`map-command'."
|
||||
(let ((glbkeym (concat "vim:" (symbol-name name) "-keymap"))
|
||||
(lockeym (concat "vim:" (symbol-name name) "-local-keymap")))
|
||||
`(progn
|
||||
(defconst ,(intern glbkeym) (vim:make-keymap)
|
||||
,(concat "VIM global keymap: " doc))
|
||||
(defconst ,(intern lockeym) (vim:make-keymap)
|
||||
,(concat "VIM buffer local keymap: " doc))
|
||||
,@(when map-command
|
||||
`((defsubst ,(intern (concat "vim:" (symbol-name map-command)))
|
||||
(keys command)
|
||||
,(concat "Maps the sequence of events `keys' to a `command' in keymap "
|
||||
glbkeym)
|
||||
(vim:map keys command :keymap ,(intern glbkeym)))
|
||||
(defsubst ,(intern (concat "vim:local-" (symbol-name map-command)))
|
||||
(keys command)
|
||||
,(concat "Maps the sequence of events `keys' to a `command' in keymap "
|
||||
lockeym)
|
||||
(vim:map keys command :keymap ,(intern lockeym))))))))
|
||||
(font-lock-add-keywords 'emacs-lisp-mode '("vim:define-keymap"))
|
||||
|
||||
|
||||
|
||||
|
||||
;; Interception of ESC event. The ESC event is intercepted. If not
|
||||
;; followed by another key, i.e. not used as a prefix-key, the event
|
||||
;; [escape] is sent, otherwise the interception-keymap is disabled for
|
||||
;; the next command and the ESC event is resent.
|
||||
(defcustom vim:intercept-ESC-timeout 0.1
|
||||
"Time in seconds to wait for another key after an ESC event."
|
||||
:group 'vim-mode)
|
||||
|
||||
(defconst vim:intercept-ESC-keymap (make-sparse-keymap)
|
||||
"Keymap to map ESC to [escape].")
|
||||
|
||||
(define-minor-mode vim:intercept-ESC-mode
|
||||
"VIM minor mode to capture ESC."
|
||||
nil nil nil)
|
||||
|
||||
;; This function is defined in vim:compat.el
|
||||
;; (defun vim:intercept-ESC () ...)
|
||||
|
||||
(defun vim:enable-intercept-ESC ()
|
||||
"Enables interception of ESC after executing a (prefix-)command."
|
||||
(unless (eq this-command 'vim:intercept-ESC)
|
||||
(remove-hook 'pre-command-hook 'vim:enable-intercept-ESC)
|
||||
(vim:intercept-ESC-mode 1)))
|
||||
|
||||
;; Catch '\e' and convert it to [escape] if not used as prefix key.
|
||||
(vim:map (kbd "ESC") 'vim:intercept-ESC :keymap vim:intercept-ESC-keymap)
|
||||
|
||||
|
||||
;; The override keymap, useful especially in normal-mode.
|
||||
(defconst vim:override-keymap (make-keymap)
|
||||
"Global parent keymap to override some Emacs default bindings.")
|
||||
(suppress-keymap vim:override-keymap)
|
||||
(vim:map (kbd "ESC ESC ESC")
|
||||
(lambda ()
|
||||
"Exits any VIM mode and returns to normal-mode."
|
||||
(interactive)
|
||||
(vim:activate-normal-mode)
|
||||
(ding))
|
||||
:keymap vim:override-keymap)
|
||||
|
||||
|
||||
;; This function sets up the keymaps for the current mode.
|
||||
(defmacro vim:set-keymaps (mode-name keymaps)
|
||||
(when (eq (car-safe mode-name) 'quote)
|
||||
(setq mode-name (cadr mode-name)))
|
||||
(when (eq (car-safe keymaps) 'quote)
|
||||
(setq keymaps (cadr keymaps)))
|
||||
`(setq vim:emulation-mode-alist
|
||||
(list ,@(cons '(cons 'vim:intercept-ESC-mode vim:intercept-ESC-keymap)
|
||||
(mapcan #'(lambda (keym)
|
||||
(let ((localname (intern (replace-regexp-in-string "mode-keymap" "mode-local-keymap"
|
||||
(symbol-name keym)))))
|
||||
(if (eq localname keym)
|
||||
(list `(cons ',mode-name ,keym))
|
||||
(list `(cons ',mode-name ,localname)
|
||||
`(cons ',mode-name ,keym)))))
|
||||
keymaps)))))
|
||||
|
||||
;; TODO: This function is currently empty and serves only as hook for
|
||||
;; defadvice.
|
||||
(defun vim:reset-key-state ()
|
||||
"Resets the current internal key-state."
|
||||
nil)
|
||||
|
||||
(vim:deflocalvar vim:current-key-sequence nil
|
||||
"The key-sequence of the current command.")
|
||||
|
||||
(vim:deflocalvar vim:new-buffer nil
|
||||
"The buffer the be made current at the end of key-handline.")
|
||||
|
||||
(defun vim:clear-key-sequence ()
|
||||
"Clears the internal log of key-sequences."
|
||||
(setq vim:current-key-sequence nil))
|
||||
|
||||
(provide 'vim-keymap)
|
||||
|
||||
;;; vim-keymap.el ends here
|
||||
364
.emacs.d/vim-mode/vim-maps.el
Normal file
364
.emacs.d/vim-mode/vim-maps.el
Normal file
|
|
@ -0,0 +1,364 @@
|
|||
;;; vim-maps.el
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file contains all standard keymaps. Key mappings are defined
|
||||
;; using one of the following vim-like macros:
|
||||
|
||||
;; - vim:map ... general mapping in an arbitrary mode
|
||||
;; - vim:nmap ... mapping in the normal-mode keymap
|
||||
;; - vim:omap ... mapping in the operator-pending keymap
|
||||
;; - vim:imap ... mapping in the insert-mode keymap
|
||||
;; - vim:vmap ... mapping in the visual-mode keymap
|
||||
;; - vim:emap ... mapping in the ex-mode keymap
|
||||
;;
|
||||
;; Furthermore, for each of these map-function there's a buffer-local
|
||||
;; variant
|
||||
;;
|
||||
;; - vim:local-nmap ... mapping in the normal-mode local keymap
|
||||
;; - vim:local-omap ... mapping in the operator-pending local keymap
|
||||
;; - vim:local-imap ... mapping in the insert-mode local keymap
|
||||
;; - vim:local-vmap ... mapping in the visual-mode local keymap
|
||||
;; - vim:local-emap ... mapping in the ex-mode local keymap
|
||||
;;
|
||||
;; The local versions should be used to define mode specific bindings
|
||||
;; as local-set-key would do.
|
||||
;;
|
||||
;; Commands should usually be placed in the normal-mode keymap.
|
||||
;; Motions should be placed in the operator-pending keymap. All
|
||||
;; commands in the operator-pending-keymap are available as
|
||||
;; operator-pending in normal-mode and visual-mode (but may be
|
||||
;; overwritten by the corresponding keymaps) and as motion-arguments
|
||||
;; for complex commands in normal-mode.
|
||||
;;
|
||||
;; A mapping has one of the following two forms:
|
||||
;;
|
||||
;; (vim:map KEYEVENTS 'my-command)
|
||||
;;
|
||||
;; (vim:map KEYEVENTS MAPEVENTS)
|
||||
;;
|
||||
;; The first form maps the events in KEYEVENTS to the command
|
||||
;; my-command. The second form defines a vim-like mapping of
|
||||
;; KEYEVENTS to MAPEVENTS, i.e. the activation of KEYEVENTS invokes
|
||||
;; the (key-)events in MAPEVENTS.
|
||||
;;
|
||||
;; KEYEVENTS is a usual Emacs-sequence of events as it would be used by
|
||||
;; define-key.
|
||||
|
||||
;;; TODO:
|
||||
;; - better mapping to support stuff like
|
||||
;; (vim:def-map "c" "d{motion}a")
|
||||
;;
|
||||
;; - because of this, mapping "cc" to "0C" does not work with a
|
||||
;; count since the count is eaten by the '0'
|
||||
;;
|
||||
;; - similarily 'o' and 'O' won't work
|
||||
;;
|
||||
;; - should we have a 'deep-mapping' function: for example, "x" is
|
||||
;; mapped to "dl" in the default keymap. If someone decides to
|
||||
;; redefine "l" to some other command, "x" will change its
|
||||
;; behaviour, too. A 'deep-mapping' should save the mapping on
|
||||
;; definition of "x", therefor let "x" behave as usual even after
|
||||
;; redefining "l"
|
||||
|
||||
;;; Code:
|
||||
|
||||
(vim:nmap "\\" 'vim:cmd-emacs)
|
||||
|
||||
(vim:nmap (kbd "C-z") 'vim:activate-emacs-mode)
|
||||
(vim:map (kbd "C-z") 'vim:activate-normal-mode :keymap vim:emacs-keymap)
|
||||
|
||||
(vim:omap [escape] 'vim:operator-pending-mode-exit)
|
||||
(vim:omap "0" 'vim:motion-beginning-of-line-or-digit-argument)
|
||||
(vim:omap "1" 'digit-argument)
|
||||
(vim:omap "2" 'digit-argument)
|
||||
(vim:omap "3" 'digit-argument)
|
||||
(vim:omap "4" 'digit-argument)
|
||||
(vim:omap "5" 'digit-argument)
|
||||
(vim:omap "6" 'digit-argument)
|
||||
(vim:omap "7" 'digit-argument)
|
||||
(vim:omap "8" 'digit-argument)
|
||||
(vim:omap "9" 'digit-argument)
|
||||
(vim:nmap "\"" 'vim:select-register)
|
||||
|
||||
(vim:nmap "ZZ" 'vim:cmd-write-and-close)
|
||||
|
||||
(vim:mmap "h" 'vim:motion-left)
|
||||
(vim:mmap "l" 'vim:motion-right)
|
||||
(vim:mmap "^" 'vim:motion-first-non-blank)
|
||||
(vim:mmap "$" 'vim:motion-end-of-line)
|
||||
(vim:mmap "g_" 'vim:motion-last-non-blank)
|
||||
|
||||
(vim:mmap "k" 'vim:motion-up)
|
||||
(vim:mmap "j" 'vim:motion-down)
|
||||
(vim:mmap "-" "k^")
|
||||
(vim:mmap "+" "j^")
|
||||
(vim:mmap "G" 'vim:motion-go-to-first-non-blank-end)
|
||||
(vim:mmap "gg" 'vim:motion-go-to-first-non-blank-beg)
|
||||
|
||||
(vim:mmap "w" 'vim:motion-fwd-word)
|
||||
(vim:mmap "W" 'vim:motion-fwd-WORD)
|
||||
(vim:mmap "e" 'vim:motion-fwd-word-end)
|
||||
(vim:mmap "E" 'vim:motion-fwd-WORD-end)
|
||||
(vim:mmap "b" 'vim:motion-bwd-word)
|
||||
(vim:mmap "B" 'vim:motion-bwd-WORD)
|
||||
(vim:mmap "ge" 'vim:motion-bwd-word-end)
|
||||
(vim:mmap "gE" 'vim:motion-bwd-WORD-end)
|
||||
|
||||
(vim:mmap "(" 'vim:motion-bwd-sentence)
|
||||
(vim:mmap ")" 'vim:motion-fwd-sentence)
|
||||
(vim:mmap "{" 'vim:motion-bwd-paragraph)
|
||||
(vim:mmap "}" 'vim:motion-fwd-paragraph)
|
||||
(vim:mmap "]]" 'vim:motion-fwd-section)
|
||||
(vim:mmap "][" 'vim:motion-fwd-section)
|
||||
(vim:mmap "[[" 'vim:motion-bwd-section)
|
||||
(vim:mmap "[]" 'vim:motion-bwd-section)
|
||||
|
||||
(vim:omap "f" 'vim:motion-find)
|
||||
(vim:omap "F" 'vim:motion-find-back)
|
||||
(vim:omap "t" 'vim:motion-find-to)
|
||||
(vim:omap "T" 'vim:motion-find-back-to)
|
||||
(vim:omap ";" 'vim:motion-repeat-last-find)
|
||||
(vim:omap "," 'vim:motion-repeat-last-find-opposite)
|
||||
|
||||
(vim:omap "%" 'vim:motion-jump-item)
|
||||
|
||||
(vim:omap "'" 'vim:motion-mark-line)
|
||||
(vim:omap "`" 'vim:motion-mark)
|
||||
|
||||
(vim:omap "iw" 'vim:motion-inner-word)
|
||||
|
||||
;(vim:nmap "x" "dl")
|
||||
(vim:nmap "m" 'vim:cmd-set-mark)
|
||||
(vim:nmap "x" 'vim:cmd-delete-char)
|
||||
(vim:nmap "D" "d$")
|
||||
(vim:nmap "d" 'vim:cmd-delete)
|
||||
|
||||
(vim:nmap "C" 'vim:cmd-change-rest-of-line)
|
||||
(vim:nmap "c" 'vim:cmd-change)
|
||||
(vim:nmap "s" 'vim:cmd-change-char)
|
||||
|
||||
(vim:nmap "r" 'vim:cmd-replace-char)
|
||||
(vim:nmap "R" 'vim:cmd-replace)
|
||||
|
||||
(vim:nmap "y" 'vim:cmd-yank)
|
||||
(vim:nmap "Y" "yy")
|
||||
(vim:nmap "p" 'vim:cmd-paste-behind)
|
||||
(vim:nmap "P" 'vim:cmd-paste-before)
|
||||
|
||||
(vim:nmap "J" 'vim:cmd-join-lines)
|
||||
|
||||
(vim:nmap "/" 'vim:search-start)
|
||||
(vim:nmap "?" 'vim:search-start-backward)
|
||||
(vim:nmap "*" 'vim:search-word)
|
||||
(vim:nmap "#" 'vim:search-word-backward)
|
||||
(vim:nmap "g*" 'vim:search-unbounded-word)
|
||||
(vim:nmap "g#" 'vim:search-unbounded-word-backward)
|
||||
(vim:nmap "n" 'vim:search-repeat)
|
||||
(vim:nmap "N" 'vim:search-repeat-opposite)
|
||||
;; The next two maps are very special for an active search.
|
||||
(vim:map "n" 'vim:search-repeat :keymap vim:search-keymap)
|
||||
(vim:map "N" 'vim:search-repeat-opposite :keymap vim:search-keymap)
|
||||
|
||||
(vim:nmap "i" 'vim:cmd-insert)
|
||||
(vim:nmap "a" 'vim:cmd-append)
|
||||
(vim:nmap "I" 'vim:cmd-Insert)
|
||||
(vim:nmap "A" 'vim:cmd-Append)
|
||||
(vim:nmap "o" 'vim:cmd-insert-line-below)
|
||||
(vim:nmap "O" 'vim:cmd-insert-line-above)
|
||||
|
||||
(vim:nmap "u" 'vim:cmd-undo)
|
||||
(vim:nmap (kbd "C-r") 'vim:cmd-redo)
|
||||
|
||||
(vim:nmap "." 'vim:cmd-repeat)
|
||||
|
||||
(vim:nmap "=" 'vim:cmd-indent)
|
||||
(vim:nmap "<" 'vim:cmd-shift-left)
|
||||
(vim:nmap ">" 'vim:cmd-shift-right)
|
||||
|
||||
(vim:nmap "~" "g~l")
|
||||
(vim:nmap "g~" 'vim:cmd-toggle-case)
|
||||
(vim:nmap "gU" 'vim:cmd-make-upcase)
|
||||
(vim:nmap "gu" 'vim:cmd-make-downcase)
|
||||
|
||||
(vim:omap (kbd "C-e") 'vim:scroll-line-down)
|
||||
(vim:omap (kbd "C-d") 'vim:scroll-down)
|
||||
(vim:omap (kbd "C-f") 'vim:scroll-page-down)
|
||||
(vim:omap "z+" 'vim:scroll-bottom-line-to-top)
|
||||
|
||||
(vim:omap (kbd "C-y") 'vim:scroll-line-up)
|
||||
(vim:omap (kbd "C-u") 'vim:scroll-up)
|
||||
(vim:omap (kbd "C-b") 'vim:scroll-page-up)
|
||||
(vim:omap "z^" 'vim:scroll-top-line-to-bottom)
|
||||
|
||||
(vim:omap "zt" 'vim:scroll-line-to-top)
|
||||
(vim:omap (vconcat "z" [return]) "zt^")
|
||||
(vim:omap (kbd "z RET") (vconcat "z" [return]))
|
||||
(vim:omap "zz" 'vim:scroll-line-to-center)
|
||||
(vim:omap "z." "z.^")
|
||||
(vim:omap "zb" 'vim:scroll-line-to-bottom)
|
||||
(vim:omap "z-" "zb^")
|
||||
|
||||
|
||||
(vim:wmap (kbd "C-w +") 'vim:window-increase-height)
|
||||
(vim:wmap (kbd "C-w -") 'vim:window-decrease-height)
|
||||
(vim:wmap (kbd "C-w =") 'vim:window-balance)
|
||||
(vim:wmap (kbd "C-w >") 'vim:window-increase-width)
|
||||
(vim:wmap (kbd "C-w <") 'vim:window-decrease-width)
|
||||
(vim:wmap (kbd "C-w H") 'vim:window-move-far-left)
|
||||
(vim:wmap (kbd "C-w J") 'vim:window-move-very-bottom)
|
||||
(vim:wmap (kbd "C-w K") 'vim:window-move-very-top)
|
||||
(vim:wmap (kbd "C-w L") 'vim:window-move-far-right)
|
||||
(vim:wmap (kbd "C-w R") 'vim:window-rotate-upwards)
|
||||
(vim:wmap (kbd "C-w C-R") (kbd "C-w R"))
|
||||
(vim:wmap (kbd "C-w r") 'vim:window-rotate-downwards)
|
||||
(vim:wmap (kbd "C-w C-r") (kbd "C-w r"))
|
||||
(vim:wmap (kbd "C-w _") 'vim:window-set-height)
|
||||
(vim:wmap (kbd "C-w C-_") (kbd "C-w _"))
|
||||
(vim:wmap (kbd "C-w |") 'vim:window-set-width)
|
||||
(vim:wmap (kbd "C-w b") 'vim:window-bottom-right)
|
||||
(vim:wmap (kbd "C-w C-b") (kbd "C-w b"))
|
||||
(vim:wmap (kbd "C-w t") 'vim:window-top-left)
|
||||
(vim:wmap (kbd "C-w C-t") (kbd "C-w t"))
|
||||
(vim:wmap (kbd "C-w c") 'vim:window-close)
|
||||
(vim:wmap (kbd "C-w h") 'vim:window-left)
|
||||
(vim:wmap (kbd "C-w C-h") (kbd "C-w h"))
|
||||
(vim:wmap (kbd "C-w j") 'vim:window-down)
|
||||
(vim:wmap (kbd "C-w C-j") (kbd "C-w j"))
|
||||
(vim:wmap (kbd "C-w k") 'vim:window-up)
|
||||
(vim:wmap (kbd "C-w C-k") (kbd "C-w k"))
|
||||
(vim:wmap (kbd "C-w l") 'vim:window-right)
|
||||
(vim:wmap (kbd "C-w C-l") (kbd "C-w l"))
|
||||
(vim:wmap (kbd "C-w p") 'vim:window-lru)
|
||||
(vim:wmap (kbd "C-w C-p") (kbd "C-w p"))
|
||||
(vim:wmap (kbd "C-w w") 'vim:window-next)
|
||||
(vim:wmap (kbd "C-w C-w") (kbd "C-w w"))
|
||||
(vim:wmap (kbd "C-w W") 'vim:window-prev)
|
||||
(vim:wmap (kbd "C-w n") 'vim:window-new)
|
||||
(vim:wmap (kbd "C-w C-n") (kbd "C-w n"))
|
||||
(vim:wmap (kbd "C-w o") 'vim:window-only)
|
||||
(vim:wmap (kbd "C-w C-o") (kbd "C-w o"))
|
||||
(vim:wmap (kbd "C-w s") 'vim:window-split)
|
||||
(vim:wmap (kbd "C-w C-s") (kbd "C-w s"))
|
||||
(vim:wmap (kbd "C-w S") (kbd "C-w s"))
|
||||
(vim:wmap (kbd "C-w v") 'vim:window-vsplit)
|
||||
(vim:wmap (kbd "C-w C-v") (kbd "C-w v"))
|
||||
|
||||
(vim:nmap "v" 'vim:visual-toggle-normal)
|
||||
(vim:nmap "V" 'vim:visual-toggle-linewise)
|
||||
(vim:nmap (kbd "C-v") 'vim:visual-toggle-block)
|
||||
(vim:nmap "gv" 'vim:visual-mode-reactivate)
|
||||
|
||||
(vim:nmap ":" 'vim:ex-read-command)
|
||||
(vim:nmap "q" 'vim:cmd-toggle-macro-recording)
|
||||
(vim:nmap "@" 'vim:cmd-execute-macro)
|
||||
|
||||
|
||||
(vim:imap (vector vim:ESC-event) 'vim:insert-mode-exit)
|
||||
(vim:imap [insert] 'vim:insert-mode-toggle-replace)
|
||||
(vim:imap [kp-insert] [insert])
|
||||
(vim:imap [insertchar] [insert])
|
||||
|
||||
(vim:vmap (vector vim:ESC-event) 'vim:visual-mode-exit)
|
||||
(vim:vmap "v" 'vim:visual-toggle-normal)
|
||||
(vim:vmap "V" 'vim:visual-toggle-linewise)
|
||||
(vim:vmap (kbd "C-v") 'vim:visual-toggle-block)
|
||||
(vim:vmap "\"" 'vim:select-register)
|
||||
|
||||
(vim:vmap "d" 'vim:cmd-delete)
|
||||
(vim:vmap "D" 'vim:cmd-delete)
|
||||
(vim:vmap "x" 'vim:cmd-delete)
|
||||
|
||||
(vim:vmap "c" 'vim:cmd-change)
|
||||
(vim:vmap "C" "Vc")
|
||||
(vim:vmap "r" 'vim:cmd-replace-region)
|
||||
(vim:vmap "R" 'vim:cmd-change)
|
||||
(vim:vmap "s" 'vim:cmd-change)
|
||||
(vim:vmap "S" 'vim:cmd-change)
|
||||
|
||||
(vim:vmap "y" 'vim:cmd-yank)
|
||||
(vim:vmap "Y" 'vim:cmd-yank)
|
||||
|
||||
(vim:vmap "J" 'vim:cmd-join)
|
||||
|
||||
(vim:vmap "=" 'vim:cmd-indent)
|
||||
(vim:vmap "<" 'vim:cmd-shift-left)
|
||||
(vim:vmap ">" 'vim:cmd-shift-right)
|
||||
|
||||
(vim:vmap "~" 'vim:cmd-toggle-case)
|
||||
(vim:vmap "U" 'vim:cmd-make-upcase)
|
||||
(vim:vmap "u" 'vim:cmd-make-downcase)
|
||||
|
||||
(vim:vmap "I" 'vim:visual-insert)
|
||||
(vim:vmap "A" 'vim:visual-append)
|
||||
|
||||
(vim:vmap "o" 'vim:visual-exchange-point-and-mark)
|
||||
(vim:vmap "O" 'vim:visual-jump-point)
|
||||
|
||||
(vim:vmap ":" 'vim:visual-ex-read-command)
|
||||
|
||||
|
||||
|
||||
(vim:emap "edit" 'vim:cmd-edit)
|
||||
(vim:emap "e" "edit")
|
||||
(vim:emap "write" 'vim:cmd-write)
|
||||
(vim:emap "w" "write")
|
||||
(vim:emap "write!" 'vim:cmd-write-q)
|
||||
(vim:emap "w!" "write!")
|
||||
(vim:emap "wall" 'vim:cmd-write-all)
|
||||
(vim:emap "wa" "wall")
|
||||
(vim:emap "wall!" 'vim:cmd-write-all-q)
|
||||
(vim:emap "wa!" "wall!")
|
||||
(vim:emap "buffer" 'vim:cmd-buffer)
|
||||
(vim:emap "b" "buffer")
|
||||
|
||||
(vim:emap "split" 'vim:window-split)
|
||||
(vim:emap "sp" "split")
|
||||
(vim:emap "vsplit" 'vim:window-vsplit)
|
||||
(vim:emap "vs" "vsplit")
|
||||
(vim:emap "new" 'vim:window-new)
|
||||
(vim:emap "vnew" 'vim:window-vnew)
|
||||
(vim:emap "vne" "vnew")
|
||||
(vim:emap "close" 'vim:window-close)
|
||||
(vim:emap "clo" "close")
|
||||
(vim:emap "only" 'vim:window-only)
|
||||
(vim:emap "on" "only")
|
||||
(vim:emap "quit" 'vim:cmd-quit)
|
||||
(vim:emap "q" "quit")
|
||||
(vim:emap "quit!" 'vim:cmd-quit-q)
|
||||
(vim:emap "q!" "quit")
|
||||
(vim:emap "wq" 'vim:cmd-save-and-close)
|
||||
(vim:emap "wq!" 'vim:cmd-save-and-close-q)
|
||||
(vim:emap "quitall" 'vim:cmd-quit-all)
|
||||
(vim:emap "quita" "quitall")
|
||||
(vim:emap "qall" "quitall")
|
||||
(vim:emap "qa" "qall")
|
||||
(vim:emap "quitall!" 'vim:cmd-quit-all-q)
|
||||
(vim:emap "quita!" "quitall!")
|
||||
(vim:emap "qall!" "quitall!")
|
||||
(vim:emap "qa!" "qall!")
|
||||
(vim:emap "wqall" 'vim:cmd-save-and-quit)
|
||||
(vim:emap "wqa" "wqall")
|
||||
(vim:emap "xall" "wqall")
|
||||
(vim:emap "xa" "xall")
|
||||
(vim:emap "bdelete" 'vim:cmd-delete-buffer)
|
||||
(vim:emap "bd" "bdelete")
|
||||
(vim:emap "bdelete!" 'vim:cmd-delete-buffer-q)
|
||||
(vim:emap "bd!" "bdelete!")
|
||||
(vim:emap "substitute" 'vim:cmd-substitute)
|
||||
(vim:emap "s" "substitute")
|
||||
(vim:emap "marks" 'vim:cmd-show-marks)
|
||||
|
||||
|
||||
(vim:nmap (vector vim:down-mouse-1) 'vim:visual-mouse-clicked)
|
||||
(vim:vmap (vector vim:down-mouse-1) 'vim:visual-mouse-clicked)
|
||||
|
||||
(provide 'vim-maps)
|
||||
|
||||
;;; vim-maps.el ends here
|
||||
87
.emacs.d/vim-mode/vim-modes.el
Normal file
87
.emacs.d/vim-mode/vim-modes.el
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
;;; vim-modes.el
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(vim:deflocalvar vim:mode-string)
|
||||
(defun vim:update-mode-line (ident)
|
||||
"Updates the mode-line to show the specified identifier `ident'."
|
||||
(setq vim:mode-string (concat "<" (or ident "?") ">"))
|
||||
(force-mode-line-update))
|
||||
|
||||
|
||||
(defun vim:mode-name (mode)
|
||||
"Converts a mode-name to vim-mode naming conventions, e.g.
|
||||
'normal is converted to 'vim:normal-mode."
|
||||
(intern (concat "vim:" (symbol-name mode) "-mode")))
|
||||
|
||||
(vim:deflocalvar vim:active-mode nil
|
||||
"The currently active vim-mode.")
|
||||
|
||||
(vim:deflocalvar vim:active-command-function nil
|
||||
"The command function of the currently active vim-mode.")
|
||||
|
||||
(defun vim:activate-mode (mode)
|
||||
"Activates a certain vim-mode, disabling the currently active one."
|
||||
(when vim:active-mode
|
||||
(funcall vim:active-mode -1))
|
||||
(when mode
|
||||
(funcall (vim:mode-name mode) 1)))
|
||||
|
||||
|
||||
(defmacro* vim:define-mode (name doc
|
||||
&rest body
|
||||
&key
|
||||
ident
|
||||
message
|
||||
command-function
|
||||
(cursor ''box)
|
||||
keymaps)
|
||||
"Defines a new VIM-mode with certain `name', mode-line-identifier `ident',
|
||||
activation `message', a `command-function' to be called when a
|
||||
vim-command should be executed, a `cursor' shape and a list of `keymaps'."
|
||||
(let* ((mode-name (vim:mode-name name))
|
||||
(pred-name (intern (concat (symbol-name mode-name) "-p")))
|
||||
(on-name (intern (concat "vim:activate-" (symbol-name name) "-mode")))
|
||||
(cursor-name (intern (concat (symbol-name mode-name)
|
||||
"-cursor"))))
|
||||
`(progn
|
||||
(defcustom ,cursor-name ,cursor
|
||||
,(concat "The cursor-type for vim-mode " (symbol-name name) ".")
|
||||
:group 'vim-mode)
|
||||
|
||||
(define-minor-mode ,mode-name ,doc nil nil nil
|
||||
(when ,mode-name
|
||||
,@(when ident `((vim:update-mode-line ,ident)))
|
||||
,@(when message `((let (message-log-max) (message ,message))))
|
||||
(setq vim:active-mode ',mode-name)
|
||||
(setq vim:active-command-function
|
||||
,(if command-function
|
||||
command-function
|
||||
'vim:default-command-function))
|
||||
(vim:set-cursor ,cursor-name)
|
||||
(vim:set-keymaps ',mode-name ,keymaps))
|
||||
,@(progn
|
||||
(while (keywordp (car body)) (pop body) (pop body))
|
||||
body))
|
||||
|
||||
(defun ,pred-name ()
|
||||
,(concat "Returns t iff vim-mode is in " (symbol-name name) " mode.")
|
||||
(and ,mode-name t))
|
||||
|
||||
(defun ,on-name ()
|
||||
,(concat "Activates " (symbol-name name) " mode.")
|
||||
(interactive)
|
||||
(vim:activate-mode ',name)))))
|
||||
|
||||
(font-lock-add-keywords 'emacs-lisp-mode '("vim:define-mode"))
|
||||
|
||||
(provide 'vim-modes)
|
||||
|
||||
;;; vim-modes.el ends here
|
||||
|
||||
666
.emacs.d/vim-mode/vim-motions.el
Normal file
666
.emacs.d/vim-mode/vim-motions.el
Normal file
File diff suppressed because it is too large
Load diff
192
.emacs.d/vim-mode/vim-normal-mode.el
Normal file
192
.emacs.d/vim-mode/vim-normal-mode.el
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
;;; vim-insert-mode.el - VIM normal mode.
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
|
||||
;;; TODO:
|
||||
;; - bindings in local-omap keymap will not be seen as motions in
|
||||
;; normal-mode since the parent-keymap of the normal-mode keymap
|
||||
;; is operator-pending-keymap and not its local counterpart. The
|
||||
;; reason is that the binding of the local counterpart will be
|
||||
;; changed to a buffer-local binding.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defconst vim:operator-repeat-keymap (vim:make-keymap)
|
||||
"Keymap to bind the repeat-operator-event.")
|
||||
|
||||
(vim:define-keymap operator-pending-mode
|
||||
"operator pending mode"
|
||||
:map-command omap)
|
||||
|
||||
(vim:define-mode operator-pending "VIM operator-pending mode"
|
||||
:ident "O"
|
||||
:keymaps '(vim:operator-pending-mode-keymap
|
||||
vim:motion-mode-keymap
|
||||
vim:operator-repeat-keymap
|
||||
vim:override-keymap)
|
||||
:command-function 'vim:operator-pending-mode-command)
|
||||
|
||||
(add-hook 'vim:operator-pending-mode-hook 'vim:operator-pending-activate)
|
||||
(add-hook 'vim:operator-pending-mode-off-hook 'vim:operator-pending-deactivate)
|
||||
|
||||
(defun vim:operator-pending-activate ()
|
||||
(cond
|
||||
(vim:operator-pending-mode
|
||||
(setq vim:operator-repeat-last-event (vector last-command-event))
|
||||
(vim:map vim:operator-repeat-last-event 'vim:motion-lines
|
||||
:keymap vim:operator-repeat-keymap)
|
||||
(add-hook 'post-command-hook 'vim:operator-pending-mode-exit))
|
||||
|
||||
(vim:operator-repeat-last-event
|
||||
(vim:map vim:operator-repeat-last-event nil :keymap vim:operator-repeat-keymap))))
|
||||
|
||||
|
||||
(defun vim:operator-pending-deactivate ()
|
||||
(remove-hook 'post-command-hook 'vim:operator-pending-mode-exit))
|
||||
|
||||
(defun vim:operator-pending-mode-exit ()
|
||||
"Exits operator-pending-mode and returns to normal-mode."
|
||||
(interactive)
|
||||
(unless (or (vim:cmd-function this-command)
|
||||
(eq this-command 'digit-argument)
|
||||
(eq this-command 'universal-argument-other-key))
|
||||
(vim:activate-normal-mode)))
|
||||
|
||||
|
||||
(defun vim:operator-pending-mode-command (command)
|
||||
"Executes a complex command in operator-pending mode."
|
||||
(case (vim:cmd-type command)
|
||||
('simple (error "No simple-commands allowed in operator-pending mode."))
|
||||
('complex (error "No complex-commands allowed in operator-pending mode."))
|
||||
(t (vim:normal-execute-complex-command command)))
|
||||
|
||||
(when (vim:operator-pending-mode-p)
|
||||
(vim:activate-normal-mode)))
|
||||
|
||||
|
||||
(vim:define-keymap normal-mode "normal mode" &map-command nmap)
|
||||
|
||||
(vim:define-mode normal "VIM normal mode"
|
||||
:ident "N"
|
||||
:message "-- NORMAL --"
|
||||
:keymaps '(vim:normal-mode-keymap
|
||||
vim:operator-pending-mode-keymap
|
||||
vim:motion-mode-keymap
|
||||
vim:window-mode-keymap
|
||||
vim:override-keymap)
|
||||
:command-function 'vim:normal-mode-command)
|
||||
|
||||
(defun vim:normal-mode-command (command)
|
||||
"Executes a motion or simple-command or prepares a complex command."
|
||||
(case (vim:cmd-type command)
|
||||
('simple (vim:normal-execute-simple-command command))
|
||||
('complex (vim:normal-prepare-complex-command command))
|
||||
('special (error "no special so far"))
|
||||
(t (vim:normal-execute-motion command))))
|
||||
|
||||
|
||||
(defun vim:normal-execute-motion (command)
|
||||
"Executes a motion."
|
||||
(setq vim:current-motion command)
|
||||
|
||||
(when current-prefix-arg
|
||||
(setq vim:current-motion-count (prefix-numeric-value current-prefix-arg)))
|
||||
|
||||
(when (vim:cmd-char-arg-p command)
|
||||
(setq vim:current-motion-arg (read-char-exclusive)))
|
||||
|
||||
(vim:execute-current-motion)
|
||||
|
||||
(vim:reset-key-state)
|
||||
(vim:clear-key-sequence)
|
||||
(vim:adjust-point))
|
||||
|
||||
|
||||
(defun vim:normal-execute-simple-command (command)
|
||||
"Executes a simple command."
|
||||
(when current-prefix-arg
|
||||
(setq vim:current-cmd-count (prefix-numeric-value current-prefix-arg)))
|
||||
|
||||
(when (vim:cmd-char-arg-p command)
|
||||
(setq vim:current-cmd-arg (read-char-exclusive)))
|
||||
|
||||
(let ((parameters nil)
|
||||
(vim:last-undo buffer-undo-list))
|
||||
(when (vim:cmd-count-p command)
|
||||
(push vim:current-cmd-count parameters)
|
||||
(push :count parameters))
|
||||
(when (vim:cmd-char-arg-p command)
|
||||
(push vim:current-cmd-arg parameters)
|
||||
(push :argument parameters))
|
||||
(when (and (vim:cmd-register-p command)
|
||||
vim:current-register)
|
||||
(push vim:current-register parameters)
|
||||
(push :register parameters))
|
||||
(vim:apply-save-buffer (vim:cmd-function command) parameters)
|
||||
(when (vim:cmd-repeatable-p command)
|
||||
(setq vim:repeat-events (vconcat vim:current-key-sequence
|
||||
(vim:this-command-keys))))
|
||||
(vim:connect-undos vim:last-undo))
|
||||
|
||||
(vim:reset-key-state)
|
||||
(vim:clear-key-sequence)
|
||||
(vim:adjust-point))
|
||||
|
||||
|
||||
(defun vim:normal-prepare-complex-command (command)
|
||||
"Prepares a complex command, switching to operator-pending mode."
|
||||
(when current-prefix-arg
|
||||
(setq vim:current-cmd-count (prefix-numeric-value current-prefix-arg)))
|
||||
|
||||
(setq vim:current-cmd command)
|
||||
(setq vim:current-key-sequence (vconcat vim:current-key-sequence (vim:this-command-keys)))
|
||||
(vim:activate-operator-pending-mode))
|
||||
|
||||
(defun vim:normal-execute-complex-command (motion-command)
|
||||
"Executes a complex command with a certain motion command."
|
||||
(setq vim:current-motion motion-command)
|
||||
|
||||
(when current-prefix-arg
|
||||
(setq vim:current-motion-count (prefix-numeric-value current-prefix-arg)))
|
||||
|
||||
(when (or vim:current-motion-count vim:current-cmd-count)
|
||||
(setq vim:current-motion-count (* (or vim:current-cmd-count 1)
|
||||
(or vim:current-motion-count 1)))
|
||||
(setq vim:current-cmd-count nil))
|
||||
|
||||
(when (vim:cmd-char-arg-p motion-command)
|
||||
(setq vim:current-motion-arg (read-char-exclusive)))
|
||||
|
||||
(let ((vim:last-undo buffer-undo-list))
|
||||
(if (and (vim:cmd-register-p vim:current-cmd) vim:current-register)
|
||||
(vim:funcall-save-buffer (vim:cmd-function vim:current-cmd)
|
||||
:motion (vim:get-current-cmd-motion)
|
||||
:register vim:current-register)
|
||||
(vim:funcall-save-buffer (vim:cmd-function vim:current-cmd)
|
||||
:motion (vim:get-current-cmd-motion)))
|
||||
(when (vim:cmd-repeatable-p vim:current-cmd)
|
||||
(setq vim:repeat-events (vconcat vim:current-key-sequence
|
||||
(vim:this-command-keys))))
|
||||
(vim:connect-undos vim:last-undo))
|
||||
|
||||
(vim:reset-key-state)
|
||||
(vim:clear-key-sequence)
|
||||
(vim:adjust-point))
|
||||
|
||||
|
||||
(vim:define-mode operator-pending "VIM operator-pending mode"
|
||||
:ident "O"
|
||||
:keymaps '(vim:operator-pending-mode-keymap
|
||||
vim:motion-mode-keymap
|
||||
vim:operator-repeat-keymap
|
||||
vim:override-keymap)
|
||||
:command-function 'vim:operator-pending-mode-command)
|
||||
|
||||
(provide 'vim-normal-mode)
|
||||
|
||||
;;; vim-normal-mode.el ends here
|
||||
136
.emacs.d/vim-mode/vim-scroll.el
Normal file
136
.emacs.d/vim-mode/vim-scroll.el
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
;;; vim-scroll.el - Implementation of scrolling commands
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file contains implementations for the scrolling. Scroll
|
||||
;; operations are usually just simple commands and should not be
|
||||
;; repeatable but should keep visual mode.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(vim:define-keymap motion-mode "motion mode" :map-command mmap)
|
||||
|
||||
(vim:define-mode motion "VIM motion mode"
|
||||
:ident "M"
|
||||
:keymaps '(vim:motion-mode-keymap vim:window-mode-keymap)
|
||||
:command-function 'vim:normal-mode-command)
|
||||
|
||||
(defun vim:num-visible-lines ()
|
||||
"Returns the number of currently visible lines."
|
||||
(- (window-height) 1))
|
||||
|
||||
(defun vim:max-scroll-up ()
|
||||
"Returns the maximal number of lines that can be scrolled up."
|
||||
(1- (line-number-at-pos (window-start))))
|
||||
|
||||
(defun vim:max-scroll-down ()
|
||||
"Returns the maximal number of lines that can be scrolled down."
|
||||
(if (pos-visible-in-window-p (window-end))
|
||||
0
|
||||
(1+ (- (line-number-at-pos (point-max))
|
||||
(line-number-at-pos (window-end))))))
|
||||
|
||||
(vim:defcmd vim:scroll-line-up (count nonrepeatable keep-visual)
|
||||
"Scrolls the window `count' lines upwards."
|
||||
(vim:use-last-column)
|
||||
(scroll-down (or count 1)))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-line-down (count nonrepeatable keep-visual)
|
||||
"Scrolls the window `count' lines downwards."
|
||||
(vim:use-last-column)
|
||||
(scroll-up (or count 1)))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-up (count nonrepeatable keep-visual)
|
||||
"Scrolls the window and the cursor `count' lines upwards, default half of the screen."
|
||||
(vim:use-last-column)
|
||||
(let ((p (point))
|
||||
(c (or count (/ (vim:num-visible-lines) 2))))
|
||||
(save-excursion
|
||||
(scroll-down (min (vim:max-scroll-up) c)))
|
||||
(forward-line (- c))
|
||||
(when (= (line-number-at-pos p)
|
||||
(line-number-at-pos (point)))
|
||||
(ding))))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-down (count nonrepeatable keep-visual)
|
||||
"Scrolls the window and the cursor `count' lines downwards, default half of the screen."
|
||||
(vim:use-last-column)
|
||||
(let ((p (point))
|
||||
(c (or count (/ (vim:num-visible-lines) 2))))
|
||||
(save-excursion
|
||||
(scroll-up (min (vim:max-scroll-down) c)))
|
||||
(forward-line c)
|
||||
(when (= (line-number-at-pos p)
|
||||
(line-number-at-pos (point)))
|
||||
(ding))))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-page-up (count nonrepeatable keep-visual)
|
||||
"Scrolls the window `count' pages upwards."
|
||||
(vim:use-last-column)
|
||||
(condition-case nil
|
||||
(dotimes (i (or count 1))
|
||||
(scroll-down nil))
|
||||
(error (goto-char (point-min)))))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-page-down (count nonrepeatable keep-visual)
|
||||
"Scrolls the window `count' pages upwards."
|
||||
(vim:use-last-column)
|
||||
(condition-case nil
|
||||
(dotimes (i (or count 1))
|
||||
(scroll-up nil))
|
||||
(error (goto-char (point-max)))))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-line-to-top (count nonrepeatable keep-visual)
|
||||
"Scrolls line number `count' (or the cursor line) to the top of the window."
|
||||
(vim:use-last-column)
|
||||
(goto-line (or count (line-number-at-pos (point))))
|
||||
(recenter 0))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-line-to-center (count nonrepeatable keep-visual)
|
||||
"Scrolls line number `count' (or the cursor line) to the center of the window."
|
||||
(vim:use-last-column)
|
||||
(goto-line (or count (line-number-at-pos (point))))
|
||||
(recenter nil))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-line-to-bottom (count nonrepeatable keep-visual)
|
||||
"Scrolls line number `count' (or the cursor line) to the bottom of the window."
|
||||
(vim:use-last-column)
|
||||
(goto-line (or count (line-number-at-pos (point))))
|
||||
(recenter -1))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-bottom-line-to-top (count nonrepeatable keep-visual)
|
||||
"Scrolls the line right below the window or line `count' to the top of the window."
|
||||
(if count
|
||||
(goto-line count)
|
||||
(goto-char (window-end))
|
||||
(unless (bobp) (backward-char)))
|
||||
(recenter 0)
|
||||
(vim:motion-first-non-blank))
|
||||
|
||||
|
||||
(vim:defcmd vim:scroll-top-line-to-bottom (count nonrepeatable keep-visual)
|
||||
"Scrolls the line right below the window or line `count' to the top of the window."
|
||||
(if count
|
||||
(goto-line count)
|
||||
(goto-char (window-start)))
|
||||
(recenter -1)
|
||||
(vim:motion-first-non-blank))
|
||||
|
||||
(provide 'vim-scroll)
|
||||
|
||||
;;; vim-scroll.el ends here
|
||||
243
.emacs.d/vim-mode/vim-search.el
Normal file
243
.emacs.d/vim-mode/vim-search.el
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
;;; vim-search.el - Search und substitute commands for ex-mode.
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; TODO:
|
||||
;;
|
||||
;; - searching currently uses isearch. Although this is quite powerful,
|
||||
;; it's only usuably as interactive search and difficult to use with
|
||||
;; semi-interactive stuff like the "*" command. The current implementation
|
||||
;; using unread-command-events is quite ugly.
|
||||
;; - the substitute command should be more interactive and especially an operation
|
||||
;; without the 'g' option should highlight all future occurences
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defconst vim:search-keymap (make-sparse-keymap))
|
||||
(vim:set-keymap-default-binding vim:search-keymap 'vim:search-mode-exit)
|
||||
|
||||
(vim:deflocalvar vim:search-last-direction nil
|
||||
"The last search direction, either 'forward or 'backward.")
|
||||
|
||||
(defun vim:search-mode-activate ()
|
||||
(setq cursor-type vim:normal-mode-cursor))
|
||||
|
||||
(defun vim:search-mode-deactivate ()
|
||||
(isearch-exit))
|
||||
|
||||
(vim:defcmd vim:search-mode-exit ()
|
||||
(vim:activate-normal-mode)
|
||||
(push last-command-event unread-command-events))
|
||||
|
||||
;; Search mode is a very special mode being activated during a search
|
||||
;; command. Its purpose is to disable highlighting of search results
|
||||
;; if something else than a repeat-search event occurs.
|
||||
(vim:define-mode search "VIM search mode"
|
||||
:ident "S"
|
||||
:keymaps '(vim:search-keymap)
|
||||
:command-function 'vim:search-mode-command)
|
||||
(add-hook 'vim:search-mode-on-hook 'vim:search-mode-activate)
|
||||
(add-hook 'vim:search-mode-off-hook 'vim:search-mode-activate)
|
||||
|
||||
(defun vim:search-mode-command (command)
|
||||
"Executes a simple-command in search-mode."
|
||||
(case (vim:cmd-type command)
|
||||
('simple (vim:normal-execute-simple-command command))
|
||||
(t (error "Only simple commands allowed in search-mode."))))
|
||||
|
||||
(vim:defcmd vim:search-start (nonrepeatable)
|
||||
"Starts an incremental regexp search."
|
||||
(let ((search-nonincremental-instead nil))
|
||||
(ad-activate 'isearch-message-prefix)
|
||||
(isearch-forward-regexp)
|
||||
(ad-deactivate 'isearch-message-prefix)
|
||||
(setq vim:last-search-direction (if isearch-forward 'forward 'backward))))
|
||||
|
||||
(vim:defcmd vim:search-start-backward (nonrepeatable)
|
||||
"Starts an incremental regexp search."
|
||||
(let ((search-nonincremental-instead nil))
|
||||
(ad-activate 'isearch-message-prefix)
|
||||
(isearch-backward-regexp)
|
||||
(ad-deactivate 'isearch-message-prefix)
|
||||
(setq vim:last-search-direction (if isearch-forward 'forward 'backward))))
|
||||
|
||||
(vim:defcmd vim:search-repeat (nonrepeatable)
|
||||
"Repeats the last incremental search."
|
||||
(unless (vim:search-mode-p)
|
||||
(vim:activate-search-mode))
|
||||
(ad-activate 'isearch-message-prefix)
|
||||
(isearch-repeat vim:last-search-direction)
|
||||
(ad-deactivate 'isearch-message-prefix))
|
||||
|
||||
(vim:defcmd vim:search-repeat-opposite (nonrepeatable)
|
||||
"Starts an incremental regexp search."
|
||||
(unless (vim:search-mode-p)
|
||||
(vim:activate-search-mode))
|
||||
(ad-activate 'isearch-message-prefix)
|
||||
(isearch-repeat (if (eq vim:last-search-direction 'forward) 'backward 'forward))
|
||||
(ad-deactivate 'isearch-message-prefix))
|
||||
|
||||
(defadvice isearch-message-prefix (after vim:isearch-message-prefix (&optional c-q-hack ellipsis nonincremental))
|
||||
"This advice changes the minibuffer indicator to '/' or '?'"
|
||||
(setq ad-return-value (if isearch-forward "/" "?")))
|
||||
|
||||
(defun vim:start-word-search (unbounded direction)
|
||||
|
||||
(condition-case nil
|
||||
(goto-char (vim:motion-bwd-word-end :count 1))
|
||||
(error nil))
|
||||
|
||||
(save-excursion
|
||||
(re-search-forward (concat "\\<[" vim:word "]+\\>")))
|
||||
|
||||
(when (eq direction 'backward)
|
||||
(goto-char (1+ (match-end 0))))
|
||||
(let ((events (reverse (append (if (eq direction 'forward)
|
||||
"/"
|
||||
"?")
|
||||
(if unbounded
|
||||
(regexp-quote (match-string 0))
|
||||
(concat "\\<"
|
||||
(regexp-quote (match-string 0))
|
||||
"\\>"))
|
||||
[return]
|
||||
"n"
|
||||
nil))))
|
||||
(while events
|
||||
(push (car events) unread-command-events)
|
||||
(setq events (cdr events)))))
|
||||
|
||||
|
||||
(vim:defcmd vim:search-word (nonrepeatable)
|
||||
"Searches the next occurence of word under the cursor."
|
||||
(vim:start-word-search nil 'forward))
|
||||
|
||||
|
||||
(vim:defcmd vim:search-word-backward (nonrepeatable)
|
||||
"Searches the next occurence of word under the cursor."
|
||||
(vim:start-word-search nil 'backward))
|
||||
|
||||
|
||||
(vim:defcmd vim:search-unbounded-word (nonrepeatable)
|
||||
"Searches the next occurence of word under the cursor."
|
||||
(vim:start-word-search t 'forward))
|
||||
|
||||
|
||||
(vim:defcmd vim:search-unbounded-word-backward (nonrepeatable)
|
||||
"Searches the next occurence of word under the cursor."
|
||||
(vim:start-word-search t 'backward))
|
||||
|
||||
|
||||
(vim:defcmd vim:cmd-substitute (motion argument nonrepeatable)
|
||||
"The VIM substitutde command: [range]s/pattern/replacement/flags"
|
||||
(multiple-value-bind (pattern replacement flags) (vim:parse-substitute argument)
|
||||
(lexical-let* ((pattern pattern)
|
||||
(replacement replacement)
|
||||
(first-line (if motion (vim:motion-first-line motion) (line-number-at-pos (point))))
|
||||
(last-line (if motion (vim:motion-last-line motion) (line-number-at-pos (point))))
|
||||
(whole-line (and flags (find ?g flags)))
|
||||
(confirm (and flags (find ?c flags)))
|
||||
(ignore-case (and flags (find ?i flags)))
|
||||
(dont-ignore-case (and flags (find ?I flags)))
|
||||
(case-fold-search (or (and case-fold-search
|
||||
(not dont-ignore-case))
|
||||
(and (not case-fold-search)
|
||||
ignore-case)))
|
||||
(case-replace case-fold-search)
|
||||
(last-point (point))
|
||||
(overlay (make-overlay (point) (point)))
|
||||
(next-line (line-number-at-pos (point)))
|
||||
(nreplaced 0))
|
||||
|
||||
(unwind-protect
|
||||
(if whole-line
|
||||
;; this one is easy, just use the built in function
|
||||
(vim:perform-replace pattern replacement confirm t nil nil nil
|
||||
(save-excursion
|
||||
(goto-line first-line)
|
||||
(line-beginning-position))
|
||||
(save-excursion
|
||||
(goto-line last-line)
|
||||
(line-end-position)))
|
||||
(if confirm
|
||||
(progn
|
||||
;; this one is more difficult, we have to do the
|
||||
;; highlighting and questioning on our own
|
||||
(overlay-put overlay 'face
|
||||
(if (internal-find-face 'isearch nil)
|
||||
'isearch 'region))
|
||||
(map-y-or-n-p #'(lambda (x)
|
||||
(set-match-data x)
|
||||
(move-overlay overlay (match-beginning 0) (match-end 0))
|
||||
(concat "Query replacing "
|
||||
(match-string 0)
|
||||
" with "
|
||||
(match-substitute-replacement replacement case-fold-search)
|
||||
": "))
|
||||
#'(lambda (x)
|
||||
(set-match-data x)
|
||||
(replace-match replacement case-fold-search)
|
||||
(incf nreplaced)
|
||||
(setq last-point (point)))
|
||||
#'(lambda ()
|
||||
(let ((end (save-excursion
|
||||
(goto-line last-line)
|
||||
(line-end-position))))
|
||||
(goto-line next-line)
|
||||
(beginning-of-line)
|
||||
(when (and (> end (point))
|
||||
(re-search-forward pattern end t nil))
|
||||
(setq last-point (point))
|
||||
(setq next-line (1+ (line-number-at-pos (point))))
|
||||
(match-data))))))
|
||||
|
||||
;; just replace the first occurences per line
|
||||
;; without highlighting and asking
|
||||
(goto-line first-line)
|
||||
(beginning-of-line)
|
||||
(while (and (<= (line-number-at-pos (point)) last-line)
|
||||
(re-search-forward pattern (save-excursion
|
||||
(goto-line last-line)
|
||||
(line-end-position))
|
||||
t nil))
|
||||
(incf nreplaced)
|
||||
(replace-match replacement)
|
||||
(setq last-point (point))
|
||||
(forward-line)
|
||||
(beginning-of-line)))
|
||||
|
||||
(goto-char last-point)
|
||||
(if (= nreplaced 1)
|
||||
(message "Replaced 1 occurence")
|
||||
(message "Replaced %d occurences" nreplaced)))
|
||||
|
||||
;; clean-up the overlay
|
||||
(delete-overlay overlay)))))
|
||||
|
||||
|
||||
(defun vim:parse-substitute (text)
|
||||
(when (string-match "\\`\\s-*/\\(\\(?:[^/]\\|\\\\.\\)+\\)/\\(\\(?:[^/]\\|\\\\.\\)*\\)\\(?:/\\([giIc]*\\)\\)?\\s-*\\'"
|
||||
text)
|
||||
(let ((pattern (match-string 1 text))
|
||||
(replacement (match-string 2 text))
|
||||
(flags (match-string 3 text)))
|
||||
(values pattern
|
||||
;; handle some special escapes, especially \\ and \/
|
||||
(replace-regexp-in-string "\\\\."
|
||||
(lambda (x)
|
||||
(cond ((string= x "\\n") "\n")
|
||||
((string= x "\\t") "\t")
|
||||
((string= x "\\r") "\r")
|
||||
((string= x "\\/") "/")
|
||||
((string= x "\\\\") "\\\\\\\\")
|
||||
(t x)))
|
||||
replacement)
|
||||
flags))))
|
||||
|
||||
(provide 'vim-search)
|
||||
|
||||
;;; vim-search.el ends here
|
||||
71
.emacs.d/vim-mode/vim-undo.el
Normal file
71
.emacs.d/vim-mode/vim-undo.el
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
;;; vim-undo.el - Undo/Redo for VIM.
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Before the execution of an editing command, the calling function
|
||||
;; should save the current head of buffer-undo-list. When the
|
||||
;; editing-command has finished, the calling function should use
|
||||
;; vim:connect-undos to connect the changes made during editing to one
|
||||
;; single undo-block.
|
||||
;;
|
||||
;; Insert-mode has a special handling: when activated, it stores the
|
||||
;; current head of buffer-undo-list in vim:last-insert-undo and used
|
||||
;; this pointer to connect all editing actions during insert-mode to
|
||||
;; one undo-block when insert-mode is deactivated. If a function
|
||||
;; activates insert-mode it may modify vim:last-insert-undo to an
|
||||
;; apropriate value (see vim:execute-mapping for an example).
|
||||
|
||||
;;; Code:
|
||||
|
||||
(condition-case nil
|
||||
(require 'redo)
|
||||
(error
|
||||
(message "vim-mode: Could not load 'redo', redo-command not available.")))
|
||||
|
||||
(defvar vim:last-undo)
|
||||
|
||||
;; undo stuff
|
||||
(defun vim:connect-undos (last-undo)
|
||||
(labels
|
||||
((find-mark (lst)
|
||||
(while (not (or (null lst)
|
||||
(eq lst last-undo)))
|
||||
(setq lst (cdr lst)))
|
||||
(not (null lst))))
|
||||
|
||||
;; ensure last-undo is still in the undo list
|
||||
(when (and last-undo
|
||||
(not (eq last-undo buffer-undo-list))
|
||||
(find-mark buffer-undo-list))
|
||||
|
||||
;; add the end-of-command mark if not already there
|
||||
(unless (null (car buffer-undo-list))
|
||||
(push nil buffer-undo-list))
|
||||
|
||||
;; remove all nils until the mark
|
||||
(let ((lst buffer-undo-list))
|
||||
(while (and lst
|
||||
(not (eq (cdr lst) last-undo)))
|
||||
(if (null (cadr lst))
|
||||
(setcdr lst (cddr lst))
|
||||
(setq lst (cdr lst))))))))
|
||||
|
||||
|
||||
(vim:defcmd vim:cmd-undo (count nonrepeatable)
|
||||
(setq vim:last-undo nil)
|
||||
(dotimes (i (or count 1))
|
||||
(undo)))
|
||||
|
||||
(vim:defcmd vim:cmd-redo (count nonrepeatable)
|
||||
(setq vim:last-undo nil)
|
||||
(redo (or count 1)))
|
||||
|
||||
(provide 'vim-undo)
|
||||
|
||||
;;; vim-undo.el ends here
|
||||
404
.emacs.d/vim-mode/vim-vim.el
Normal file
404
.emacs.d/vim-mode/vim-vim.el
Normal file
|
|
@ -0,0 +1,404 @@
|
|||
;;; vim-vim.el - Basic functions and macros for vim-mode.
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar vim:repeat-events nil
|
||||
"The sequence of events for the repeat command.")
|
||||
|
||||
(vim:deflocalvar vim:current-register nil
|
||||
"The register of the current command.")
|
||||
|
||||
(vim:deflocalvar vim:current-cmd-count nil
|
||||
"The count of the current command.")
|
||||
|
||||
(vim:deflocalvar vim:current-cmd nil
|
||||
"The node of the current command.")
|
||||
|
||||
(vim:deflocalvar vim:current-cmd-arg nil
|
||||
"The argument of the current command.")
|
||||
|
||||
(vim:deflocalvar vim:current-motion-count nil
|
||||
"The count of the current motion.")
|
||||
|
||||
(vim:deflocalvar vim:current-motion nil
|
||||
"The node of the current motion.")
|
||||
|
||||
(vim:deflocalvar vim:current-motion-arg nil
|
||||
"The argument of the current motion.")
|
||||
|
||||
(vim:deflocalvar vim:current-motion-type nil
|
||||
"The type of the current motion (inclusive, exclusive, linewise).")
|
||||
|
||||
(defun vim:toplevel-execution ()
|
||||
"Returns t iff this is a toplevel execution, not a mapping or repeat."
|
||||
(not executing-kbd-macro))
|
||||
|
||||
|
||||
(defadvice vim:reset-key-state (before vim:vim-reset-key-state)
|
||||
"Resets the current state of the keymap."
|
||||
(setq vim:current-register nil
|
||||
vim:current-cmd-count nil
|
||||
vim:current-cmd nil
|
||||
vim:current-cmd-arg nil
|
||||
vim:current-motion-count nil
|
||||
vim:current-motion nil
|
||||
vim:current-motion-arg nil
|
||||
vim:current-motion-type nil))
|
||||
(ad-activate 'vim:reset-key-state)
|
||||
|
||||
|
||||
(defmacro* vim:defcmd (name (&rest args) &rest body)
|
||||
"Defines a new VIM-command."
|
||||
(declare (indent defun))
|
||||
(let ((count nil)
|
||||
(register nil)
|
||||
(motion nil)
|
||||
(argument nil)
|
||||
(keep-visual nil)
|
||||
(repeatable t)
|
||||
(params nil)
|
||||
(named-params nil)
|
||||
(doc nil))
|
||||
|
||||
;; extract documentation string
|
||||
(if (and (consp body)
|
||||
(cdr body)
|
||||
(stringp (car body)))
|
||||
(setq doc (car body)
|
||||
body (cdr body))
|
||||
(setq doc (format "VIM - command (%s %s)" name args)))
|
||||
|
||||
;; collect parameters
|
||||
(dolist (arg args)
|
||||
(case (if (consp arg) (car arg) arg)
|
||||
('count
|
||||
(setq count t)
|
||||
(push '(count nil) params)
|
||||
(when (and (consp arg)
|
||||
(not (eq (cadr arg) 'count)))
|
||||
(push `(,(cadr arg) count) named-params)))
|
||||
|
||||
('register
|
||||
(setq register t)
|
||||
(push '(register nil) params)
|
||||
(when (and (consp arg)
|
||||
(not (eq (cadr arg) 'register)))
|
||||
(push `(,(cadr arg) register) named-params)))
|
||||
|
||||
('motion
|
||||
(when motion
|
||||
(error "%s: only one motion argument may be specified: %s" 'vim:defcmd arg))
|
||||
(setq motion t)
|
||||
(push 'motion params)
|
||||
(when (and (consp arg)
|
||||
(not (eq (cadr arg) 'motion)))
|
||||
(push `(,(cadr arg) motion) named-params)))
|
||||
|
||||
('motion:optional
|
||||
(when motion
|
||||
(error "%s: only one motion argument may be specified: %s" 'vim:defcmd arg))
|
||||
(setq motion ''optional)
|
||||
(push 'motion params)
|
||||
(when (and (consp arg)
|
||||
(not (eq (cadr arg) 'motion)))
|
||||
(push `(,(cadr arg) motion) named-params)))
|
||||
|
||||
((argument argument:char argument:file argument:buffer)
|
||||
(when argument
|
||||
(error "%s: only one argument may be specified: %s" 'vim:defcmd arg))
|
||||
(let* ((arg-name (symbol-name (if (consp arg) (car arg) arg)))
|
||||
(pos (position ?: arg-name))
|
||||
(arg-type (if pos
|
||||
`',(intern (substring arg-name (1+ pos)))
|
||||
t)))
|
||||
(setq argument arg-type)
|
||||
(push 'argument params)
|
||||
(when (and (consp arg)
|
||||
(not (eq (cadr arg) 'argument)))
|
||||
(push `(,(cadr arg) argument) named-params))))
|
||||
|
||||
('keep-visual (setq keep-visual t))
|
||||
('do-not-keep-visual (setq keep-visual nil))
|
||||
('repeatable (setq repeatable t))
|
||||
('nonrepeatable (setq repeatable nil))
|
||||
|
||||
(t (error "%s: Unexpected argument: %s" 'vim:defcmd arg))))
|
||||
|
||||
`(progn
|
||||
(put ',name 'type ',(if motion 'complex 'simple))
|
||||
(put ',name 'count ,count)
|
||||
(put ',name 'motion ,motion)
|
||||
(put ',name 'argument ,argument)
|
||||
(put ',name 'register ,register)
|
||||
(put ',name 'keep-visual ,keep-visual)
|
||||
(put ',name 'repeatable ,repeatable)
|
||||
(put ',name 'function
|
||||
(function* (lambda (,@(when params `(&key ,@params))
|
||||
,@(when named-params `(&aux ,@named-params)))
|
||||
,@body)))
|
||||
(defun* ,name (&rest args)
|
||||
,doc
|
||||
(interactive)
|
||||
(if (vim:called-interactively-p)
|
||||
(funcall vim:active-command-function ',name)
|
||||
(apply (get ',name 'function) args))))))
|
||||
|
||||
(defmacro* vim:defmotion (name (&rest args) &rest body)
|
||||
(declare (indent defun))
|
||||
(let ((type nil)
|
||||
(count nil)
|
||||
(argument nil)
|
||||
(params nil)
|
||||
(named-params nil)
|
||||
(doc nil))
|
||||
|
||||
;; extract documentation string
|
||||
(if (and (consp body)
|
||||
(cdr body)
|
||||
(stringp (car body)))
|
||||
(setq doc (car body)
|
||||
body (cdr body))
|
||||
(setq doc (format "VIM - motion (%s %s)" name args)))
|
||||
|
||||
;; collect parameters
|
||||
(dolist (arg args)
|
||||
(case (if (consp arg) (car arg) arg)
|
||||
((inclusive exclusive linewise block)
|
||||
(setq type arg))
|
||||
|
||||
('count
|
||||
(setq count t)
|
||||
(push '(count nil) params)
|
||||
(when (and (consp arg)
|
||||
(not (eq (cadr arg) 'count)))
|
||||
(push `(,(cadr arg) count) named-params)))
|
||||
|
||||
((argument argument:char)
|
||||
(when argument
|
||||
(error "%s: only one argument may be specified: %s" 'vim:defcmd arg))
|
||||
(setq argument ''char)
|
||||
(push 'argument params)
|
||||
(when (and (consp arg)
|
||||
(not (eq (cadr arg) 'argument)))
|
||||
(push `(,(cadr arg) argument) named-params)))
|
||||
|
||||
(t (error "%s: Unexpected argument: %s" 'vim:defmotion arg))))
|
||||
|
||||
(unless type
|
||||
(error "%s: Motion type must be specified" 'vim:defmotion))
|
||||
|
||||
`(progn
|
||||
(put ',name 'type ',type)
|
||||
(put ',name 'count ,count)
|
||||
(put ',name 'argument ,argument)
|
||||
(put ',name 'function
|
||||
(function* (lambda (,@(when params `(&key ,@params))
|
||||
,@(when named-params `(&aux ,@named-params)))
|
||||
(vim:do-motion ',type (progn ,@body)))))
|
||||
(defun* ,name (&rest args)
|
||||
,doc
|
||||
(interactive)
|
||||
(if (vim:called-interactively-p)
|
||||
(vim:execute-command ',name)
|
||||
(apply (get ',name 'function) args))))))
|
||||
|
||||
(font-lock-add-keywords 'emacs-lisp-mode '("vim:defcmd" "vim:defmotion"))
|
||||
|
||||
(defun vim:cmd-count-p (cmd)
|
||||
"Returns non-nil iff command cmd takes a count."
|
||||
(get cmd 'count))
|
||||
|
||||
(defun vim:cmd-register-p (cmd)
|
||||
"Returns non-nil iff command may take a register."
|
||||
(get cmd 'register))
|
||||
|
||||
(defun vim:cmd-motion-p (cmd)
|
||||
"Returns non-nil iff command `cmd' takes a motion parameter."
|
||||
(get cmd 'motion))
|
||||
|
||||
(defun vim:cmd-arg (cmd)
|
||||
"Returns the type of command's argument."
|
||||
(get cmd 'argument))
|
||||
|
||||
(defun vim:cmd-arg-p (cmd)
|
||||
"Returns non-nil iff command cmd takes an argument of arbitrary type."
|
||||
(not (null (get cmd 'argument))))
|
||||
|
||||
(defun vim:cmd-text-arg-p (cmd)
|
||||
"Returns non-nil iff command cmd takes a text argument."
|
||||
(eq (vim:cmd-arg cmd) t))
|
||||
|
||||
(defun vim:cmd-char-arg-p (cmd)
|
||||
"Returns non-nil iff command cmd takes a char argument."
|
||||
(eq (vim:cmd-arg cmd) 'char))
|
||||
|
||||
(defun vim:cmd-file-arg-p (cmd)
|
||||
"Returns non-nil iff command cmd takes a file argument."
|
||||
(eq (vim:cmd-arg cmd) 'file))
|
||||
|
||||
(defun vim:cmd-buffer-arg-p (cmd)
|
||||
"Returns non-nil iff command cmd takes a buffer argument."
|
||||
(eq (vim:cmd-arg cmd) 'buffer))
|
||||
|
||||
(defun vim:cmd-repeatable-p (cmd)
|
||||
"Returns non-nil iff command cmd is repeatable."
|
||||
(get cmd 'repeatable))
|
||||
|
||||
(defun vim:cmd-keep-visual-p (cmd)
|
||||
"Returns non-nil iff command cmd should stay in visual mode."
|
||||
(get cmd 'keep-visual))
|
||||
|
||||
(defun vim:cmd-type (cmd)
|
||||
"Returns the type of command cmd."
|
||||
(get cmd 'type))
|
||||
|
||||
(defun vim:cmd-function (cmd)
|
||||
"Returns the function of command `cmd'."
|
||||
(get cmd 'function))
|
||||
|
||||
|
||||
(defmacro vim:apply-save-buffer (&rest args)
|
||||
"Like `apply' but stores the current buffer."
|
||||
(let ((ret (gensym)))
|
||||
`(progn
|
||||
(save-current-buffer
|
||||
(let ((,ret (apply ,@args)))
|
||||
(setq vim:new-buffer (current-buffer))
|
||||
,ret)))))
|
||||
|
||||
|
||||
(defmacro vim:funcall-save-buffer (&rest args)
|
||||
"Like `funcall' but stores the current buffer."
|
||||
(let ((ret (gensym)))
|
||||
`(progn
|
||||
(save-current-buffer
|
||||
(let ((,ret (funcall ,@args)))
|
||||
(setq vim:new-buffer (current-buffer))
|
||||
,ret)))))
|
||||
|
||||
(defun vim:select-register ()
|
||||
"Sets the register for the next command."
|
||||
(interactive)
|
||||
(setq vim:current-register (read-char-exclusive)))
|
||||
|
||||
(defun vim:get-register (register)
|
||||
"Returns the content of `register', signals error on fail."
|
||||
(let ((txt (get-register register)))
|
||||
(unless txt
|
||||
(error "Register '%c' empty." register))
|
||||
txt))
|
||||
|
||||
|
||||
(defun vim:execute-command (cmd)
|
||||
"Executes the vim-command `cmd'.
|
||||
If an error occures, this function switches back to normal-mode.
|
||||
Since all vim-mode commands go through this function, this is
|
||||
the perfect point to do some house-keeping."
|
||||
(condition-case err
|
||||
(funcall vim:active-command-function cmd)
|
||||
(error
|
||||
(vim:reset-key-state)
|
||||
(vim:clear-key-sequence)
|
||||
(vim:adjust-point)
|
||||
(vim:activate-normal-mode)
|
||||
(signal (car err) (cdr err)))))
|
||||
|
||||
|
||||
(defun vim:execute-current-motion ()
|
||||
"Executes the current motion and returns the representing
|
||||
vim:motion object."
|
||||
(if (null vim:current-motion)
|
||||
nil
|
||||
(let ((cmd vim:current-motion)
|
||||
(count (if (or vim:current-cmd-count
|
||||
vim:current-motion-count)
|
||||
(* (or vim:current-cmd-count 1)
|
||||
(or vim:current-motion-count 1))
|
||||
nil))
|
||||
(parameters nil))
|
||||
|
||||
;; build the parameter-list
|
||||
(when (vim:cmd-char-arg-p cmd)
|
||||
(push vim:current-motion-arg parameters)
|
||||
(push :argument parameters))
|
||||
(when (vim:cmd-count-p cmd)
|
||||
(push count parameters)
|
||||
(push :count parameters))
|
||||
|
||||
(vim:apply-save-buffer cmd parameters))))
|
||||
|
||||
|
||||
(defun vim:get-current-cmd-motion ()
|
||||
"Returns the motion range for the current command w.r.t.
|
||||
command-specific transformations."
|
||||
(let ((motion (save-excursion (vim:execute-current-motion))))
|
||||
(when (and (eq (vim:motion-type motion) 'exclusive)
|
||||
(save-excursion
|
||||
(goto-char (vim:motion-end-pos motion))
|
||||
(bolp)))
|
||||
|
||||
;; exclusive motions may be modified
|
||||
(let ((end (vim:adjust-end-of-line-position (1- (vim:motion-end-pos motion)))))
|
||||
(if (< (vim:motion-begin motion)
|
||||
(vim:motion-end motion))
|
||||
(setf (vim:motion-end motion) end)
|
||||
(setf (vim:motion-begin motion) end)))
|
||||
|
||||
(if (save-excursion
|
||||
(goto-char (vim:motion-begin-pos motion))
|
||||
(vim:looking-back "^\\s-*"))
|
||||
;; motion becomes linewise(-exclusive)
|
||||
(setf (vim:motion-type motion) 'linewise)
|
||||
|
||||
;; motion becomes inclusive
|
||||
(setf (vim:motion-type motion) 'inclusive)))
|
||||
motion))
|
||||
|
||||
|
||||
(defconst vim:emacs-keymap (vim:make-keymap)
|
||||
"Keymap for EMACS mode.")
|
||||
|
||||
(vim:define-mode emacs "VIM emacs-mode"
|
||||
:ident "E"
|
||||
:message "-- EMACS --"
|
||||
:keymaps '(vim:emacs-keymap)
|
||||
:command-function 'vim:normal-mode-command)
|
||||
|
||||
;; from viper
|
||||
(defsubst vim:ESC-event-p (event)
|
||||
(let ((ESC-keys '(?\e (control \[) escape))
|
||||
(key (event-basic-type event)))
|
||||
(member key ESC-keys)))
|
||||
|
||||
;; from viper
|
||||
(defun vim:escape-to-emacs (events)
|
||||
"Executes some `events' in emacs."
|
||||
|
||||
(let* ((vim-key-mode nil)
|
||||
(unread-command-events events)
|
||||
(keys (read-key-sequence nil))
|
||||
(event (elt (listify-key-sequence keys) 0)))
|
||||
|
||||
(when (vim:ESC-event-p event)
|
||||
(let ((unread-command-events keys))
|
||||
(setq keys (read-key-sequence nil))))
|
||||
|
||||
(let ((command (key-binding keys)))
|
||||
(setq this-command command)
|
||||
(setq last-command-event (elt keys (1- (length keys))))
|
||||
(setq last-command-char last-command-event)
|
||||
(command-execute command)
|
||||
(when (memq command '(digit-argument
|
||||
universal-argument))
|
||||
(vim:escape-to-emacs nil)))))
|
||||
|
||||
|
||||
(provide 'vim-vim)
|
||||
|
||||
;;; vim-vim.el ends here
|
||||
774
.emacs.d/vim-mode/vim-visual-mode.el
Normal file
774
.emacs.d/vim-mode/vim-visual-mode.el
Normal file
File diff suppressed because it is too large
Load diff
328
.emacs.d/vim-mode/vim-window.el
Normal file
328
.emacs.d/vim-mode/vim-window.el
Normal file
|
|
@ -0,0 +1,328 @@
|
|||
;;; vim-window.el - Implementation of window commands.
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file contains implementations for the window operations.
|
||||
;; Window operations are usually just simple commands and should not
|
||||
;; be repeatable.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(condition-case nil
|
||||
(require 'windmove)
|
||||
(error
|
||||
(message "vim-mode: Could not load 'windmove', window-commands not available.")
|
||||
nil))
|
||||
|
||||
(vim:define-keymap window-mode "window mode" :map-command wmap)
|
||||
|
||||
(vim:define-mode window "VIM window mode"
|
||||
:ident "W"
|
||||
:keymaps '(vim:window-mode-keymap)
|
||||
:command-function 'vim:normal-mode-command)
|
||||
|
||||
(defun vim:resize-window (new-size &optional horizontal)
|
||||
"Sets the current window's with or height to `new-size'."
|
||||
(let ((wincfg (current-window-configuration))
|
||||
(nwins (length (window-list)))
|
||||
(count (if horizontal
|
||||
(- new-size (window-width))
|
||||
(- new-size (window-height)))))
|
||||
|
||||
(catch 'loop
|
||||
(save-window-excursion
|
||||
(while (not (zerop count))
|
||||
(if (> count 0)
|
||||
(progn (enlarge-window 1 horizontal) (decf count))
|
||||
(progn
|
||||
(shrink-window 1 horizontal)
|
||||
(incf count)))
|
||||
(if (= nwins (length (window-list)))
|
||||
(setq wincfg (current-window-configuration))
|
||||
(throw 'loop t)))))
|
||||
(set-window-configuration wincfg)))
|
||||
|
||||
|
||||
(defun vim:get-buffer-tree (wintree)
|
||||
"Extracts the buffer tree from a given window-tree."
|
||||
(if (consp wintree)
|
||||
(cons (car wintree) (mapcar #'vim:get-buffer-tree (cddr wintree)))
|
||||
(window-buffer wintree)))
|
||||
|
||||
|
||||
(defun vim:restore-window-tree (win tree)
|
||||
"Restores the given buffer-tree layout as subwindows of win."
|
||||
(cond
|
||||
((and (consp tree) (cddr tree))
|
||||
(let ((newwin (split-window win nil (not (car tree)))))
|
||||
(vim:restore-window-tree win (cadr tree))
|
||||
(vim:restore-window-tree newwin (cons (car tree) (cddr tree)))))
|
||||
((consp tree)
|
||||
(set-window-buffer win (cadr tree)))
|
||||
(t (set-window-buffer win tree))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-split (count (argument:file file) nonrepeatable)
|
||||
"Splits the current window horizontally, `count' lines height, editing a certain `file'."
|
||||
(let ((new-win (split-window (selected-window) count)))
|
||||
(when file
|
||||
(vim:cmd-edit :argument file))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-vsplit (count (argument:file file) nonrepeatable)
|
||||
"Splits the current window vertically, `count' columns width, editing a certain `file'."
|
||||
(let ((new-win (split-window (selected-window) count t)))
|
||||
(when file
|
||||
(vim:cmd-edit :argument file))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-close (nonrepeatable)
|
||||
"Closes the current window."
|
||||
(delete-window))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-only (nonrepeatable)
|
||||
"Closes all but the current window."
|
||||
(delete-other-windows))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-left (count nonrepeatable)
|
||||
"Move the cursor to new `count'-th window left of the current one."
|
||||
(dotimes (i (or count 1))
|
||||
(windmove-left)))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-right (count nonrepeatable)
|
||||
"Move the cursor to new `count'-th window right of the current one."
|
||||
(dotimes (i (or count 1))
|
||||
(windmove-right)))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-up (count nonrepeatable)
|
||||
"Move the cursor to new `count'-th window above the current one."
|
||||
(dotimes (i (or count 1))
|
||||
(windmove-up)))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-down (count nonrepeatable)
|
||||
"Move the cursor to new `count'-th window below the current one."
|
||||
(dotimes (i (or count 1))
|
||||
(windmove-down)))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-bottom-right (nonrepeatable)
|
||||
"Move the cursor to bottom-right window."
|
||||
(do ((success t))
|
||||
((not success))
|
||||
(setq success nil)
|
||||
(condition-case nil
|
||||
(progn
|
||||
(windmove-right)
|
||||
(setq success t))
|
||||
(error nil))
|
||||
(condition-case nil
|
||||
(progn
|
||||
(windmove-down)
|
||||
(setq success t))
|
||||
(error nil))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-top-left (nonrepeatable)
|
||||
"Move the cursor to top-left window."
|
||||
(do ((success t))
|
||||
((not success))
|
||||
(setq success nil)
|
||||
(condition-case nil
|
||||
(progn
|
||||
(windmove-left)
|
||||
(setq success t))
|
||||
(error nil))
|
||||
(condition-case nil
|
||||
(progn
|
||||
(windmove-up)
|
||||
(setq success t))
|
||||
(error nil))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-lru (nonrepeatable)
|
||||
"Move the cursor to the previous (last accessed) window."
|
||||
(select-window (get-lru-window)))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-next (count nonrepeatable)
|
||||
"Move the cursor to the next window in the cyclic order.
|
||||
With `count' go to the count-th window in the order starting from
|
||||
top-left."
|
||||
(if (not count)
|
||||
(select-window (next-window))
|
||||
(vim:window-top-left)
|
||||
(other-window (1- (or count 1)))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-prev (count nonrepeatable)
|
||||
"Move the cursor to the previous window in the cyclic order.
|
||||
With `count' go to the count-th window in the order starting from
|
||||
top-left."
|
||||
(if (not count)
|
||||
(select-window (previous-window))
|
||||
(vim:window-top-left)
|
||||
(other-window (1- (or count 1)))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-new (count (argument:file file) nonrepeatable)
|
||||
"Splits the current window horizontally and opens a new buffer or edits a certain `file'."
|
||||
(split-window (selected-window) count)
|
||||
(if file
|
||||
(vim:cmd-edit :argument file)
|
||||
(let ((buffer (generate-new-buffer "*new*")))
|
||||
(set-window-buffer (selected-window) buffer)
|
||||
(with-current-buffer buffer (normal-mode)))))
|
||||
|
||||
|
||||
|
||||
(vim:defcmd vim:window-vnew (count (argument:file file) nonrepeatable)
|
||||
"Splits the current window vertically and opens a new buffer name or edits a certain `file'."
|
||||
(split-window (selected-window) count t)
|
||||
(if file
|
||||
(vim:cmd-edit :argument file)
|
||||
(let ((buffer (generate-new-buffer "*new*")))
|
||||
(set-window-buffer (selected-window) buffer)
|
||||
(with-current-buffer buffer (normal-mode)))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-balance (nonrepeatable)
|
||||
"Balances all window sizes."
|
||||
(balance-windows))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-increase-height (count nonrepeatable)
|
||||
"Increase current window height by `count'."
|
||||
(vim:resize-window (+ (window-height) (or count 1))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-decrease-height (count nonrepeatable)
|
||||
"Decrease current window height by `count'."
|
||||
(vim:resize-window (- (window-height) (or count 1))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-increase-width (count nonrepeatable)
|
||||
"Increase current window width by `count'."
|
||||
(vim:resize-window (+ (window-width) (or count 1)) t))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-decrease-width (count nonrepeatable)
|
||||
"Decrease current window width by `count'."
|
||||
(vim:resize-window (- (window-width) (or count 1)) t))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-set-height (count nonrepeatable)
|
||||
"Sets the height of the current window to `count'."
|
||||
(vim:resize-window (or count (frame-height)) nil))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-set-width (count nonrepeatable)
|
||||
"Sets the width of the current window to `count'."
|
||||
(vim:resize-window (or count (frame-width)) t))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-rotate-upwards (nonrepeatable)
|
||||
"Rotates the windows according to the currenty cyclic ordering."
|
||||
(let ((wlist (window-list))
|
||||
(blist (mapcar #'(lambda (w) (window-buffer w))
|
||||
(window-list))))
|
||||
(setq blist (append (cdr blist) (list (car blist))))
|
||||
(while (and wlist blist)
|
||||
(set-window-buffer (car wlist) (car blist))
|
||||
(setq wlist (cdr wlist)
|
||||
blist (cdr blist)))
|
||||
(select-window (car (last (window-list))))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-rotate-downwards (nonrepeatable)
|
||||
"Rotates the windows according to the currenty cyclic ordering."
|
||||
(let ((wlist (window-list))
|
||||
(blist (mapcar #'(lambda (w) (window-buffer w))
|
||||
(window-list))))
|
||||
(setq blist (append (last blist) blist))
|
||||
(while (and wlist blist)
|
||||
(set-window-buffer (car wlist) (car blist))
|
||||
(setq wlist (cdr wlist)
|
||||
blist (cdr blist)))
|
||||
(select-window (cadr (window-list)))))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-move-very-top (nonrepeatable)
|
||||
"Closes the current window, splits the upper-left one horizontally
|
||||
and redisplays the current buffer there."
|
||||
(unless (one-window-p)
|
||||
(let ((b (current-buffer)))
|
||||
(delete-window)
|
||||
(let ((btree (vim:get-buffer-tree (car (window-tree)))))
|
||||
(vim:window-only)
|
||||
(let ((newwin (selected-window))
|
||||
(subwin (split-window)))
|
||||
(vim:restore-window-tree subwin btree)
|
||||
(set-window-buffer newwin b)
|
||||
(select-window newwin))))
|
||||
(balance-windows)))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-move-far-left (nonrepeatable)
|
||||
"Closes the current window, splits the upper-left one vertically
|
||||
and redisplays the current buffer there."
|
||||
(unless (one-window-p)
|
||||
(let ((b (current-buffer)))
|
||||
(delete-window)
|
||||
(let ((btree (vim:get-buffer-tree (car (window-tree)))))
|
||||
(vim:window-only)
|
||||
(let ((newwin (selected-window))
|
||||
(subwin (split-window-horizontally)))
|
||||
(vim:restore-window-tree subwin btree)
|
||||
(set-window-buffer newwin b)
|
||||
(select-window newwin))))
|
||||
(balance-windows)))
|
||||
|
||||
|
||||
(vim:defcmd vim:window-move-far-right (nonrepeatable)
|
||||
"Closes the current window, splits the lower-right one vertically
|
||||
and redisplays the current buffer there."
|
||||
(unless (one-window-p)
|
||||
(let ((b (current-buffer)))
|
||||
(delete-window)
|
||||
(let ((btree (vim:get-buffer-tree (car (window-tree)))))
|
||||
(vim:window-only)
|
||||
(let ((subwin (selected-window))
|
||||
(newwin (split-window-horizontally)))
|
||||
(vim:restore-window-tree subwin btree)
|
||||
(set-window-buffer newwin b)
|
||||
(select-window newwin))))
|
||||
(balance-windows)))
|
||||
|
||||
|
||||
|
||||
|
||||
(vim:defcmd vim:window-move-very-bottom (nonrepeatable)
|
||||
"Closes the current window, splits the lower-right one horizontally
|
||||
and redisplays the current buffer there."
|
||||
(unless (one-window-p)
|
||||
(let ((b (current-buffer)))
|
||||
(delete-window)
|
||||
(let ((btree (vim:get-buffer-tree (car (window-tree)))))
|
||||
(vim:window-only)
|
||||
(let ((subwin (selected-window))
|
||||
(newwin (split-window)))
|
||||
(vim:restore-window-tree subwin btree)
|
||||
(set-window-buffer newwin b)
|
||||
(select-window newwin))))
|
||||
(balance-windows)))
|
||||
|
||||
|
||||
(provide 'vim-window)
|
||||
|
||||
;;; vim-window.el ends here
|
||||
223
.emacs.d/vim-mode/vim.el
Normal file
223
.emacs.d/vim-mode/vim.el
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
;;; vim.el --- a VIM-emulation for Emacs
|
||||
|
||||
;; Copyright (C) 2009, 2010 Frank Fischer
|
||||
|
||||
;; Author: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;; Maintainer: Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de>,
|
||||
;; URL: http://www.emacswiki.org/emacs/VimMode
|
||||
;; License: GPLv2 or later, as described below under "License"
|
||||
;; Compatibility: Emacs 22, 23, XEmacs 21.4
|
||||
;; Version: 0.3.0
|
||||
;; Keywords: emulation, vim
|
||||
;; Human-Keywords: vim, emacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Acknowledgements:
|
||||
|
||||
;; This package contains code from several other packages:
|
||||
;;
|
||||
;; - rect-mark.el
|
||||
;; - viper
|
||||
;; - vimpulse.el
|
||||
;; - windmove.el
|
||||
;;
|
||||
;; Special thanks go to the authors of those packages.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; A simple VIM-mode for Emacs
|
||||
;;
|
||||
;; This project is in a VERY early development state and many function
|
||||
;; have not been implemented yet.
|
||||
;;
|
||||
;; If you want to try, open this file in your Emacs and evaluate the buffer.
|
||||
;; The mode can be activated by 'M-x vim-mode'.
|
||||
;;
|
||||
;; Don't forget to disable Viper if you want to try vim-mode.
|
||||
;;
|
||||
;; The project is divided into many files. Each file implements some
|
||||
;; almost-independent feature. If you want to learn how to implement
|
||||
;; new commands or motions, look at the files vim-commands.el and
|
||||
;; vim-motions.el.
|
||||
;;
|
||||
;; Here is a short description of the contents of each file:
|
||||
;;
|
||||
;; - vim.el: This file just sets up the mode and loads the other files.
|
||||
;;
|
||||
;; - vim-compat.el: Compatibility layer for different Emacsen.
|
||||
;;
|
||||
;; - vim-keymap.el: A few functions for defining keymaps for vim-mode.
|
||||
;;
|
||||
;; - vim-vim.el: This file contains the macros for defining motions
|
||||
;; and commands as well as some utility functions for
|
||||
;; calling them.
|
||||
;;
|
||||
;; - vim-modes.el: Each VIM-mode (normal-mode, insert-mode, ...) corresponds
|
||||
;; to an Emacs-minor-mode. This file contains some macros and
|
||||
;; functions to define new vim-modes in this context.
|
||||
;;
|
||||
;; - vim-insert-mode.el: The implementation of insert-mode.
|
||||
;;
|
||||
;; - vim-normal-mode.el: The implementation of normal-mode.
|
||||
;;
|
||||
;; - vim-visual-mode.el: The implementation of visual-mode.
|
||||
;;
|
||||
;; - vim-ex-mode.el: The implementation of ex-mode.
|
||||
;;
|
||||
;; - vim-commands.el: The implementations of commands like 'delete',
|
||||
;; 'yank', 'paste' and so on.
|
||||
;;
|
||||
;; - vim-motions.el: The implementations of motion commands like 'h',
|
||||
;; 'i', 'j', 'k', 'f', 'w', ...
|
||||
;;
|
||||
;; - vim-scroll.el: The implementation of scrolling commands like
|
||||
;; 'zz', 'Ctrl-F'.
|
||||
;;
|
||||
;; - vim-window-el: The implementation of window commands like 'C-w s'.
|
||||
;;
|
||||
;; - vim-ex-commands.el: The implementations of commands like ':edit'
|
||||
;; or ':buffer'.
|
||||
;;
|
||||
;; - vim-search.el: The implementation of '/' and ':substitute'.
|
||||
;;
|
||||
;; - vim-undo.el: Some variables and functions for undo/redo.
|
||||
;;
|
||||
;; - vim-maps.el: The definition of the basic keymaps. This file
|
||||
;; connects the keymaps with the commands and motions
|
||||
;; defined in vim-commands.el and vim-motions.el.
|
||||
;;
|
||||
;; TODO:
|
||||
;;
|
||||
;; HAVE:
|
||||
;; - framework for keymaps, motions, commands and command-mappings
|
||||
;; - insert-mode, normal-mode, visual-mode and ex-mode
|
||||
;; - simple motions
|
||||
;; - deletion, yank, paste, change, replace
|
||||
;; - undo/redo
|
||||
;; - repeat
|
||||
;;
|
||||
;; MISSING:
|
||||
;; - better Emacs integration (modes, buffer local variables, ...)
|
||||
;; - text objects
|
||||
;; - several commands
|
||||
;; - marks and register
|
||||
;; - ...
|
||||
|
||||
;; - several calls 'looking-back' may be inefficient
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
|
||||
(defgroup vim-mode nil
|
||||
"A VIM emulation mode."
|
||||
:group 'emulations)
|
||||
|
||||
(defcustom vim:default-initial-mode
|
||||
'normal
|
||||
"The default initial vim sub-mode."
|
||||
:type '(symbol :tag "vim-mode start mode")
|
||||
:group 'vim-mode)
|
||||
|
||||
(defcustom vim:initial-modes
|
||||
'((debugger-mode . window)
|
||||
(compilation-mode . window)
|
||||
(grep-mode . window)
|
||||
(gud-mode . window)
|
||||
(sldb-mode . window)
|
||||
(slime-repl-mode . window)
|
||||
(reftex-select-bib-mode . window)
|
||||
(completion-list-mode . window)
|
||||
(help-mode . motion)
|
||||
(Info-mode . motion))
|
||||
"Associated list of (major-mode . vim:mode) which specifies the
|
||||
vim sub-mode in which vim-mode should start when a buffer with the
|
||||
given major-mode is created."
|
||||
:type '(repeat (cons (symbol :tag "major mode") (symbol :tag "vim-mode start mode")))
|
||||
:group 'vim-mode)
|
||||
|
||||
|
||||
(defmacro vim:deflocalvar (name &rest args)
|
||||
"Defines a buffer-local variable."
|
||||
(declare (indent defun))
|
||||
`(progn
|
||||
(defvar ,name ,@args)
|
||||
(make-variable-buffer-local ',name)))
|
||||
(font-lock-add-keywords 'emacs-lisp-mode '("vim:deflocalvar"))
|
||||
|
||||
(defvar vim:emulation-mode-alist nil
|
||||
"List of all keymaps used by some modes.")
|
||||
|
||||
(let ((load-path (cons (expand-file-name ".") load-path)))
|
||||
(eval-when-compile
|
||||
(load "vim-compat")
|
||||
(load "vim-keymap")
|
||||
(load "vim-modes")
|
||||
(load "vim-vim")
|
||||
(load "vim-normal-mode")
|
||||
(load "vim-insert-mode")
|
||||
(load "vim-visual-mode")
|
||||
(load "vim-commands")
|
||||
(load "vim-motions")
|
||||
(load "vim-scroll")
|
||||
(load "vim-window")
|
||||
(load "vim-undo")
|
||||
(load "vim-ex")
|
||||
(load "vim-ex-commands")
|
||||
(load "vim-search")
|
||||
(load "vim-maps"))
|
||||
|
||||
(require 'vim-compat)
|
||||
(require 'vim-keymap)
|
||||
(require 'vim-modes)
|
||||
(require 'vim-vim)
|
||||
(require 'vim-normal-mode)
|
||||
(require 'vim-insert-mode)
|
||||
(require 'vim-visual-mode)
|
||||
(require 'vim-commands)
|
||||
(require 'vim-motions)
|
||||
(require 'vim-scroll)
|
||||
(require 'vim-window)
|
||||
(require 'vim-undo)
|
||||
(require 'vim-ex)
|
||||
(require 'vim-ex-commands)
|
||||
(require 'vim-search)
|
||||
(require 'vim-maps))
|
||||
|
||||
(define-minor-mode vim-local-mode
|
||||
"VIM emulation mode."
|
||||
:lighter " VIM"
|
||||
:init-value nil
|
||||
:global nil
|
||||
|
||||
(if vim-local-mode
|
||||
(progn
|
||||
(make-local-variable 'vim:emulation-mode-alist)
|
||||
(vim:initialize-keymaps t))
|
||||
(progn
|
||||
(vim:initialize-keymaps nil)
|
||||
(setq global-mode-string
|
||||
(delq 'vim:mode-string global-mode-string ))
|
||||
(vim:activate-mode nil))))
|
||||
|
||||
(define-globalized-minor-mode vim-mode vim-local-mode vim:initialize)
|
||||
|
||||
(defun vim:initialize ()
|
||||
(unless (vim:minibuffer-p)
|
||||
(let ((mode (cdr (or (assoc major-mode vim:initial-modes)
|
||||
(cons t vim:default-initial-mode)))))
|
||||
(when mode
|
||||
(setq vim:active-mode nil)
|
||||
(vim-local-mode 1)
|
||||
(vim:intercept-ESC-mode 1)
|
||||
(vim:activate-mode mode)
|
||||
(unless (memq 'vim:mode-string global-mode-string)
|
||||
(setq global-mode-string
|
||||
(append '("" vim:mode-string) (cdr global-mode-string))))))))
|
||||
|
||||
|
||||
(provide 'vim)
|
||||
|
||||
;;; vim.el ends here
|
||||
7118
.emacs.d/vimpulse.el
Normal file
7118
.emacs.d/vimpulse.el
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue