From 30080f84aa5cf5281267342c5c78ade17355c517 Mon Sep 17 00:00:00 2001 From: Philip Gaber Date: Sun, 29 Jun 2025 19:54:44 +0200 Subject: [PATCH] feat: mvtn config --- cnf/app/a-magit.el | 17 +++++++++++++ cnf/app/a-mvtn.el | 60 ++++++++++++++++++++++++++++++++++++++++++++ cnf/lang/l-python.el | 16 ++++++++++++ cnf/programming.el | 51 +++++++++++++++++++++++++++++++++++++ 4 files changed, 144 insertions(+) create mode 100644 cnf/app/a-magit.el create mode 100644 cnf/app/a-mvtn.el create mode 100644 cnf/lang/l-python.el create mode 100644 cnf/programming.el diff --git a/cnf/app/a-magit.el b/cnf/app/a-magit.el new file mode 100644 index 0000000..11804b3 --- /dev/null +++ b/cnf/app/a-magit.el @@ -0,0 +1,17 @@ +;; MAGIT: A nice git frontend +(straight-use-package 'magit) +(setq magit-bury-buffer-function #'quit-window + magit-display-buffer-function #'display-buffer) + +(with-eval-after-load 'magit + (transient-append-suffix 'magit-push "-u" + '(1 "=s" "Skip gitlab pipeline" "--push-option=ci.skip")) + (transient-append-suffix 'magit-push "=s" + '(1 "=D" "DEBUG" "--push-option=ci.variable=DEBUG=1")) ;; no special meaning for gitlab + (transient-append-suffix 'magit-push "=D" + '(1 "=V" "Set CI variable" "--push-option=ci.variable=")) ;; Will prompt, can only set one extra variable + (transient-append-suffix 'magit-push "=V" + '(1 "=O" "Set push option" "--push-option=")) + ) + +(provide 'a-magit) diff --git a/cnf/app/a-mvtn.el b/cnf/app/a-mvtn.el new file mode 100644 index 0000000..a9d99a5 --- /dev/null +++ b/cnf/app/a-mvtn.el @@ -0,0 +1,60 @@ +(straight-use-package '(mvtn :host github :repo "dominiksta/mvtn.el")) +(straight-use-package 'olivetti-mode) + +(with-eval-after-load "mvtn" + (setq mvtn-note-directories + '((:dir "~/sync/mvtn/private" :name "prv" :structure + ((:dir "flt" :datetree t) ;; Floating + ;; BUG: Cannot be excluded by the mvtn-excluded-directories + ;; (:dir "log" :datetree t) + (:dir "sci" :datetree t) ;; Scientific + (:dir "stc" :datetree nil)))) + ;; mvtn-note-directory "~/tmp/mvtn-test" + ;; mvtn-note-directory "~/.dotfiles/emacs/straight/repos/mvtn.el/test/test-notes" + mvtn-default-file-extension "org" + mvtn-search-function 'mvtn-search-full-text-rg + mvtn-list-files-function 'mvtn-list-files-function-find + mvtn-search-years 100 + ;; mvtn-list-files-function 'mvtn-list-files-function-native + mvtn-excluded-directories '(".git" ".svn" "ltximg" "ORGPICS" "auto") + mvtn-cv-enable t + mvtn-journal-new-daily-title "Log for %Y-%m-%d" + mvtn-journal-dir "prv/log") + + ;; (mvtn-journal-autojournal-set-feature 'git-commit t) + ;; (mvtn-journal-autojournal-set-feature 'note-changed t) + + (setq-default olivetti-body-width 120) + + ;; REQUIRES OLIVETTI MODE + (add-hook 'mvtn-minor-mode-hook 'olivetti-mode) + (require 'mvtn-link-buttons)) + +;; Workaround because RET cannot be overwritten with general-def (Button push) +(with-eval-after-load 'mvtn-tag-addons + (defun mvtn--tag-file-list-action (button) + (mvtn-tag-file-list-open-keep-focus))) + +(phgas-leader + :states '(normal visual emacs) + :keymaps 'override + "n d" 'mvtn-jump-current-year-directory + "n n" 'mvtn-open-note + "n N" 'mvtn-new-note + "n r" 'mvtn-rename-current-file + "n /" 'mvtn-search-full-text + "n l" 'mvtn-insert-link + "n o" 'mvtn-follow-link-at-point + "n b" 'mvtn-search-backlinks + "n t" 'mvtn-tag-file-list + ) + +(general-def + :states 'normal + :keymaps 'mvtn-tag-file-list-mode-map + "g r" 'revert-buffer + "q" 'quit-window + ) + + +(provide 'a-mvtn) diff --git a/cnf/lang/l-python.el b/cnf/lang/l-python.el new file mode 100644 index 0000000..8671deb --- /dev/null +++ b/cnf/lang/l-python.el @@ -0,0 +1,16 @@ +;; PYTHON +;; (add-hook 'python-mode-hook #'eglot-ensure) +(add-hook 'python-mode-hook #'lsp-deferred) + +(setq python-indent-guess-indent-offset-verbose nil + python-shell-completion-native-enable nil) + +(add-hook 'inferior-python-mode-hook + (lambda () + (setq comint-move-point-for-output t))) + +;; PYTHON-INTERACTIVE-SHELL +(setq python-shell-completion-native-disabled-interpreters + '("pypy" "ipython" "python")) ;; added python bc of warning (readline support) + +(provide 'l-python) diff --git a/cnf/programming.el b/cnf/programming.el new file mode 100644 index 0000000..9cf3401 --- /dev/null +++ b/cnf/programming.el @@ -0,0 +1,51 @@ +(push (concat user-emacs-directory "cnf/lang") load-path) +(push '("\\.py\\'" . (lambda () (require 'l-python) (python-mode))) auto-mode-alist) +;; LSP: language server in emacs +;; Currently I switched over to eglot +;; Pro/Contra eglot vs. lsp-mode +;; Pros: +;; - Eglot is part of Emacs core since 29 +;; - Eglot seems to be a bit faster/leaner (There's `emacs-lsp-booster` for lsp-mode) +;; Cons: +;; - Eglot does not support multiple LSP servers **per buffer** (e.g. jedi + ruffe, html + js + tailwind) +;; (There is a multiplexer for Eglot `lspx`) +;; - Eglot does no support smth. like DAP mode + +;; Keybindings +;; (general-def :states '(normal visual) :keymaps 'eglot-mode-map +;; "SPC =" 'eglot-format +;; "=" 'eglot-format) + +;; LSP-MODE +(straight-use-package 'lsp-mode) + +;; COMPANY: autocompletion +(straight-use-package 'company) +(setq company-idle-delay 0.0 + company-tooltip-limit 5 + company-minimum-prefix-length 1 + company-echo-delay 0 + company-auto-complete nil) +(add-hook 'prog-mode-hook 'company-mode) + +(straight-use-package 'lsp-mode) + +;; Keybindings +(defun my/keymap-company () + (interactive) + (general-def + :keymaps 'company-active-map + "" 'company-complete-selection + "" nil + "RET" nil)) + +(general-def + :states '(normal insert) + :keymaps 'company-mode-map + "C-" 'company-search-candidates + "C-." 'company-search-candidates) + +(add-hook 'company-mode-hook 'my/keymap-company) + + +(provide 'programming)