Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
peacerebel
dotfiles
Commits
132aa754
Verified
Commit
132aa754
authored
Oct 01, 2020
by
peacerebel
Browse files
Better js support
parent
064e9117
Changes
1
Hide whitespace changes
Inline
Side-by-side
.emacs.d/config.el
View file @
132aa754
...
...
@@ -38,6 +38,10 @@
;; Enable pretty symbols globally
(
global-prettify-symbols-mode
t
)
;; Load path from shell
(
use-package
exec-path-from-shell
:config
(
exec-path-from-shell-initialize
))
;; Open emacs config
(
defun
pr/visit-emacs-config
()
"Opens file with Emacs configurations."
...
...
@@ -116,7 +120,9 @@
(
which-key-mode
))
;; THEME
(
use-package
cyberpunk-theme
)
(
use-package
cyberpunk-theme
:init
(
load-theme
'cyberpunk
))
;; Font settings
(
defvar
pr/default-font
"Hack"
)
...
...
@@ -209,10 +215,13 @@ other, future frames."
;; Dumb-jump
(
use-package
dumb-jump
:bind
(
"M-."
.
'xref-find-definitions
)
:config
(
setq
dumb-jump-force-searcher
'rg
)
:init
(
add-hook
'xref-backend-functions
#'
dumb-jump-xref-activate
))
(
setq
xref-backend-functions
(
remq
'etags--xref-backend
xref-backend-functions
))
(
add-hook
'xref-backend-functions
#'
dumb-jump-xref-activate
)
(
setq
dumb-jump-force-searcher
'rg
dumb-jump-selector
'ivy
))
;; Company-mode
(
use-package
company
...
...
@@ -246,6 +255,7 @@ other, future frames."
;; Language servers
(
use-package
lsp-mode
:config
(
setq
lsp-enable-xref
nil
)
(
setq
gc-cons-threshold
100000000
)
;; Why? Visit: https://emacs-lsp.github.io/lsp-mode/page/performance/
(
setq
lsp-completion-provider
:capf
)
:hook
((
js-mode
.
lsp
))
...
...
@@ -292,6 +302,20 @@ other, future frames."
;; Better M-x
(
use-package
smex
)
(
use-package
highlight-symbol
:hook
(
prog-mode
.
highlight-symbol-mode
)
:custom
(
highlight-symbol-idle-delay
0.3
))
(
use-package
highlight-numbers
:hook
(
prog-mode
.
highlight-numbers-mode
))
(
use-package
highlight-operators
:hook
(
prog-mode
.
highlight-operators-mode
))
(
use-package
highlight-escape-sequences
:hook
(
prog-mode
.
hes-mode
))
;; Electric pair
(
electric-pair-mode
t
)
...
...
@@ -308,7 +332,14 @@ other, future frames."
;; Flycheck
(
use-package
flycheck
:ensure
t
:init
(
global-flycheck-mode
))
:config
(
setq-default
flycheck-disabled-checkers
(
append
flycheck-disabled-checkers
'
(
javascript-jshint
)))
:init
(
flycheck-add-mode
'javascript-eslint
'web-mode
)
(
flycheck-add-mode
'javascript-eslint
'js-mode
)
(
global-flycheck-mode
))
(
use-package
flycheck-color-mode-line
:hook
...
...
@@ -345,6 +376,31 @@ other, future frames."
(
tide-hl-identifier-mode
+1
)
(
company-mode
+1
)))
;; Javascript
(
setq
js-indent-level
2
)
(
use-package
tern
:config
(
unbind-key
"M-."
tern-mode-keymap
)
(
unbind-key
"M-,"
tern-mode-keymap
)
(
add-hook
'js-mode-hook
(
lambda
()
(
tern-mode
t
))))
(
eval-after-load
'js
'
(
define-key
js-mode-map
(
kbd
"M-."
)
nil
))
(
defun
my/use-eslint-from-node-modules
()
"Find local eslisnt installation."
(
let*
((
root
(
locate-dominating-file
(
or
(
buffer-file-name
)
default-directory
)
"node_modules"
))
(
eslint
(
and
root
(
expand-file-name
"node_modules/eslint/bin/eslint.js"
root
))))
(
when
(
and
eslint
(
file-executable-p
eslint
))
(
setq-local
flycheck-javascript-eslint-executable
eslint
))))
(
add-hook
'flycheck-mode-hook
#'
my/use-eslint-from-node-modules
)
;; TeX
(
use-package
auctex
:defer
t
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment