prefix custom funcs

This commit is contained in:
Stefan Schwarz 2019-08-09 14:11:10 +02:00
parent d7f1b51e62
commit 919186ea6b

22
init.el
View file

@ -225,7 +225,7 @@
"'" '(iterm-focus :which-key "iterm") "'" '(iterm-focus :which-key "iterm")
"?" '(iterm-goto-filedir-or-home :which-key "iterm - goto dir") "?" '(iterm-goto-filedir-or-home :which-key "iterm - goto dir")
"/" 'counsel-ag "/" 'counsel-ag
"TAB" '(switch-to-last-buffer :which-key "prev buffer") "TAB" '(foo/switch-to-last-buffer :which-key "prev buffer")
;; Applications ;; Applications
"a" '(:ignore t :which-key "Applications") "a" '(:ignore t :which-key "Applications")
@ -238,15 +238,15 @@
"bd" 'evil-delete-buffer "bd" 'evil-delete-buffer
"bn" 'next-buffer "bn" 'next-buffer
"bn" 'next-buffer "bn" 'next-buffer
"bs" 'switch-to-scratch-buffer "bs" 'foo/switch-to-scratch-buffer
;; Files ;; Files
"ff" 'counsel-find-file "ff" 'counsel-find-file
"fL" 'counsel-locate "fL" 'counsel-locate
"fr" 'counsel-recentf "fr" 'counsel-recentf
"fR" 'rename-current-buffer-file "fR" 'foo/rename-current-buffer-file
"fD" 'delete-current-buffer-file "fD" 'foo/delete-current-buffer-file
"fc" 'copy-file' "fc" 'foo/copy-file'
;; Git ;; Git
"g" '(:ignore t :which-key "Magit") "g" '(:ignore t :which-key "Magit")
@ -300,7 +300,7 @@
"w <left>" 'evil-window-left "w <left>" 'evil-window-left
"wL" 'evil-window-move-far-right "wL" 'evil-window-move-far-right
"wl" 'evil-window-right "wl" 'evil-window-right
"wm" 'toggle-maximize-buffer "wm" 'foo/toggle-maximize-buffer
"wo" 'other-frame "wo" 'other-frame
"w <right>" 'evil-window-right "w <right>" 'evil-window-right
"w <S-down>" 'evil-window-move-very-bottom "w <S-down>" 'evil-window-move-very-bottom
@ -323,7 +323,7 @@
)) ))
;; custom functions ;; custom functions
(defun toggle-maximize-buffer () "Maximize buffer." (defun foo/toggle-maximize-buffer () "Maximize buffer."
(interactive) (interactive)
(save-excursion (save-excursion
(if (and (= 1 (length (window-list))) (if (and (= 1 (length (window-list)))
@ -333,7 +333,7 @@
(window-configuration-to-register ?_) (window-configuration-to-register ?_)
(delete-other-windows))))) (delete-other-windows)))))
(defun switch-to-scratch-buffer (&optional arg) (defun foo/switch-to-scratch-buffer (&optional arg)
"Switch to the `*scratch*' buffer, creating it first if needed. "Switch to the `*scratch*' buffer, creating it first if needed.
if prefix argument ARG is given, switch to it in an other, possibly new window." if prefix argument ARG is given, switch to it in an other, possibly new window."
(interactive "P") (interactive "P")
@ -342,12 +342,12 @@ if prefix argument ARG is given, switch to it in an other, possibly new window."
(switch-to-buffer-other-window (get-buffer-create "*scratch*")) (switch-to-buffer-other-window (get-buffer-create "*scratch*"))
(switch-to-buffer (get-buffer-create "*scratch*"))))) (switch-to-buffer (get-buffer-create "*scratch*")))))
(defun switch-to-last-buffer () (defun foo/switch-to-last-buffer ()
"Switch to the last buffer, allowes quick jumping between the last two." "Switch to the last buffer, allowes quick jumping between the last two."
(interactive) (interactive)
(switch-to-buffer nil)) (switch-to-buffer nil))
(defun delete-current-buffer-file () (defun foo/delete-current-buffer-file ()
"Remove file connected to current buffer and kill buffer." "Remove file connected to current buffer and kill buffer."
(interactive) (interactive)
(let ((filename (buffer-file-name)) (let ((filename (buffer-file-name))
@ -427,7 +427,7 @@ initialized with the current directory instead of filename."
;; ?\a = C-g, ?\e = Esc and C-[ ;; ?\a = C-g, ?\e = Esc and C-[
((memq key '(?\a ?\e)) (keyboard-quit)))))))) ((memq key '(?\a ?\e)) (keyboard-quit))))))))
(defun copy-file () (defun foo/copy-file ()
"Write the file under new name." "Write the file under new name."
(interactive) (interactive)
(call-interactively 'write-file)) (call-interactively 'write-file))