Add functions+shortcuts to insert the filename into the buffer.

This commit is contained in:
kj
2025-08-26 15:26:00 -03:00
parent 5b6f53fe4f
commit 1f31bf736b
2 changed files with 14 additions and 0 deletions

View File

@ -125,5 +125,15 @@ If PROJECT is not specified, assume current project root."
"Check if font with FONT-NAME is available." "Check if font with FONT-NAME is available."
(find-font (font-spec :name font-name))) (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) (provide 'init-functions)
;;; init-functions.el ends here. ;;; init-functions.el ends here.

View File

@ -37,6 +37,10 @@
(define-key global-map "\M-[" 'backward-paragraph) (define-key global-map "\M-[" 'backward-paragraph)
(define-key global-map "\M-]" 'forward-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 ;; Deactivar el abrir *messages* al cliquear en el minibuffer
(define-key minibuffer-inactive-mode-map [mouse-1] #'ignore) (define-key minibuffer-inactive-mode-map [mouse-1] #'ignore)