summary refs log tree commit diff stats
path: root/tag-emacs/emacs.d/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'tag-emacs/emacs.d/init.el')
-rw-r--r--tag-emacs/emacs.d/init.el67
1 files changed, 49 insertions, 18 deletions
diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el
index 694e984..7d16a8c 100644
--- a/tag-emacs/emacs.d/init.el
+++ b/tag-emacs/emacs.d/init.el
@@ -351,6 +351,7 @@
           (ap/create-helm-dash-hook ansible ("Ansible"))
           (ap/create-helm-dash-hook php ("PHP" "Symfony"))
           (ap/create-helm-dash-hook twig ("Twig"))
+          (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express"))
           (ap/create-helm-dash-hook markdown ("Markdown"))
           (ap/create-helm-dash-hook saltstack ("SaltStack"))
           (ap/create-helm-dash-hook clojure ("Clojure"))
@@ -417,12 +418,14 @@
 (defun kill-or-delete-this-buffer-dwim (&optional arg)
   "Kills current buffer. With prefix arg, delete it."
   (interactive "P")
-  (message "%s" arg)
   (if (equal arg '(4))
       (delete-current-buffer-file)
     (if server-buffer-clients
         (server-edit)
-      (kill-this-buffer))))
+      (let ((buf (buffer-name)))
+        (when (equalp buf "*HTTP Response*")
+          (other-window 1))
+        (kill-buffer buf)))))
 
 (req-package ws-butler
   :if window-system
@@ -586,7 +589,7 @@
                   helm-input-idle-delay 0
                   ido-use-virtual-buffers t)
             (when (fboundp #'helm-adaptive-mode)
-			  (helm-adaptive-mode 1))))
+              (helm-adaptive-mode 1))))
 
 (req-package helm-files
   :defer t
@@ -788,6 +791,8 @@ mouse-1: Display Line and Column Mode Menu"))))))
 
 (req-package nginx-mode
   :defer t
+  :mode (("/nginx/servers/" . nginx-mode)
+         ("/nginx/.*\\.d/" . nginx-mode))
   :config (progn
             (setq nginx-indent-tabs-mode t)))
 
@@ -1018,6 +1023,10 @@ mouse-1: Display Line and Column Mode Menu"))))))
   :require projectile
   :defer t)
 
+(req-package projector
+  :require projectile
+  :bind (("s-z" . projector-open-project-shell)))
+
 (req-package editorconfig)
 
 (req-package perspective
@@ -1171,13 +1180,16 @@ symbol, not word, as I need this for programming the most."
             (add-hook 'markdown-mode-hook #'turn-on-auto-fill)))
 
 (req-package avy
-  :bind (("M-g g" . avy-goto-line)
-         ("M-g M-g" . avy-goto-line)
-         ("C-|" . avy-goto-line)
-		 ("C-c SPC" . avy-goto-char))
+  :bind* (("M-g g" . avy-goto-line)
+          ("M-g M-g" . avy-goto-line)
+          ("C-|" . avy-goto-line)
+          ("C-c SPC" . avy-goto-char))
   :config (progn
-			(avy-setup-default)
-			(setq avy-all-windows nil)))
+            (avy-setup-default)
+            (setq avy-all-windows nil)))
+
+(use-package ace-jump-buffer
+  :bind ("s-b" . ace-jump-buffer))
 
 (req-package ace-window
   :bind (("s-s" . ace-window))
@@ -1190,7 +1202,9 @@ symbol, not word, as I need this for programming the most."
                                       (?v aw-split-window-vert " Ace - Split Vert Window")
                                       (?b aw-split-window-horz " Ace - Split Horz Window")
                                       (?m delete-other-windows " Ace - Maximize Window")
-                                      (?l delete-other-windows))
+                                      (?l delete-other-windows)
+                                      (?, winner-undo)
+                                      (?. winner-redo))
                   aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o))))
 
 (req-package expand-region
@@ -1247,7 +1261,7 @@ symbol, not word, as I need this for programming the most."
             (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap)
             (bind-key "M-<backspace>" #'backward-kill-word sp-keymap)
             (bind-key "M-?" #'sp-convolute-sexp sp-keymap)
-            (bind-key "M-t" #'sp-transpose-sexp sp-keymap)
+            (bind-key "C-M-t" #'sp-transpose-sexp sp-keymap)
             (bind-key "M-r" #'sp-raise-sexp sp-keymap)
             (bind-key "M-s" #'sp-splice-sexp sp-keymap)
             (bind-key "M-S" #'sp-split-sexp sp-keymap)
@@ -1414,10 +1428,27 @@ symbol, not word, as I need this for programming the most."
             (defun ap/javascript-setup ()
               (autopair-mode -1)
               (auto-indent-mode -1))
+            (defun ap/js2-prev-error ()
+              (interactive)
+              (js2-next-error -1))
+            (bind-key "M-g M-n" #'js2-next-error js2-mode-map)
+            (bind-key "M-g M-p" #'ap/js2-prev-error js2-mode-map)
             (add-hook 'js2-mode-hook #'ap/javascript-setup)
             (setq js2-basic-offset 4
                   js2-include-node-externs t)))
 
+(req-package json-mode
+  :mode ("\\.json\\'" . json-mode))
+
+(req-package restclient
+  :mode ("\\.api\\'" . restclient-mode)
+  :config (progn
+            (defun imenu-restclient-sections ()
+              (setq imenu-prev-index-position-function nil)
+              (add-to-list 'imenu-generic-expression '("Services" "^## ?\\(.+\\)$" 1) t)
+              (add-to-list 'imenu-generic-expression '("Calls" "^# ?\\(.+\\)$" 1) t))
+            (add-hook restclient-mode-hook #'imenu-restclient-sections)))
+
 (req-package tern
   :config (progn
             (setq tern-command (list (executable-find "tern")))
@@ -1510,17 +1541,17 @@ symbol, not word, as I need this for programming the most."
 ;;;; Windows & Frames
 
 (setq frame-title-format
-      '((:eval (capitalize invocation-name)) ": "
-        (:eval (if (and (fboundp #'project-project-p)
+      '((:eval (if (and (fboundp #'projectile-project-p)
                         (projectile-project-p))
-                   (projectile-project-name)
-                 (if (buffer-file-name)
-                     (abbreviate-file-name (buffer-file-name))
-                   "%b")))))
+                   (projectile-project-name)))
+        ": "
+        (:eval (if (buffer-file-name)
+                   (buffer-name)
+                 "%b"))))
 
 (setq scroll-conservatively 100 ; Keep the cursor position when scrolling
       scroll-margin 1
-      scroll-preserve-screen-position nil
+      scroll-preserve-screen-position t
       mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control)))
       split-height-threshold 100)