-
Notifications
You must be signed in to change notification settings - Fork 2
/
editing.el
82 lines (63 loc) · 2.33 KB
/
editing.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
;;; editing.el --- Editing
;;; Commentary:
;; Editor customizations
;;; Code:
(require 'saveplace)
(require 'multiple-cursors)
(setq-default indent-tabs-mode nil)
(setq-default save-place t)
(setq save-place-file (concat user-emacs-directory "places"))
(setq backup-directory-alist `(("." . ,(concat user-emacs-directory
"backups"))))
(setq auto-save-default nil)
(setq electric-indent-mode nil)
;; enable special chars in the editor, like ~ and ^.
(load-library "iso-transl")
(defun toggle-comment-on-line-or-region ()
"Comment or uncomment current line, or region if selected."
(interactive "*")
(if (use-region-p)
(comment-or-uncomment-region (region-beginning) (region-end))
(comment-or-uncomment-region (line-beginning-position) (line-end-position))))
(defun setup-editing ()
"Setup editing."
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-lisp-symbol-partially
try-complete-lisp-symbol))
(show-paren-mode 1)
(global-hl-line-mode 1)
(setq company-tooltip-align-annotations t)
;; auto complete with docstrings
(company-quickhelp-mode)
(set-default 'truncate-lines t)
(editorconfig-mode 1)
;; Replace highlighted text when you type
(delete-selection-mode 1)
)
(global-set-key (kbd "C-;") 'toggle-comment-on-line-or-region)
(global-set-key (kbd "M-/") 'hippie-expand)
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
(global-set-key (kbd "C-M-s") 'isearch-forward)
(global-set-key (kbd "C-M-r") 'isearch-backward)
(global-set-key [(control shift up)] 'move-text-up)
(global-set-key [(control shift down)] 'move-text-down)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(emojify-set-emoji-styles '(unicode))
;; auto complete
(add-hook 'after-init-hook 'global-company-mode)
(add-hook 'after-init-hook 'setup-editing)
(add-hook 'after-init-hook #'global-emojify-mode)
;; syntax checking
(use-package flycheck
:ensure t
:init (global-flycheck-mode)
:hook (add-node-modules-path))
(provide 'editing)
;;; editing.el ends here