74 lines
2.3 KiB
EmacsLisp
74 lines
2.3 KiB
EmacsLisp
;;; prog.el --- setup shared defaults for programming modes -*- lexical-binding: t; -*-
|
|
;;; Commentary:
|
|
;;; Code:
|
|
|
|
(defun user--prog-mode-hook ()
|
|
"Programming mode hook."
|
|
(user--fundamental-mode-hook)
|
|
|
|
(when (user-flyspell-p)
|
|
;; Protect against missing dictionary.
|
|
(try-eval
|
|
;; Run spell-checker in programming mode.
|
|
(flyspell-prog-mode)))
|
|
|
|
;; Buttonize links.
|
|
;;(goto-address-prog-mode t)
|
|
|
|
;;(outline-minor-mode t)
|
|
|
|
(validate-setq
|
|
;; When using fill-paragraph or auto-fill-mode break lines at 80 characters by
|
|
;; default.
|
|
fill-column 120)
|
|
|
|
;; Try to enable completion system.
|
|
(cond
|
|
;; ((user/auto-complete-p) (auto-complete-mode t))
|
|
((user/company-mode-p) (company-mode t)))
|
|
|
|
;;; (Bindings) ;;;
|
|
(user/bind-key-local :code :comment (if (feature-p 'comment-dwim-2)
|
|
'comment-dwim-2
|
|
'comment-dwim)))
|
|
|
|
|
|
(use-package prog-mode
|
|
:ensure nil
|
|
:hook (prog-mode-hook . user--prog-mode-hook)
|
|
:config
|
|
;;; (Packages) ;;;
|
|
;; https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/subword.el
|
|
;; Handling capitalized subwords in a nomenclature
|
|
(use-package subword
|
|
:disabled
|
|
:ensure nil
|
|
:diminish subword-mode)
|
|
;; https://github.com/remyferre/comment-dwim-2
|
|
;; A replacement for the emacs' built-in command `comment-dwim'
|
|
(use-package comment-dwim-2)
|
|
;; https://github.com/emacsorphanage/quickrun
|
|
;; Run command quickly. This packages is inspired quickrun.vim
|
|
(use-package quickrun
|
|
:bind-wrap
|
|
(:map prog-mode-map
|
|
((:key :code :eval-buffer) . quickrun)
|
|
((:key :code :eval-selection) . quickrun-region)))
|
|
;; https://github.com/vincekd/comment-tags
|
|
;; Emacs package to highlight and manage comment tags like TODO, BUG, FIXME, etc.
|
|
(use-package comment-tags
|
|
:diminish comment-tags-mode
|
|
:hook (prog-mode-hook . comment-tags-mode)
|
|
:config
|
|
(setq
|
|
comment-tags/keymap-prefix (user/get-key :nav :find-todos)))
|
|
;; https://github.com/ignacy/idle-highlight-in-visible-buffers-mode
|
|
;; An Emacs minor mode that highlights current word in all visible buffers
|
|
(use-package idle-highlight-in-visible-buffers-mode
|
|
:disabled
|
|
:hook (prog-mode-hook . idle-highlight-in-visible-buffers-mode)))
|
|
|
|
|
|
(provide 'modes/prog)
|
|
;;; prog.el ends here
|