summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2022-09-05 13:09:22 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2022-09-05 13:09:22 -0400
commitad7f668eda2b496f8579ce388fa45dac3b482489 (patch)
tree6cc45d136e93d7fbd1a27f68ee350e56b2020d6b
parent6257322d751dc36eaaf509682da164f6aef3ff90 (diff)
Some general improvements for web mode, need to test them out on a real project though
-rw-r--r--init.el5
-rw-r--r--lisp/cpp.el22
-rw-r--r--lisp/general.el17
-rw-r--r--lisp/latex-custom.el6
-rw-r--r--lisp/web.el17
5 files changed, 30 insertions, 37 deletions
diff --git a/init.el b/init.el
index a4dbbd3..4a91f67 100644
--- a/init.el
+++ b/init.el
@@ -50,9 +50,6 @@
(require 'web)
(require 'markdown)
-(require 'latex-custom)
-(setup-latex)
-
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -63,7 +60,7 @@
'(org-agenda-files (list org-directory))
'(org-directory "~/Documents/org")
'(package-selected-packages
- '(eglot json-mode markdown-mode emojify tern rtags cmake-ide cmake-mode tide auctex evil js2-highlight-vars ac-js2 js2-refactor js2-mode flycheck-irony company-irony all-the-icons req-package projectile irony org)))
+ '(smartparens xref-js2 eglot json-mode markdown-mode emojify tern rtags cmake-ide cmake-mode tide auctex evil js2-highlight-vars ac-js2 js2-refactor js2-mode flycheck-irony company-irony all-the-icons req-package projectile irony org)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
diff --git a/lisp/cpp.el b/lisp/cpp.el
index 3565a16..1fdbb7c 100644
--- a/lisp/cpp.el
+++ b/lisp/cpp.el
@@ -12,30 +12,12 @@
;; (electric-indent-mode 0)
)
-;; Irony mode.
-(use-package irony
- :ensure t
- :defer t
- :init
- (add-hook 'c++-mode-hook 'irony-mode)
- (add-hook 'c-mode-hook 'irony-mode)
- (add-hook 'objc-mode-hook 'irony-mode)
- :config
- ;; replace the `completion-at-point' and `complete-symbol' bindings in
- ;; irony-mode's buffers by irony-mode's function
- (defun my-irony-mode-hook ()
- (define-key irony-mode-map [remap completion-at-point]
- 'irony-completion-at-point-async)
- (define-key irony-mode-map [remap complete-symbol]
- 'irony-completion-at-point-async))
- (add-hook 'irony-mode-hook 'my-irony-mode-hook)
- (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
- )
-
(require 'cmake-ide)
+(require 'eglot)
(cmake-ide-setup)
(add-hook 'c-mode-common-hook 'setup-c)
+(add-hook 'c-mode-common-hook 'eglot-ensure)
(provide 'cpp)
;;; cpp.el ends here
diff --git a/lisp/general.el b/lisp/general.el
index dc3af36..0b0d7ca 100644
--- a/lisp/general.el
+++ b/lisp/general.el
@@ -43,7 +43,7 @@
(setq initial-major-mode 'text-mode)
;(desktop-save-mode 1)
-;; Projectile for projects
+;; Projectile for project navigation
(require 'projectile)
(projectile-mode +1)
(define-key projectile-mode-map (kbd "s-q") 'projectile-command-map)
@@ -56,6 +56,15 @@
(setq neo-smart-open t)
;;(setq projectile-switch-project-action 'neotree-projectile-action)
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
+(evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
+(evil-define-key 'normal neotree-mode-map (kbd "SPC") 'neotree-quick-look)
+(evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
+(evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
+(evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh)
+(evil-define-key 'normal neotree-mode-map (kbd "n") 'neotree-next-line)
+(evil-define-key 'normal neotree-mode-map (kbd "p") 'neotree-previous-line)
+(evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle)
+(evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle)
;; Smooth scroll
(setq redisplay-dont-pause t
@@ -84,7 +93,7 @@
(setq emojify-emoji-styles '(unicode))
(bind-key* (kbd "C-c e") #'emojify-insert-emoji)) ; override binding in any mode
-;; Company mode
+;; Company mode for code completion
(use-package company
:ensure t
:defer t
@@ -99,11 +108,7 @@
company-backends '((company-irony company-gtags))
company-vscode-light-icons-margin 1
)
- :bind ("C-;" . company-complete-common)
)
-;; Flycheck
-(eval-after-load 'flycheck '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
-
(provide 'general)
;;; general.el ends here
diff --git a/lisp/latex-custom.el b/lisp/latex-custom.el
deleted file mode 100644
index 65f73db..0000000
--- a/lisp/latex-custom.el
+++ /dev/null
@@ -1,6 +0,0 @@
-
-(defun setup-latex()
- ;(setq TeX-PDF-mode t)
-)
-
-(provide 'latex-custom)
diff --git a/lisp/web.el b/lisp/web.el
index ae8f96c..cf78b7e 100644
--- a/lisp/web.el
+++ b/lisp/web.el
@@ -37,17 +37,32 @@
)
(add-hook 'js2-mode-hook 'my-js2-mode-hook)
(add-hook 'js2-mode-hook 'eglot-ensure)
+(add-hook 'js2-mode-hook #'smartparens-mode)
(push '("\\.js[x]?\\'" . js2-mode) auto-mode-alist)
+(define-key js2-mode-map (kbd "M-.") nil)
+(add-hook 'js2-mode-hook (lambda ()
+ (add-hook 'xref-backend-functions #'xref-js2-xref-backend nil t)))
+(setq js2-highlight-level 3)
+(setq js2-idle-timer-delay 0.1)
;; JS2-Refactor
(use-package js2-refactor)
(add-hook 'js2-mode-hook #'js2-refactor-mode)
-(js2r-add-keybindings-with-prefix "C-c C-r")
+(defun keybind-setup()
+ "Set up the keybinds."
+ (local-set-key [f2] 'js2r-rename-var)
+)
+(add-hook 'js2-mode-hook 'keybind-setup)
;; Web goodies
(autoload 'json-mode "json-mode"
"Use the json-mode package to provide 'json-mode on-demand."
t)
+;; Ignore certain directories in projectile
+(with-eval-after-load 'projectile
+ (add-to-list 'projectile-globally-ignored-directories "node_modules")
+ (add-to-list 'projectile-project-root-files "package.json"))
+
(provide 'web)
;;; web.el ends here