From 2956f55edf3bc27a29722661529bd7106152e338 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 17 Apr 2024 10:10:10 -0500 Subject: [PATCH] fixing some ellama things and adding gitlab --- README.org | 38 ++++++++++++++++++++++++++++++++++++-- init.el | 31 +++++++++++++++++++++++++++++-- templates | 3 ++- 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/README.org b/README.org index 4fb86355..ad095671 100644 --- a/README.org +++ b/README.org @@ -28,6 +28,7 @@ - [[#tempel][Tempel]] - [[#projectile][Projectile]] - [[#project][Project]] + - [[#gitlab][Gitlab]] - [[#httpd][HTTPD]] - [[#navigation][Navigation]] - [[#window-management][Window Management]] @@ -2149,6 +2150,11 @@ Idk, let's try this i guess :port 443 :chat-model "dolphin-uncensored" :embedding-model "dolphin-uncensored")))) + :config + (defun chris/ellama-new-session (prompt) + (interactive "sAsk ellama: ") + (ellama-provider-select) + (ellama-new-session ellama-provider prompt)) :general (chris/leader-keys :states '(normal visual) @@ -2924,10 +2930,13 @@ Tempel is another templating system. Also perhaps even more powerful with it's e (cons #'tempel-complete completion-at-point-functions))) + (add-hook 'conf-mode-hook 'tempel-setup-capf) (add-hook 'prog-mode-hook 'tempel-setup-capf) (add-hook 'text-mode-hook 'tempel-setup-capf) (add-hook 'org-mode-hook 'tempel-setup-capf) + (setq tempel-path "/home/chris/.emacs.d/templates") + ;; Optionally make the Tempel templates available to Abbrev, ;; either locally or globally. `expand-abbrev' is bound to C-x '. ;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode) @@ -2937,10 +2946,12 @@ Tempel is another templating system. Also perhaps even more powerful with it's e "ic" 'tempel-insert) (general-def 'insert tempel-map "C-l" 'tempel-next - "C-h" 'tempel-previous) -) + "C-h" 'tempel-previous)) + +(use-package tempel-collection) #+END_SRC + ** Projectile I'm going to use projectile to keep my projects inline. #+begin_src emacs-lisp @@ -2957,6 +2968,7 @@ I'm going to use projectile to keep my projects inline. "fp" 'project-find-file "fP" 'project-switch-project)) #+end_src + ** Project Here are project specific commands #+begin_src emacs-lisp @@ -2984,6 +2996,19 @@ Here are project specific commands "p" 'evil-paste-after) #+end_src +** Gitlab +Because most of my projects are hosted on gitlab right now, I think having a client access to it from emacs seems like a really good idea. +#+begin_src emacs-lisp +(use-package lab + :config + (defun chris/gitlab-token () + (interactive) + (string-clean-whitespace (shell-command-to-string "rbw get 'gitlab token'"))) + + (setq lab-host "https://gitlab.com" + lab-token (chris/gitlab-token))) +#+end_src + ** HTTPD In order to view created websites, I'll use =simple-httpd= to get a web server running in emacs for preview. #+BEGIN_SRC emacs-lisp @@ -4398,6 +4423,15 @@ Let's add our own eshell prompt. and set the password cache to a significantly h (add-hook 'eshell-mode-hook (lambda () (display-line-numbers-mode -1))) + (defun chris/upgrade-nix () + "A function for updating my nix config" + (interactive) + (let* ((default-directory (file-truename (concat home-directory ".dotfiles/")))) + (async-shell-command + "sudo nixos-rebuild switch --show-trace --verbose --impure --flake .#" + "*upgrade*" + "*upgrade-errors*"))) + (setq eshell-command-aliases-list `(("q" "exit") ("f" "find-file $1") diff --git a/init.el b/init.el index c8efaffe..7353f809 100644 --- a/init.el +++ b/init.el @@ -1643,6 +1643,11 @@ Optional BACKEND must be `re-reveal' or a backend derived from it." :port 443 :chat-model "dolphin-uncensored" :embedding-model "dolphin-uncensored")))) + :config + (defun chris/ellama-new-session (prompt) + (interactive "sAsk ellama: ") + (ellama-provider-select) + (ellama-new-session ellama-provider prompt)) :general (chris/leader-keys :states '(normal visual) @@ -2134,10 +2139,13 @@ targets." (cons #'tempel-complete completion-at-point-functions))) + (add-hook 'conf-mode-hook 'tempel-setup-capf) (add-hook 'prog-mode-hook 'tempel-setup-capf) (add-hook 'text-mode-hook 'tempel-setup-capf) (add-hook 'org-mode-hook 'tempel-setup-capf) + (setq tempel-path "/home/chris/.emacs.d/templates") + ;; Optionally make the Tempel templates available to Abbrev, ;; either locally or globally. `expand-abbrev' is bound to C-x '. ;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode) @@ -2147,8 +2155,9 @@ targets." "ic" 'tempel-insert) (general-def 'insert tempel-map "C-l" 'tempel-next - "C-h" 'tempel-previous) -) + "C-h" 'tempel-previous)) + +(use-package tempel-collection) (use-package projectile :ensure t @@ -2186,6 +2195,15 @@ targets." (general-def 'normal "p" 'evil-paste-after) +(use-package lab + :config + (defun chris/gitlab-token () + (interactive) + (string-clean-whitespace (shell-command-to-string "rbw get 'gitlab token'"))) + + (setq lab-host "https://gitlab.com" + lab-token (chris/gitlab-token))) + (use-package simple-httpd :ensure t) @@ -3198,6 +3216,15 @@ targets." (add-hook 'eshell-mode-hook (lambda () (display-line-numbers-mode -1))) + (defun chris/upgrade-nix () + "A function for updating my nix config" + (interactive) + (let* ((default-directory (file-truename (concat home-directory ".dotfiles/")))) + (async-shell-command + "sudo nixos-rebuild switch --show-trace --verbose --impure --flake .#" + "*upgrade*" + "*upgrade-errors*"))) + (setq eshell-command-aliases-list `(("q" "exit") ("f" "find-file $1") diff --git a/templates b/templates index 51b4201a..c25079f2 100644 --- a/templates +++ b/templates @@ -71,11 +71,12 @@ c-mode :condition (re-search-backward "^\\w*$" (line-beginning-position) 'noerro (incc "#include \"" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) "\"") org-mode - (title "#+title: " p n "#+author: Chris Cochrun" n n) (drawer ":" p ":" n r ":end:") (begin "#+begin_" (s name) n> r> n "#+end_" name) (quote "#+begin_quote" n> r> n> "#+end_quote") +(sidenote "#+begin_sidenote" n> r> n "#+end_sidenote") +(marginnote "#+begin_marginnote" n> r> n "#+end_marginnote") (example "#+begin_example" n> r> n> "#+end_example") (center "#+begin_center" n> r> n> "#+end_center") (comment "#+begin_comment" n> r> n> "#+end_comment")