Skip to content

Commit

Permalink
added js2-mode snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
nisaacson committed Mar 24, 2013
1 parent b66b4f5 commit 9a601af
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 51 deletions.
62 changes: 34 additions & 28 deletions .emacs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(setq key-chord-two-keys-delay 0.5)
(require 'doxymacs)
(require 'highlight-symbol)
;(require 'browse-kill-ring)
;(require 'browse-kill-ring)
(require 'highlight-parentheses)
(require 'ido)
(require 'sudo-save)
Expand Down Expand Up @@ -84,10 +84,10 @@
;; (require 'el-get)
;; doxymacs
(add-hook 'c-mode-common-hook
(lambda ()
(require 'doxymacs)
(doxymacs-mode t)
(doxymacs-font-lock)))
(lambda ()
(require 'doxymacs)
(doxymacs-mode t)
(doxymacs-font-lock)))

(require 'idomenu)
(require 'noah-autocomplete)
Expand All @@ -107,9 +107,9 @@
;; put all autosave files in the system temp directory e.g. 'C:\temp' or '/tmp'

(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))

;; Always delete trailing whitespace
;; (add-hook 'before-save-hook (lambda () (delete-trailing-whitespace)))
Expand Down Expand Up @@ -155,9 +155,9 @@
;; C# setup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'csharp-mode-hook
'(lambda ()
(c-set-style k&r))
)
'(lambda ()
(c-set-style k&r))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand All @@ -169,7 +169,7 @@
(autoload 'php-imenu-create-index "php-imenu" nil t)
(add-hook 'php-mode-hook 'imenu-add-menubar-index)
(add-hook 'php-mode-hook 'camelCase-mode t)
;(add-hook 'php-mode-hook 'camelCase-mode)
;(add-hook 'php-mode-hook 'camelCase-mode)
(setq c-basic-offset 2)
;; Load the php-imenu index function
(autoload 'php-imenu-create-index "php-imenu" nil t)
Expand All @@ -196,26 +196,32 @@
(setq ido-everywhere t)
(ido-mode t)
(setq ido-enable-flex-matching t)
(defun noah-ido-config()
;; ... other ido-config here ...
;; disable auto searching for files unless called explicitly with C-c C-s
;; (setq ido-auto-merge-delay-time 99999)
;; (define-key ido-file-dir-completion-map (kbd "C-c C-s")
;; (lambda()
;; (interactive)
;; (ido-initiate-auto-merge (current-buffer)))))
(add-hook 'ido-setup-hook 'noah-ido-config)
)



;; default sources of candidates


(defun rename-file-and-buffer (new-name)
(defun rrename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "sNew name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(progn
(rename-file name new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))
(message "A buffer named '%s' already exists!" new-name)
(progn
(rename-file name new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))


;;;;;;;;;;;;;;;;;;;;
Expand Down Expand Up @@ -261,7 +267,7 @@
(defun what-face (pos)
(interactive "d")
(let ((face (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(get-char-property (point) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))

(setq toolbar nil)
Expand Down Expand Up @@ -310,8 +316,8 @@
(interactive)
(shell-command
(format "open -a /Applications/Marked.app %s"
(shell-quote-argument (buffer-file-name))))
)
(shell-quote-argument (buffer-file-name))))
)

;; (setq ispell-program-name "aspell")
;; ;; (add-hook 'markdown-mode-hook
Expand Down
12 changes: 6 additions & 6 deletions site-lisp/noah/noah-autocomplete.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
;; ;;;;;;;;;;;;;;;;;;;;
(require 'auto-complete-config)
(set-default 'ac-sources
'(ac-source-abbrev
ac-source-dictionary
ac-source-yasnippet
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers
ac-source-semantic))
'(ac-source-abbrev
;; ac-source-dictionary
ac-source-yasnippet
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers
))

(add-to-list 'ac-dictionary-directories "/Users/noah/.emacs.d/vendor/autocomplete/dict")
(ac-config-default)
Expand Down
32 changes: 17 additions & 15 deletions site-lisp/noah/shortcuts.el
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
(add-hook 'ido-setup-hook 'ido-define-keys)
;; Display ido results vertically, rather than horizontally
(setq ido-decorations (quote ("\n-> " "" "\n " "\n ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")))
; sort ido filelist by mtime instead of alphabetically
(add-hook 'ido-make-file-list-hook 'ido-sort-mtime)
(add-hook 'ido-make-dir-list-hook 'ido-sort-mtime)
(defun ido-sort-mtime ()
(setq ido-temp-list
(sort ido-temp-list
(lambda (a b)
(time-less-p
(sixth (file-attributes (concat ido-current-directory b)))
(sixth (file-attributes (concat ido-current-directory a)))))))
(ido-to-end ;; move . files to end (again)
(delq nil (mapcar
(lambda (x) (and (char-equal (string-to-char x) ?.) x))
ido-temp-list))))
; sort ido filelist by mtime instead of alphabetically
(add-hook 'ido-make-file-list-hook 'ido-sort-mtime)
(add-hook 'ido-make-dir-list-hook 'ido-sort-mtime)
(defun ido-sort-mtime ()
(setq ido-temp-list
(sort ido-temp-list
(lambda (a b)
(time-less-p
(sixth (file-attributes (concat ido-current-directory b)))
(sixth (file-attributes (concat ido-current-directory a)))))))
(ido-to-end ;; move . files to end (again)
(delq nil (mapcar
(lambda (x) (and (char-equal (string-to-char x) ?.) x))
ido-temp-list))))



Expand All @@ -52,6 +52,9 @@
(add-hook 'php-mode-hook (local-set-key (kbd "C-c C-p") 'php-beginning-of-defun))
(add-hook 'php-mode-hook (local-set-key (kbd "C-c C-n") 'php-end-of-defun))

(eval-after-load 'markdown-mode
'(define-key markdown-mode-map (kbd "C-c r") 'markdown-preview-file))

(global-set-key (kbd "C-c t") 'indent-buffer-2)


Expand Down Expand Up @@ -99,7 +102,6 @@
(global-set-key (kbd "<f12>") 'highlight-symbol-prev)
(global-set-key (kbd "C-c m") 'markdown)

(global-set-key (kbd "C-c r") 'markdown-preview-file)

;; (defun smart-tab ()
;; "This smart tab is minibuffer compliant: it acts as usual in
Expand Down
2 changes: 1 addition & 1 deletion tramp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;; -*- emacs-lisp -*- <13/03/15 21:31:12 /Users/noah/.emacs.d/tramp>
;; -*- emacs-lisp -*- <13/03/20 13:30:52 /Users/noah/.emacs.d/tramp>
;; Tramp connection history. Don't change this file.
;; You can delete it, forcing Tramp to reapply the checks.

Expand Down
12 changes: 12 additions & 0 deletions vendor/yasnippet/snippets/js2-mode/rkd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Author : Noah Isaacson <clewfirst@gmail.com>
#name : var err = rk.truthySync(data, keys) ...
# --
var keys = [$1]
var err = rk.truthySync(data, keys)
if (err) {
return cb({
message: '$2, missing key in data',
error: err,
stack: new Error().stack
})
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Author : Noah Isaacson <clewfirst@gmail.com>
#name : var should = require('should');
# --
var should = require('should');
var should = require('should');
File renamed without changes.
File renamed without changes.

0 comments on commit 9a601af

Please sign in to comment.