.emacs.d/functions.el

47 lines
1.2 KiB
EmacsLisp

(defun copy-whole-line ()
(interactive)
(save-excursion
(kill-new
(buffer-substring
(point-at-bol)
(point-at-eol)))))
(global-set-key (kbd "C-c w l") 'copy-whole-line)
(defun kill-all-buffers ()
(interactive)
(mapc 'kill-buffer (buffer-list)))
(global-set-key (kbd "C-c k k") 'kill-all-buffers)
(defun split-and-follow-horizontally ()
(interactive)
(split-window-below)
(balance-windows)
(other-window 1))
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally)
(defun split-and-follow-vertically ()
(interactive)
(split-window-right)
(balance-windows)
(other-window 1))
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically)
(defun switch-to-previous-buffer ()
(interactive)
(switch-to-buffer (other-buffer (current-buffer) 1)))
(global-set-key (kbd "C-x b") 'switch-to-previous-buffer)
(global-set-key (kbd "C-c b") 'switch-to-buffer)
;; compilation
(setq compile-command "make ")
(global-set-key (kbd "C-x C-m") 'compile)
(defun mark-line ()
(interactive)
(move-beginning-of-line nil)
(set-mark (point))
(move-end-of-line nil))
(global-set-key (kbd "C-x C-x") 'mark-line)
(global-unset-key (kbd "C-z")) ; disable suspend frame