181 lines
6.8 KiB
EmacsLisp
181 lines
6.8 KiB
EmacsLisp
;;; init.el --- config file for emacs
|
|
|
|
;;; Commentary:
|
|
|
|
;; -*- lexical-binding: t -*-
|
|
|
|
;;; Code:
|
|
|
|
(require 'package)
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
|
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
|
|
;; and `package-pinned-packages`. Most users will not need or want to do this.
|
|
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
|
|
(package-initialize)
|
|
|
|
;; Ensure package-list has been fetched
|
|
(when (not package-archive-contents)
|
|
(package-refresh-contents))
|
|
|
|
;; We want to use use-package, not the default emacs behavior
|
|
(setq package-enable-at-startup nil)
|
|
|
|
;; Install use-package if it hasn't been installed
|
|
(when (not (package-installed-p 'use-package)) (package-install 'use-package))
|
|
(require 'use-package)
|
|
|
|
;; ido-mode provides a better file/buffer-selection interface
|
|
;; But fido vertical mode is better
|
|
(use-package ido
|
|
:ensure t
|
|
:config (fido-vertical-mode t))
|
|
|
|
;; ido for M-x
|
|
(use-package smex
|
|
:ensure t
|
|
:config
|
|
(progn
|
|
(smex-initialize)
|
|
(global-set-key (kbd "M-x") 'smex)
|
|
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
|
|
;; This is your old M-x.
|
|
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)))
|
|
|
|
;; Directional windown selection
|
|
;; Shift + Arrows to point to the next window
|
|
(windmove-default-keybindings)
|
|
|
|
;; Provides all the racket support
|
|
(use-package racket-mode
|
|
:ensure t)
|
|
|
|
;; Syntax checking
|
|
(use-package flycheck
|
|
:ensure t
|
|
:config
|
|
(global-flycheck-mode))
|
|
|
|
;; Autocomplete popups
|
|
(use-package company
|
|
:ensure t
|
|
:config
|
|
(progn
|
|
(setq company-idle-delay 0.2
|
|
;; min prefix of 2 chars
|
|
company-minimum-prefix-length 2
|
|
company-selection-wrap-around t
|
|
company-echo-delay 0
|
|
company-tooltip-limit 20
|
|
company-transformers '(company-sort-by-occurrence)
|
|
company-begin-commands '(self-insert-command)
|
|
)
|
|
(global-company-mode))
|
|
)
|
|
|
|
;; Lots of parenthesis and other delimiter niceties
|
|
(use-package paredit
|
|
:ensure t
|
|
:config
|
|
(add-hook 'racket-mode-hook #'enable-paredit-mode))
|
|
|
|
;; Colorizes delimiters so they can be told apart
|
|
(use-package rainbow-delimiters
|
|
:ensure t
|
|
:config (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
|
|
;; Make buffer names unique
|
|
;; buffernames that are foo<1>, foo<2> are hard to read. This makes them foo|dir foo|otherdir
|
|
(use-package uniquify
|
|
:config (setq uniquify-buffer-name-style 'post-forward))
|
|
|
|
;; Highlight matching parenthesis
|
|
(show-paren-mode 1)
|
|
(setq show-paren-delay 0)
|
|
|
|
;; Allows moving through wrapped lines as they appear
|
|
(setq line-move-visual t)
|
|
|
|
(custom-set-variables
|
|
;; custom-set-variables was added by Custom.
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
;; Your init file should contain only one such instance.
|
|
;; If there is more than one, they won't work right.
|
|
'(custom-enabled-themes '(misterioso))
|
|
'(ledger-default-date-format "%Y/%m/%d")
|
|
'(ledger-reports
|
|
'(("reg" "ledger [[ledger-mode-flags]] -f /home/haqadosch/Documents/Accounting/ledger.dat reg")
|
|
("bal" "ledger [[ledger-mode-flags]] -f /home/haqadosch/Documents/Accounting/ledger.dat bal")
|
|
("payee" "%(binary) -f %(ledger-file) reg @%(payee)")
|
|
("account" "%(binary) -f %(ledger-file) reg %(account)")))
|
|
'(org-agenda-files '("~/Documents/agenda.org"))
|
|
'(package-selected-packages
|
|
'(gptel company-ledger flycheck-ledger ledger-mode ellama 0blayout magit magit-annex magit-commit-mark magit-delta magit-diff-flycheck magit-filenotify magit-find-file magit-gerrit magit-gh-pulls magit-gitflow magit-imerge magit-lfs magit-org-todos magit-p4 magit-patch-changelog magit-popup magit-rbr magit-reviewboard magit-stats magit-stgit magit-svn magit-tbdiff magit-todos magit-topgit magit-vcsh magithub mermaid-mode mermaid-ts-mode ob-mermaid rust-mode company-web company elfeed-autotag elfeed-curate elfeed-dashboard elfeed-goodies elfeed-org elfeed-protocol elfeed-score elfeed-summary elfeed-tube-mpv elfeed-web elfeed-webkit smex typescript-mode deno-fmt flycheck-deno ob-deno flycheck emms racket-mode pdf-tools))
|
|
'(safe-local-variable-values '((my-variables . value)))
|
|
'(warning-suppress-log-types '((comp))))
|
|
'(warning-suppress-types '((comp) (comp) (comp)))
|
|
(custom-set-faces
|
|
;; custom-set-faces was added by Custom.
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
;; Your init file should contain only one such instance.
|
|
;; If there is more than one, they won't work right.
|
|
)
|
|
|
|
;; Specify mmdc path for org-babel with mermaid
|
|
(setq ob-mermaid-cli-path "/home/haqadosch/.nvm/versions/node/v20.10.0/bin/mmdc")
|
|
|
|
;; active Babel languages
|
|
(org-babel-do-load-languages
|
|
'org-babel-load-languages
|
|
'((js . t)
|
|
(shell . t)))
|
|
|
|
;; Deno config with eglot
|
|
(add-to-list 'eglot-server-programs '((js-mode typescript-mode) . (eglot-deno "deno" "lsp")))
|
|
|
|
(defclass eglot-deno (eglot-lsp-server) ()
|
|
:documentation "A custom class for deno lsp.")
|
|
|
|
(cl-defmethod eglot-initialization-options ((server eglot-deno))
|
|
"Passes through required deno initialization options"
|
|
(list :enable t
|
|
:lint t))
|
|
|
|
;; Remap list buffers =C-x C-b= with the ibuffer command
|
|
(global-set-key [remap list-buffers] 'ibuffer)
|
|
|
|
;; Highlight lines that go beyond the 80 char limit
|
|
(require 'whitespace)
|
|
(setq whitespace-style '(face empty tabs lines-tail trailing))
|
|
(global-whitespace-mode t)
|
|
|
|
;; Shows the column number in the modline
|
|
(setq column-number-mode t)
|
|
|
|
;; OPAM set up for ocp-ident
|
|
(add-to-list 'load-path "/home/haqadosch/.opam/ocaml-book/share/emacs/site-lisp")
|
|
(require 'ocp-indent)
|
|
|
|
;; GPTel with Llamafile config
|
|
;; Llama.cpp offers an OpenAI compatible API
|
|
(gptel-make-openai "openai"
|
|
:stream t
|
|
:header (lambda () `(("Authorization" . ,(concat "Bearer " (gptel--get-api-key)))))
|
|
:key 'gptel-api-key
|
|
:models '("gpt-3.5-turbo"))
|
|
|
|
;; Llama.cpp offers an OpenAI compatible API
|
|
;; (gptel-make-openai "llama-cpp" ;Any name
|
|
;; :stream t ;Stream responses
|
|
;; :protocol "http"
|
|
;; :host "127.0.0.1:8000" ;Llama.cpp server location
|
|
;; :models '("local")) ;Any names, doesn't matter for Llama
|
|
;; And now set it as the default backend
|
|
(setq gptel-default-mode 'org-mode)
|
|
(setq-default gptel-backend (gptel-make-openai "Llamafile"
|
|
:stream t
|
|
:host "127.0.0.1:8080"
|
|
:protocol "http"
|
|
:key "no-key"
|
|
:models '("local"))
|
|
gptel-model "local")
|
|
;;; init.el ends here
|