feat: mvtn config

This commit is contained in:
Philip Gaber 2025-06-29 19:54:44 +02:00
parent 51788861d2
commit 30080f84aa
No known key found for this signature in database
GPG Key ID: 8D49EBCA3F8B797C
4 changed files with 144 additions and 0 deletions

17
cnf/app/a-magit.el Normal file
View File

@ -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)

60
cnf/app/a-mvtn.el Normal file
View File

@ -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)

16
cnf/lang/l-python.el Normal file
View File

@ -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)

51
cnf/programming.el Normal file
View File

@ -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
"<tab>" 'company-complete-selection
"<return>" nil
"RET" nil))
(general-def
:states '(normal insert)
:keymaps 'company-mode-map
"C-<return>" 'company-search-candidates
"C-." 'company-search-candidates)
(add-hook 'company-mode-hook 'my/keymap-company)
(provide 'programming)