From 1f31bf736b8c32153256af7885de3ac8c9af9ff0 Mon Sep 17 00:00:00 2001 From: kj Date: Tue, 26 Aug 2025 15:26:00 -0300 Subject: [PATCH] Add functions+shortcuts to insert the filename into the buffer. --- configs/init-functions.el | 10 ++++++++++ configs/init-keys.el | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/configs/init-functions.el b/configs/init-functions.el index 75751bb..2249a77 100644 --- a/configs/init-functions.el +++ b/configs/init-functions.el @@ -125,5 +125,15 @@ If PROJECT is not specified, assume current project root." "Check if font with FONT-NAME is available." (find-font (font-spec :name font-name))) +(defun insert-full-filename () + "Insert the full path file name into the current buffer." + (interactive) + (insert (buffer-file-name))) + +(defun insert-filename-only () + "Insert the filename (without path) into the current buffer." + (interactive) + (insert (file-name-nondirectory (buffer-file-name)))) + (provide 'init-functions) ;;; init-functions.el ends here. diff --git a/configs/init-keys.el b/configs/init-keys.el index e49e483..3c12c76 100644 --- a/configs/init-keys.el +++ b/configs/init-keys.el @@ -37,6 +37,10 @@ (define-key global-map "\M-[" 'backward-paragraph) (define-key global-map "\M-]" 'forward-paragraph) +;; Insertar nombre del archivo +(global-set-key (kbd "C-c ff") 'insert-full-filename) +(global-set-key (kbd "C-c fo") 'insert-filename-only) + ;; Deactivar el abrir *messages* al cliquear en el minibuffer (define-key minibuffer-inactive-mode-map [mouse-1] #'ignore)