Archived
1
0
Fork 0

improve home/end nav via C-a and C-e ; tweak helm text config

This commit is contained in:
KemoNine 2022-08-28 12:01:42 -04:00
parent efb0478bfb
commit ebcbf9a248

View file

@ -114,6 +114,34 @@
("j" . origami-forward-fold) ("j" . origami-forward-fold)
("x" . origami-reset))) ("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 ; Setup global keys
(require 'transpose-frame) (require 'transpose-frame)
@ -128,6 +156,8 @@
(global-set-key (kbd "C-c u") 'toggle-truncate-lines) (global-set-key (kbd "C-c u") 'toggle-truncate-lines)
(global-set-key (kbd "C-o") 'helm-find-files) (global-set-key (kbd "C-o") 'helm-find-files)
(global-set-key (kbd "C-k") 'dired) (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") (global-set-key (kbd "C-c w")
(lambda () (lambda ()
(interactive) (interactive)
@ -272,7 +302,6 @@
(helm-mode 1) (helm-mode 1)
(helm-autoresize-mode 1) (helm-autoresize-mode 1)
(set-face-attribute 'helm-source-header nil :height 0.6)
(setq helm-display-header-line nil (setq helm-display-header-line nil
helm-autoresize-max-height 30 helm-autoresize-max-height 30
helm-autoresize-min-height 30) helm-autoresize-min-height 30)