streamlined haskell mode (eg removed company/flycheck and made intero
integrate better)
This commit is contained in:
parent
17e6d3bdbc
commit
13059454cf
76
conf.org
76
conf.org
|
@ -509,22 +509,18 @@ NOTES:
|
||||||
python-shell-interpreter-args "--colors=Linux --profile=default")
|
python-shell-interpreter-args "--colors=Linux --profile=default")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** haskell
|
*** haskell
|
||||||
|
Haskell is covered just with the basic major mode and intero (provides =company= and =flycheck=) which integrates well with stack.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package haskell-mode
|
(use-package haskell-mode
|
||||||
:ensure t
|
:ensure t
|
||||||
:hook
|
|
||||||
(haskell-mode . company-mode)
|
|
||||||
:config
|
:config
|
||||||
(setq haskell-compile-command "ghc -dynamic -Wall -ferror-spans -threaded -fforce-recomp %s"
|
(setq haskell-interactive-popup-errors nil))
|
||||||
haskell-interactive-popup-errors nil))
|
|
||||||
|
(use-package intero
|
||||||
(use-package company-ghc
|
|
||||||
:ensure t
|
:ensure t
|
||||||
:after
|
:after haskell-mode
|
||||||
(company haskell-mode)
|
|
||||||
:hook
|
:hook
|
||||||
(haskell-mode . (lambda () (setq-local company-backends
|
(haskell-mode . intero-mode))
|
||||||
'((company-ghc))))))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** latex
|
*** latex
|
||||||
**** flycheck
|
**** flycheck
|
||||||
|
@ -2249,6 +2245,12 @@ By default, emacs counts a sentence as having at least 2 spaces after punctuatio
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq sentence-end-double-space nil)
|
(setq sentence-end-double-space nil)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
*** evil state defaults
|
||||||
|
Some modes use primitive emacs bindings by default. Educate them.
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(add-to-list 'evil-motion-state-modes 'ess-help-mode)
|
||||||
|
(add-to-list 'evil-insert-state-modes 'inferior-ess-mode)
|
||||||
|
#+END_SRC
|
||||||
*** enhancements
|
*** enhancements
|
||||||
delightfully ripped off from vim plugins
|
delightfully ripped off from vim plugins
|
||||||
**** surround
|
**** surround
|
||||||
|
@ -2359,35 +2361,49 @@ This is somewhat strange because all I really care about is moving between lines
|
||||||
"0" 'beginning-of-visual-line
|
"0" 'beginning-of-visual-line
|
||||||
"$" 'end-of-visual-line)
|
"$" 'end-of-visual-line)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** ess
|
*** comint
|
||||||
ESS has not joined the dark side. Configure similarly to term (see below) where insert mode goes into "char-mode" where I can type like a normal terminal
|
Comint-based inferior modes often are not evil (eg =intero= and =ESS=). Configure this similarly to term (see below) where C-j/k navigate cmd history and insert mode goes to cmd input line.
|
||||||
|
**** interactive functions
|
||||||
|
Some common interactive functions for comint-based modes
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-to-list 'evil-motion-state-modes 'ess-help-mode)
|
(defun nd/comint-char-mode-evil-insert ()
|
||||||
(add-to-list 'evil-insert-state-modes 'inferior-ess-mode)
|
|
||||||
|
|
||||||
(defun nd/ess-char-mode-insert ()
|
|
||||||
"If not at the last line, go to the end of the buffer and enter insert mode. Else just enter insert mode."
|
"If not at the last line, go to the end of the buffer and enter insert mode. Else just enter insert mode."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (/= (line-number-at-pos (point)) (line-number-at-pos (point-max)))
|
(if (/= (line-number-at-pos (point)) (line-number-at-pos (point-max)))
|
||||||
(goto-char (point-max))))
|
(goto-char (point-max))))
|
||||||
|
|
||||||
(defun nd/inferior-ess-send-input ()
|
(defun nd/comint-send-input-evil-insert (&optional send-input-cmd)
|
||||||
"Go into insert mode after `inferior-ess-send-input'."
|
"Go into insert mode after calling SEND-INPUT-CMD which is usually
|
||||||
|
the function that send the command to the interactive process in the
|
||||||
|
REPL. If no SEND-INPUT-CMD then `comint-send-input' is used."
|
||||||
(interactive)
|
(interactive)
|
||||||
(inferior-ess-send-input)
|
(if send-input-cmd (funcall send-input-cmd) (comint-send-input))
|
||||||
(evil-insert 1))
|
(evil-insert 1))
|
||||||
|
|
||||||
(evil-define-key 'normal inferior-ess-mode-map
|
(evil-define-key '(normal insert) comint-mode-map
|
||||||
(kbd "RET") 'nd/inferior-ess-send-input)
|
|
||||||
|
|
||||||
(evil-define-key '(normal insert) inferior-ess-mode-map
|
|
||||||
(kbd "C-k") 'comint-previous-input
|
(kbd "C-k") 'comint-previous-input
|
||||||
(kbd "C-j") 'comint-next-input)
|
(kbd "C-j") 'comint-next-input)
|
||||||
|
#+END_SRC
|
||||||
|
**** ess
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(evil-define-key 'normal inferior-ess-mode-map
|
||||||
|
(kbd "RET") (lambda () nd/comint-send-input-evil-insert
|
||||||
|
'inferior-ess-send-input))
|
||||||
|
|
||||||
(add-hook 'inferior-ess-mode-hook
|
(add-hook 'inferior-ess-mode-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(add-hook 'evil-insert-state-entry-hook
|
(add-hook 'evil-insert-state-entry-hook
|
||||||
'nd/ess-char-mode-insert nil t)))
|
'nd/comint-char-mode-evil-insert nil t)))
|
||||||
|
#+END_SRC
|
||||||
|
**** intero
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(evil-define-key 'normal intero-repl-mode-map
|
||||||
|
(kbd "RET") 'nd/comint-send-input-evil-insert)
|
||||||
|
|
||||||
|
(add-hook 'intero-repl-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(add-hook 'evil-insert-state-entry-hook
|
||||||
|
'nd/comint-char-mode-evil-insert nil t)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** collection
|
*** collection
|
||||||
Most packages that don't have an evil version are in this one. I don't like surprises so I set =evil-collection-modes-list= with the modes I actually want. Some of these are further configured below.
|
Most packages that don't have an evil version are in this one. I don't like surprises so I set =evil-collection-modes-list= with the modes I actually want. Some of these are further configured below.
|
||||||
|
@ -2519,14 +2535,6 @@ These are for mode-specific bindings that can/should be outside of the evil maps
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(define-key dired-mode-map (kbd "C-x g") 'magit)
|
(define-key dired-mode-map (kbd "C-x g") 'magit)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** haskell-mode
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(eval-after-load 'haskell-mode
|
|
||||||
'(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile))
|
|
||||||
|
|
||||||
(eval-after-load 'haskell-cabal
|
|
||||||
'(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-compile))
|
|
||||||
#+END_SRC
|
|
||||||
*** helm-prefix
|
*** helm-prefix
|
||||||
Some of these are useful enough that I make give them a direct binding without requiring a prefix. For now this is fine.
|
Some of these are useful enough that I make give them a direct binding without requiring a prefix. For now this is fine.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
|
Loading…
Reference in New Issue