 
 (ad-activate 'mouse-drag-region)
 
+(defun my-sublime-expand-selection-to-indentation ()
+  (interactive)
+  "Expand selection to the next indentation level.
+Inspired by Sublime Text."
+  (let ((n (current-indentation))
+        (beg (point-at-bol))
+        (end (point-at-eol)))
+    ;; when region is active & transient mark mode is
+    ;; turned on, we expand to make that region bigger
+    (when (and (region-active-p) transient-mark-mode)
+      (setq beg (region-beginning)
+            end (region-end))
+      (save-excursion
+        ;; get the min indentation within the region
+        (goto-char beg)
+        (forward-line 1)
+        (while (< (point) end)
+          (setq n (min n (current-indentation)))
+          (forward-line 1))
+        ;; get the min indentation of line before
+        ;; region start, line after region start or n
+        (setq n
+              (max (progn
+                     (goto-char beg)
+                     (forward-line -1)
+                     (if (bobp) 0 (current-indentation)))
+                   (progn
+                     (goto-char end)
+                     (forward-line 1)
+                     (if (eobp) 0 (current-indentation)))))))
+    ;; now expand the region
+    (save-excursion
+      (goto-char beg)
+      (forward-line -1)
+      (while (and (>= (current-indentation) n) (not (bobp)))
+        (forward-line -1))
+      (forward-line 1)
+      (setq beg (point-at-bol))
+      (goto-char end)
+      (forward-line 1)
+      (while (and (>= (current-indentation) n) (not (eobp)))
+        (forward-line 1))
+      (forward-line -1)
+      (setq end (point-at-eol)))
+    (goto-char beg)
+    (set-mark beg)
+    (goto-char end)))
+
 (message "")


(global-set-key (kbd "C-x k") 'my-kill-current-buffer)

;; Selection


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'hippie-exp)

(defun my-hippie-tab (arg)
  (interactive "*P")

              'my-shell-forward-char-or-previous-history)
            (define-key shell-mode-map (kbd "<down>")
              'my-shell-next-line-or-next-history)))

(add-hook 'view-mode-hook
          (lambda ()
            (define-key view-mode-map (kbd "<up>")
              'scroll-up)
            (define-key view-mode-map (kbd "<up>")
              'scroll-up)))

(global-font-lock-mode -1)

