diff --git a/.config/emacs/init.org b/.config/emacs/init.org index 614c463..cb154e2 100644 --- a/.config/emacs/init.org +++ b/.config/emacs/init.org @@ -283,7 +283,7 @@ Setup other stuff (doom-modeline-set-modeline 'main 'default))) -(dolist (mode '(dired-mode-hook lsp-help-mode-hook)) +(dolist (mode '(dired-mode-hook lsp-help-mode-hook fundamental-mode-hook)) (add-hook mode (lambda () (setq truncate-lines t)))) ;; (straight-use-package 'centaur-tabs) @@ -534,6 +534,7 @@ Emacs is an great operating system, if only it had a good text editor... (add-hook 'emacs-startup-hook (lambda () + (evil-global-set-key 'normal (kbd "t") tab-prefix-map) (evil-define-key 'normal 'global (kbd "q") 'kill-buffer-and-window (kbd "k") 'kill-this-buffer @@ -783,7 +784,6 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun (evil-global-set-key 'normal (kbd "M-8") '(lambda () (interactive) (tab-bar-select-tab 8))) (evil-global-set-key 'normal (kbd "M-9") '(lambda () (interactive) (tab-bar-select-tab 9))) -(evil-global-set-key 'normal (kbd "t") tab-prefix-map) #+end_src ** Projects #+begin_src emacs-lisp @@ -851,6 +851,8 @@ Vertico Embark Marginalia Consult Orderless (straight-use-package 'embark) +(setq embark-quit-after-action '((kill-buffer . nil))) + (defvar joe-mode-map (let ((map (make-sparse-keymap))) ;; (define-key map (kbd "C-'") #'embark-act) @@ -1377,6 +1379,51 @@ it doesn't close it. (straight-use-package 'fsharp-mode) ;; (straight-use-package 'eglot-fsharp) +#+end_src +*** OCaml +#+begin_src emacs-lisp +(straight-use-package 'tuareg) +(straight-use-package 'dune) +(straight-use-package 'utop) +(straight-use-package 'merlin) +(straight-use-package 'merlin-eldoc) +;; Might be worth checking out, depeding on whether we stick with flycheck or not +;; (straight-use-package 'flycheck-ocaml) +;; Also check this out, see if it adds anything +;; (require 'ocp-indent) + +(defun opam-env () + "Load the opam env to get the PATH variables so everything works" + (interactive nil) + (dolist (var + (car (read-from-string + (shell-command-to-string "opam config env --sexp")))) + (setenv (car var) (cadr var)))) +(setq opam-share + (substring (shell-command-to-string + "opam config var share 2> /dev/null") 0 -1)) +(add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share)) +(require 'utop) +#+end_src + +We won't use the LSP server but rather directly talk to Merlin, since I guess LSP just wraps Merlin +and there's no need for a middle-man when it's already been implemented. + +#+begin_src emacs-lisp + +;; Use the opam installed utop +(setq utop-command "opam exec -- utop -emacs") + +(let ((opam-share (ignore-errors (car (process-lines "opam" "var" "share"))))) + (when (and opam-share (file-directory-p opam-share)) + ;; Register Merlin + (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share)) + (autoload 'merlin-mode "merlin" nil t nil) + ;; Automatically start it in OCaml buffers + (add-hook 'tuareg-mode-hook 'merlin-mode t) + (add-hook 'caml-mode-hook 'merlin-mode t) + ;; Use opam switch to lookup ocamlmerlin binary + (setq merlin-command 'opam))) #+end_src *** Other #+begin_src emacs-lisp diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 39762ce..1cf1a2c 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -80,3 +80,6 @@ function fish_prompt --description 'Write out the prompt; do not replace this. I end set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX $HOME ; set -gx PATH $HOME/.cabal/bin $PATH /home/joe/.ghcup/bin # ghcup-env + +# opam configuration +source /home/joe/.local/share/opam/opam-init/init.fish > /dev/null 2> /dev/null; or true diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables index 2739229..fa9c5f1 100644 --- a/.config/fish/fish_variables +++ b/.config/fish/fish_variables @@ -4,6 +4,7 @@ SETUVAR EDITOR:hx SETUVAR --export --path GOPATH:/home/joe/\x2elocal/share/go/ SETUVAR --export LC_COLLATE:C SETUVAR --export NNN_FIFO:/tmp/nnn\x2efifo +SETUVAR --export OPAMROOT:/home/joe/\x2elocal/share/opam/ SETUVAR --export VISUAL:hx SETUVAR XDG_CACHE_HOME:/home/joe/\x2ecache SETUVAR XDG_CONFIG_HOME:/home/joe/\x2econfig