 ;; key bindings
 (global-set-key "\C-cc" 'comment-region)
 (global-set-key "\C-cu" 'uncomment-region)
+(global-set-key (kbd "C-c SPC") 'comment-dwim)
+(global-set-key (kbd "C-c C-SPC") 'comment-dwim)
+(global-set-key "\C-cn" 'next-error)
+(global-set-key "\C-cp" 'previous-error)
+(global-set-key "\C-ci" 'indent-region)
 
 ;; save minibuffer history
 (savehist-mode 1)

(define-key yas-minor-mode-map [(shift tab)] 'yas-next-field)
(define-key yas-minor-mode-map [(control tab)] 'yas-prev-field)
(yas-global-mode 1)

;; text completion


(package-initialize)
(unless (file-exists-p "~/.emacs.d/elpa/archives/melpa")
(package-refresh-contents))
; (package-refresh-contents)
;; define custom lisp directory and load all subdirectories too
(let ((default-directory "~/.emacs.d/site-lisp/"))
      (normal-top-level-add-to-load-path '("."))
      (normal-top-level-add-subdirs-to-load-path))
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")

; try to keep windows within a max margin
(require 'automargin)
(setq automargin-target-width 120)
(automargin-mode)
;; multiple cursors
(require 'multiple-cursors)
(global-set-key (kbd "C-c k") 'mc/edit-lines)
(global-set-key (kbd "C-c >") 'mc/mark-next-like-this)
(global-set-key (kbd "C-c <") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-k") 'mc/mark-all-like-this)
(require 'phi-search)
(require 'phi-search-mc)
(define-key phi-search-default-map (kbd "C-c >") 'phi-search-mc/mark-next)
(define-key phi-search-default-map (kbd "C-c <") 'phi-search-mc/mark-previous)
(define-key phi-search-default-map (kbd "C-c C-k") 'phi-search-mc/mark-all)

;; undo highlighting
(require 'volatile-highlights)
(volatile-highlights-mode t)

(ido-mode 1)
  (setq ido-default-buffer-method 'selected-window)
