Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs direnv #1872

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions Guide/editors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,70 @@ and `chmod +x ~/bin/emacs-line`, then export this env var in your shell (e.g. in
export IHP_EDITOR="$HOME/bin/emacs-line"
```

Another useful package set that integrates with lsp/lsp-ui and loads the default nix environment from direnv as well as removing [common flycheck issue](https://github.com/joncol/dotfiles/blob/master/homedir/.emacs.d/init.el).
This config also adds a jump to definition for functions bound to "C-c p":

```emacs
(use-package direnv
:defer
:custom
(direnv-always-show-summary nil)
:config
(direnv-mode))
(use-package lsp-mode
:custom
(lsp-lens-enable nil)
(lsp-enable-symbol-highlighting nil)

:hook
(lsp-mode . lsp-enable-which-key-integration)

:config
;; This is to make `lsp-mode' work with `direnv' and pick up the correct
;; version of GHC.
(advice-add 'lsp :before #'direnv-update-environment)
(setq lsp-modeline-code-actions-enable nil))

(use-package lsp-ui
:hook (prog-mode . lsp-ui-mode)
:bind (("C-c p" . lsp-ui-peek-find-definitions))
:config
(setq lsp-ui-doc-position 'bottom))

;; (add-hook 'haskell-mode-hook #'lsp)
(use-package flycheck-haskell
;; Disabling this package, since it only gives error:
;; "Reading Haskell configuration failed with exit code Segmentation fault and
;; output:", when trying to run it in Nix/direnv setup.
:disabled
:hook (haskell-mode . flycheck-haskell-setup))

(add-hook 'haskell-mode-hook
(lambda ()
(rainbow-mode -1)
;; we aren't evil:
;; (evil-leader/set-key "x h" 'haskell-hoogle)
;; (setq evil-shift-width 2)
(define-key haskell-mode-map (kbd "C-c C-c C-s")
'haskell-mode-stylish-buffer)
(bind-key (kbd "C-c C-c C-a") 'haskell-sort-imports)
(setq haskell-auto-insert-module-format-string
"module %s\n () where\n\n")
(haskell-auto-insert-module-template)
(smartparens-mode)
(sp-local-pair 'haskell-mode "{" "}")
(setq haskell-hoogle-command nil)
(ligature-mode)))

(use-package lsp-haskell
:hook ((haskell-mode . lsp-deferred)
(haskell-literate-mode . lsp-deferred))
:custom
(lsp-haskell-server-path "haskell-language-server"))

(use-package haskell-mode
:defer)
```

## Using IHP with Vim / NeoVim

Expand Down
58 changes: 58 additions & 0 deletions Guide/search/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading