diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/general.el | 8 | ||||
-rw-r--r-- | lisp/web.el | 23 |
2 files changed, 11 insertions, 20 deletions
diff --git a/lisp/general.el b/lisp/general.el index 1ee912c..5d992bf 100644 --- a/lisp/general.el +++ b/lisp/general.el @@ -53,11 +53,9 @@ ;; Ido mode text matching (require 'ivy) (ivy-mode 1) -(global-set-key (kbd "C-x C-f") 'counsel-find-file) ;; Tree (require 'neotree) -(global-set-key (kbd "C-;") 'neotree-toggle) (setq neo-smart-open t) ;;(setq projectile-switch-project-action 'neotree-projectile-action) (setq neo-theme (if (display-graphic-p) 'icons 'arrow)) @@ -97,6 +95,12 @@ (setq emojify-emoji-styles '(unicode)) (bind-key* (kbd "C-c e") #'emojify-insert-emoji)) ; override binding in any mode +;; Global key binds +(bind-key* (kbd "<f2>") #'eglot-rename) +(bind-key* (kbd "C-x C-f") 'counsel-find-file) +(bind-key* (kbd "C-;") 'neotree-toggle) +(bind-key* (kbd "M-F") 'projectile-grep) + ;; Company mode for code completion (use-package company :ensure t diff --git a/lisp/web.el b/lisp/web.el index b29d58f..655dd03 100644 --- a/lisp/web.el +++ b/lisp/web.el @@ -32,34 +32,21 @@ (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) -(defun js2-refactor-keybind-setup() - "Set up the keybinds." - (local-set-key [f2] 'js2r-rename-var) -) -(add-hook 'js2-mode-hook 'js2-refactor-keybind-setup) - - ;; Tide for refactoring -(defun setup-tide-mode() - (tide-setup) - (local-set-key [f2] 'tide-rename-symbol) - (tide-hl-identifier-mode +1) +(defun setup-typescript() (setq typescript-indent-level 2) (company-mode t) (company-quickhelp-mode t) (smartparens-mode 1) ) -(add-hook 'typescript-mode-hook #'setup-tide-mode) +(add-hook 'typescript-mode-hook #'setup-typescript) (require 'web-mode) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)) (add-hook 'web-mode-hook (lambda () (when (string-equal "tsx" (file-name-extension buffer-file-name)) - (setup-tide-mode)))) + (setup-typescript)))) ;; enable typescript-tslint checker (flycheck-add-mode 'typescript-tslint 'web-mode) @@ -70,9 +57,9 @@ :ensure t :defer 3 :hook - ((js2-mode) . eglot-ensure)) + ((js2-mode typescript-mode) . eglot-ensure)) :config - (cl-pushnew '((js-mode typescript-mode typescriptreact-mode) . ("typescript-language-server" "--stdio")) + (cl-pushnew '((js-mode typescript-mode) . ("typescript-language-server" "--stdio")) eglot-server-programs :test #'equal) |