diff --git a/common/_global.el b/common/_global.el index 68bb7c7..0d62c26 100644 --- a/common/_global.el +++ b/common/_global.el @@ -114,6 +114,34 @@ ("j" . origami-forward-fold) ("x" . origami-reset))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; modern home/end via C-a and C-e +(defun my--smart-beginning-of-line () + "Move point to `beginning-of-line'. If repeat command it cycle +position between `back-to-indentation' and `beginning-of-line'." + (interactive "^") + (if (eq last-command 'my--smart-beginning-of-line) + (if (= (line-beginning-position) (point)) + (back-to-indentation) + (beginning-of-line)) + (back-to-indentation))) + +(defun my--smart-end-of-line () + "Move point to `end-of-line'. If repeat command it cycle +position between last non-whitespace and `end-of-line'." + (interactive "^") + (if (and (eq last-command 'my--smart-end-of-line) + (= (line-end-position) (point))) + (skip-syntax-backward " " (line-beginning-position)) + (end-of-line))) + +(defun kill-other-buffers () + "Kill all buffers but the current one. Don't mess with special buffers." + (interactive) + (dolist (buffer (buffer-list)) + (unless (or (eql buffer (current-buffer)) (not (buffer-file-name buffer))) + (kill-buffer buffer)))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Setup global keys (require 'transpose-frame) @@ -128,6 +156,8 @@ (global-set-key (kbd "C-c u") 'toggle-truncate-lines) (global-set-key (kbd "C-o") 'helm-find-files) (global-set-key (kbd "C-k") 'dired) +(global-set-key (kbd "C-a") 'my--smart-beginning-of-line) +(global-set-key (kbd "C-e") 'my--smart-end-of-line) (global-set-key (kbd "C-c w") (lambda () (interactive) @@ -272,7 +302,6 @@ (helm-mode 1) (helm-autoresize-mode 1) -(set-face-attribute 'helm-source-header nil :height 0.6) (setq helm-display-header-line nil helm-autoresize-max-height 30 helm-autoresize-min-height 30)