1
0
Fork 0

Compare commits

...

5 commits

6 changed files with 77 additions and 17 deletions

View file

@ -36,13 +36,38 @@
(use-package orderless :straight t
:custom
(orderless-matching-styles '(orderless-literal-prefix orderless-literal orderless-regexp)))
(use-package consult :straight t
:bind (("C-c r r" . consult-ripgrep)
("C-c r g" . consult-grep)))
(use-package yasnippet :straight t
:hook ((prog-mode . yas-minor-mode)))
(use-package yasnippet-snippets :straight t)
(use-package consult :straight t
:bind (("C-c r r" . consult-ripgrep)
("C-c r g" . consult-grep)
("C-c r f" . consult-ripgrep-file)))
(defun consult-ripgrep-file (&optional initial)
"Search with `rg' in the current file with INITIAL input."
(interactive)
(cond
((buffer-file-name)
(let* ((file (buffer-file-name))
(builder (consult--ripgrep-make-builder (list file))))
(consult--read
(consult--process-collection builder
:transform (consult--grep-format builder)
:file-handler t)
:prompt "Ripgrep (current file): "
:lookup #'consult--lookup-member
:state (consult--grep-state)
:initial initial
:add-history (thing-at-point 'symbol)
:require-match t
:category 'consult-grep
:group #'consult--prefix-group
:history '(:input consult--grep-history)
:sort nil)))
(t (user-error "Buffer not visiting a file"))))
(provide 'priime-completion)
;;; priime-completion.el ends here

View file

@ -8,9 +8,8 @@
;;; Font
(defvar priime--font-config
(cond ((string= (system-name) "minji") '("JetBrains Mono Medium" "Roboto" 10 0.9))
((eq system-type 'gnu/linux) '("Roboto Mono Medium" "Roboto" 12 0.8))
((eq system-type 'darwin) '("Menlo" "Verdana" 12 1))
(cond ((eq system-type 'gnu/linux) '("JetBrains Mono Medium" "Roboto" 12 0.8))
((eq system-type 'darwin) '("JetBrains Mono Medium" "Verdana" 12 1))
(t '("Roboto Mono" "Roboto" 10 0.8))))
(defvar priime-fixed-font (-first-item priime--font-config))

View file

@ -120,6 +120,10 @@
(use-package auctex :straight t)
(use-package cdlatex :straight t)
(use-package yaml-mode :straight t)
(use-package swift-mode :straight t
:custom-face (swift-mode:keyword-face ((t (:inherit nano-strong))))
:hook ((swift-mode . electric-pair-local-mode)
(swift-mode . electric-indent-local-mode)))
;; From https://www.ovistoica.com/blog/2024-7-05-modern-emacs-typescript-web-tsx-config
(use-package treesit

View file

@ -7,7 +7,7 @@
:custom
(eglot-events-buffer-config '(:size 0 :format full))
:custom-face (eglot-inlay-hint-face ((t (:height 1.0))))
:hook ((racket-mode rust-mode irony-mode tuareg-mode python-mode tsx-ts-mode nix-mode) . eglot-ensure)
:hook ((racket-mode rust-mode irony-mode tuareg-mode python-mode tsx-ts-mode nix-mode swift-mode) . eglot-ensure)
:bind (:map eglot-mode-map
("C-c l r" . eglot-rename)
("C-c l a" . eglot-code-actions)
@ -16,7 +16,8 @@
(fset #'jsonrpc--log-event #'ignore)
:config
(add-to-list 'eglot-server-programs '(nix-mode "nil"))
(add-to-list 'eglot-server-programs '(python-mode . ("basedpyright-langserver" "--stdio"))))
(add-to-list 'eglot-server-programs '(python-mode . ("basedpyright-langserver" "--stdio")))
(add-to-list 'eglot-server-programs '(swift-mode "sourcekit-lsp")))
(use-package eglot-booster
:straight (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster")
:after (eglot)

View file

@ -11,7 +11,8 @@
"i" #'org-roam-node-insert
"t" #'org-roam-tag-add
"s" #'org-save-all-org-buffers
"w" #'org-switch-workspace)
"w" #'org-switch-workspace
"l" #'org-log)
(defun org-switch-workspace (&optional workspace-name)
"Switch the current org-roam-directory to WORKSPACE-NAME."
@ -29,6 +30,17 @@
(setq org-roam-db-location (cddr (assoc workspace-name org-workspaces-alist)))
(org-roam-db-sync nil)))
(defun org-log ()
"Add a new entry to the log."
(interactive)
(let* ((log-file-id "77f70d99-0674-43fb-8d64-f04cfa6cb495")
(log-file (org-roam-node-from-id log-file-id)))
(org-roam-node-visit log-file)
(beginning-of-buffer)
(org-next-visible-heading 1)
(org-insert-heading)
(org-timestamp '(16))))
(defun org-roam-migrate ()
"Migrate a regular org file into an org-roam file in my format."
(interactive)

View file

@ -48,18 +48,37 @@
(kill-new target-link)
target-link))
(defun git-link-priime-dev (hostname dirname filename branch commit start end)
(defun git-link--format-line-prefix (filepath)
"Format the prefix for line spec using FILEPATH."
(concat
(when (git-link--should-render-plain filepath)
"?plain=1")
"#"))
(defun git-link--format-line-range (start end)
"Format the line from START to END."
(format "L%s-L%s" start end))
(defun git-link--format-line-start (start)
"Format the line START."
(format "L%s" start))
(defun git-link--format-line-suffix (filepath start end)
"Common helper function for formatting the line suffix at the end of a URL."
(when start
(concat (git-link--format-line-prefix filepath)
(if end
(git-link--format-line-range start end)
(git-link--format-line-start start)))))
(defun git-link-priime-dev (hostname projname filepath branch commit start end)
"git-link configuration for my own forge."
(format "%s/%s/src/commit/%s/%s"
hostname
dirname
projname
(or branch commit)
(concat filename
(when start
(concat (if (git-link--should-render-plain filename) "?plain=1#" "#")
(if end
(format "L%s-L%s" start end)
(format "L%s" start)))))))
(concat filepath
(git-link--format-line-suffix filepath start end))))
(add-to-list 'git-link-remote-alist '("git.priime.dev" git-link-priime-dev))