commit 590d8e72b5e097fb721cb8d835a6c8fb9e20638f
parent 7fdca6f499bc4bed790e6feb87d98921b4a91250
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date: Wed, 8 Nov 2017 14:11:46 -0500
Edit some setup files.
Diffstat:
7 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/init.el b/init.el
@@ -96,10 +96,7 @@
(require 'setup-undo-tree)
;; Setup Email
-(require 'setup-email)
-
-;; Setup key bindings
-(require 'key-bindings)
+;; (require 'setup-email)
;; Setup Editorconfig
(require 'setup-editorconfig)
@@ -110,6 +107,9 @@
;; Setup Company mode
(require 'setup-ediff)
+;; Setup key bindings
+(require 'key-bindings)
+
;; Bookmarks
;; To have emacs open bookmarks on startup
(setq inhibit-splash-screen t)
diff --git a/lisp/key-bindings.el b/lisp/key-bindings.el
@@ -62,4 +62,13 @@
;; Toggle Fullscreen Mode
(global-set-key (kbd "C-c <") 'fullscreen-mode-fullscreen-toggle)
+;; js-mode (which js2 is based on) binds "M-." which conflicts with xref, so
+;; unbind it.
+(define-key js-mode-map (kbd "M-.") nil)
+(define-key js2-mode-map (kbd "C-k") #'js2r-kill)
+
+;; Disable completion keybindings, as we use xref-js2 instead
+;; (define-key tern-mode-keymap (kbd "M-.") nil)
+;; (define-key tern-mode-keymap (kbd "M-,") nil)
+
(provide 'key-bindings)
diff --git a/lisp/setup-company-mode.el b/lisp/setup-company-mode.el
@@ -3,10 +3,14 @@
;; Load company mode
;; and company mode html backend
(require 'company)
+(require 'company-tern)
(require 'company-web-html)
;; Possible improvements of company-mode
-(add-to-list 'company-backends 'company-tern)
+(add-to-list 'company-backends 'company-shell)
+(add-hook 'js2-mode-hook (lambda ()
+ ;; (tern-mode)
+ (company-mode)))
;; Bigger popup window
(setq company-tooltip-limit 20)
@@ -15,14 +19,15 @@
(setq company-tooltip-align-annotations 't)
;; Decrease delay before autocompletion popup shows
-(setq company-idle-delay .3)
+(setq company-idle-delayq 0.1)
-; Start autocompletion only after typing
+;; Start autocompletion only after typing
(setq company-begin-commands '(self-insert-command))
;; Enabled Company Mode on startup
(add-hook 'after-init-hook 'global-company-mode)
+
(setq company-etags-everywhere '(php-mode html-mode web-mode nxml-mode))
(provide 'setup-company-mode)
diff --git a/lisp/setup-email.el b/lisp/setup-email.el
@@ -36,11 +36,11 @@
(setq message-send-mail-function 'smtpmail-send-it
starttls-use-gnutls t
smtpmail-starttls-credentials
- '(("soucy.cc" 587 nil nil))
+ '(("mail63.csoft.net" 587 nil nil))
smtpmail-auth-credentials
(expand-file-name "~/.authinfo.gpg")
- smtpmail-default-smtp-server "soucy.cc"
- smtpmail-smtp-server "soucy.cc"
+ smtpmail-default-smtp-server "mail63.csoft.net"
+ smtpmail-smtp-server "mail63.csoft.net"
smtpmail-smtp-service 587
smtpmail-debug-info t)
diff --git a/lisp/setup-js-mode.el b/lisp/setup-js-mode.el
@@ -1,8 +1,22 @@
+(require 'js2-mode)
+(require 'js2-refactor)
+(require 'xref-js2)
+
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
+
;; Fix the indentation for the `switch` statement
-;; (setq js-switch-indent-offset 4)
+(setq js-switch-indent-offset 4)
(setq js2-indent-switch-body t)
(add-hook 'js2-mode-hook 'ac-js2-mode)
+;; Better imenu
+(add-hook 'js2-mode-hook #'js2-imenu-extras-mode)
+(add-hook 'js2-mode-hook #'js2-refactor-mode)
+
+(js2r-add-keybindings-with-prefix "C-c C-r")
+
+(add-hook 'js2-mode-hook (lambda ()
+ (add-hook 'xref-backend-functions #'xref-js2-xref-backend nil t)))
+
(provide 'setup-js-mode)
diff --git a/lisp/setup-macros.el b/lisp/setup-macros.el
@@ -31,6 +31,9 @@
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote (".x {}" 0 "%d")) arg)))
;; #x {}
(fset 'css-id
- (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ("#x {}" 0 "%d")) arg)))
+ (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ("#x {}" 0 "%d")) arg)))
+
+(fset 'bash-var-to-json
+ [?\C-k ?\C-k ?\{ delete ?\M-> ?\} ?\M-< ?\C-n ?\C- ?\C-n ?\C-n ?\C-n ?\C-c ?m ?\C- ?\M-f ?\" ?: delete ? ?\C-g ?\M-< ?\C-n ?\C- ?\C-n ?\C-n ?\C-n ?\C-p ?\C-c ?m ?\C-e ?, ?\C-g ?\C-x ?h tab ?\C-x ?\C-s])
(provide 'setup-macros)
diff --git a/lisp/setup-web-mode.el b/lisp/setup-web-mode.el
@@ -10,6 +10,8 @@
(add-to-list 'auto-mode-alist '("\\.xhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
+(add-to-list 'auto-mode-alist '("\\.tpl\\'" . web-mode))
+(add-to-list 'auto-mode-alist '("\\.ftl\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.vm\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))