(defun join-lines () "vi's J joins two lines by erasing end of current line"
  (interactive) (save-excursion (end-of-line) (delete-char 1)))

(defun recase-char ()
  "vi's ~ toggles one letter's case"
  (interactive) (setq case-fold-search nil)
  (if (looking-at "[A-Z]") (downcase-region (point) (1+ (point)))
    (if (looking-at "[a-z]") (upcase-region (point) (1+ (point)))))
  (forward-char 1))

(defun scroll-half-up () "vi's ^D scrolls half a page upwards"
  (interactive) (scroll-up (/ (window-height) 2)))

(defun scroll-half-down () "vi's ^U scrolls half a page down."
  (interactive) (scroll-down (/ (window-height) 2)))
  
(defun scroll-line-up () "vi's ^E scrolls one line up."
  (interactive) (scroll-up 1))

(defun scroll-line-down () "vi's ^Y scrolls one line down."
  (interactive) (scroll-down 1))

