 
 (modi/font-size-reset) ; Initialize font-size-pt var to the default value
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; LINE TRUNCATION / VISUAL LINE MODE
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;; Do `M-x toggle-truncate-lines` to jump in and out of truncation mode.
-
-(setq
- ;; NOTE: Line truncation has to be enabled for the visual-line-mode to be effective
- ;; But here you see that truncation is disabled by default. It is enabled
- ;; ONLY in specific modes in which the fci-mode is enabled (setup-fci.el)
- truncate-lines nil ;; enable line wrapping. This setting does NOT apply to windows split using `C-x 3`
- truncate-partial-width-windows nil ;; enable line wrapping in windows split using `C-x 3`
- visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow) ;; Turn on line wrapping fringe indicators in Visual Line Mode
- )
-
-;; (global-visual-line-mode 1) ;; Enable wrapping lines at word boundaries
-(global-visual-line-mode -1) ;; Disable wrapping lines at word boundaries
+;; Do `M-x toggle-truncate-lines` to toggle truncation mode.
+
+;; Line truncation has to be enabled for the visual-line-mode to be effective.
+
+;; Disable truncation. This setting does NOT apply to windows split using `C-x 3`
+(setq truncate-lines nil)
+;; Disable truncation in windows split using `C-x 3` too.
+(setq truncate-partial-width-windows nil)
+;; Turn on line wrapping fringe indicators in Visual Line Mode
+(setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
+
+;; (global-visual-line-mode 1) ; Enable wrapping lines at word boundaries
+(global-visual-line-mode -1) ; Disable wrapping lines at word boundaries
 
 ;; Enable/Disable visual-line mode in specific major modes. Enabling visual
 ;; line mode does word wrapping only at word boundaries
-(add-hook 'sh-mode-hook       'turn-off-visual-line-mode) ;; e.g. sim.setup file
-(add-hook 'org-mode-hook      'turn-on-visual-line-mode)
-(add-hook 'markdown-mode-hook 'turn-on-visual-line-mode)
-
 (defun turn-off-visual-line-mode ()
   (interactive)
   (visual-line-mode -1))
-
 (defun turn-on-visual-line-mode ()
   (interactive)
   (visual-line-mode 1))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(add-hook 'sh-mode-hook       #'turn-off-visual-line-mode)
+(add-hook 'org-mode-hook      #'turn-on-visual-line-mode)
+(add-hook 'markdown-mode-hook #'turn-on-visual-line-mode)
+
 ;; CURSOR
-;; Change cursor color according to mode: read-only buffer / overwrite /
-;; regular (insert) mode
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(blink-cursor-mode -1) ;; Don't blink the cursor, it's distracting!
+;; Change cursor color according to mode:
+;;   read-only buffer / overwrite / regular (insert) mode
+(blink-cursor-mode -1) ; Don't blink the cursor, it's distracting!
 
 (defvar hcz-set-cursor-color-color "")
 (defvar hcz-set-cursor-color-buffer "")

(key-chord-define-global "2w" 'menu-bar-mode) ; alternative to F2
(key-chord-define-global "8i" 'prez-mode) ; alternative to S-F8

(bind-to-modi-map "L" modi/show-long-lines)


(provide 'setup-visual)

      (modify-syntax-entry ?\" ".")))
  "Generic mode for Vim configuration files.")

(setq auto-mode-alist (append '(("\\.vimrc.*\\'" . vimrc-generic-mode)
                                ("\\.vim\\'"     . vimrc-generic-mode))
                              auto-mode-alist))

;; Coloring regions that have ANSI color codes in them
;; http://unix.stackexchange.com/a/19505/57923
(defun ansi-color-apply-on-region-int (beg end)
  "Colorize using the ANSI color codes."
  (interactive "r")
  (ansi-color-apply-on-region beg end))

;; Show long lines
;; http://stackoverflow.com/a/6346547/1219634
(use-package whitespace
  :commands (modi/show-long-lines)
  :init
  (progn
    (bind-to-modi-map "L" modi/show-long-lines))
  :config
  (progn
    (defun modi/show-long-lines()
      (interactive)
      (let ((hi-lock-mode -1)) ; reset hi-lock mode
        (highlight-lines-matching-regexp
         (concat ".\\{"
                 (number-to-string (+ 1 whitespace-line-column))
                 "\\}") "hi-yellow")))))

;; http://endlessparentheses.com/emacs-narrow-or-widen-dwim.html
(defun endless/narrow-or-widen-dwim (p)
  "If the buffer is narrowed, it widens. Otherwise, it narrows intelligently.
Intelligently means: region, org-src-block, org-subtree, or defun,
