 (global-set-key "\C-e" 'smart-end-of-line)
 
 
+;; semi-port of surround.vim
+(require 'surround)
+(global-set-key "\C-cd" 'surround-delete)
+(global-set-key "\C-cD" 'surround-delete-within)
+(global-set-key "\C-c\M-d" 'surround-change)
+
+;; move lines like in org-mode
+(defun move-line (n)
+  "Move the current line up or down by N lines."
+  (interactive "p")
+  (setq col (current-column))
+  (beginning-of-line) (setq start (point))
+  (end-of-line) (forward-char) (setq end (point))
+  (let ((line-text (delete-and-extract-region start end)))
+    (forward-line n)
+    (insert line-text)
+    ;; restore point to original column in moved line
+    (forward-line -1)
+    (forward-char col)))
+
+(defun move-line-up (n)
+  "Move the current line up by N lines."
+  (interactive "p")
+  (move-line (if (null n) -1 (- n))))
+
+(defun move-line-down (n)
+  "Move the current line down by N lines."
+  (interactive "p")
+  (move-line (if (null n) 1 n)))
+
+(global-set-key (kbd "M-<up>") 'move-line-up)
+(global-set-key (kbd "M-<down>") 'move-line-down)
+

(global-set-key "\C-cp" 'previous-error)
(global-set-key "\C-ci" 'indent-region)

;; save minibuffer history
(savehist-mode 1)
(setq savehist-file "~/.emacs.d/cache/history")

(diminish 'highlight-parentheses-mode)
(diminish 'fic-mode)
(diminish 'auto-complete-mode "AC")
(diminish 'undo-tree-mode)
(diminish 'visual-line-mode)
(diminish 'volatile-highlights-mode)
(diminish 'whole-line-or-region-mode)
(diminish 'yas-minor-mode)

;; don't start in lisp
(setq initial-major-mode 'org-mode)
