   (when (not (package-installed-p p))
     (package-install p)))
 
-(add-hook 'c++-mode-hook 'irony-mode)
-(add-hook 'c-mode-hook 'irony-mode)
-(add-hook 'objc-mode-hook 'irony-mode)
-
-(defun my-irony-mode-hook ()
-  (define-key irony-mode-map [remap completion-at-point]
-    'irony-completion-at-point-async)
-  (define-key irony-mode-map [remap complete-symbol]
-    'irony-completion-at-point-async))
-(add-hook 'irony-mode-hook 'my-irony-mode-hook)
-(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
-
-(require 'company)
-(require 'company-irony)
-(setq company-backends (delete 'company-semantic company-backends))
-(add-to-list 'company-backends 'company-irony)
-;; (setq company-idle-delay 0.1)
-(add-hook 'prog-mode-hook (lambda () (company-mode 1)))
+(require 'projectile)
+(projectile-global-mode)
+
+;; (add-hook 'c++-mode-hook 'irony-mode)
+;; (add-hook 'c-mode-hook 'irony-mode)
+;; (add-hook 'objc-mode-hook 'irony-mode)
+
+;; (defun my-irony-mode-hook ()
+;;   (define-key irony-mode-map [remap completion-at-point]
+;;     'irony-completion-at-point-async)
+;;   (define-key irony-mode-map [remap complete-symbol]
+;;     'irony-completion-at-point-async))
+;; (add-hook 'irony-mode-hook 'my-irony-mode-hook)
+;; (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
+
+;; (require 'company)
+;; (require 'company-irony)
+;; (setq company-backends (delete 'company-semantic company-backends)
+;;       company-global-modes '(not term-mode)
+;;       company-transformers '(company-sort-by-occurrence)
+;;       company-minimum-prefix-length 2
+;;       company-selection-wrap-around t
+;;       company-show-numbers t
+;;       company-require-match nil
+;;       company-dabbrev-downcase nil)
+;; (add-to-list 'company-backends 'company-irony)
+;; ;; (setq company-idle-delay 0.1)
+;; (add-hook 'prog-mode-hook (lambda () (company-mode 1)))
 
 (require 'browse-kill-ring)
 

;; (setq compilation-skip-threshold 2)

(defalias 'after 'with-eval-after-load)
(delete-selection-mode +1)
(show-paren-mode 1)
(transient-mark-mode t)
(menu-bar-mode -1)
(which-function-mode)
(column-number-mode)
(iswitchb-mode t)   ;; substring buffer switch
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq-default abbrev-mode t)
(winner-mode t)   ;; C-c <left|right>
(set-language-environment "czech")

(define-key (current-global-map) [remap yank-pop] 'browse-kill-ring)   ;; remap yank-pop
(after 'browse-kill-ring (setq browse-kill-ring-replace-yank t))

(define-key global-map (kbd "RET") 'newline-and-indent)
;; (define-key c-mode-map (kbd "TAB") 'company-indent-or-complete-common)
;; (define-key c++-mode-map (kbd "TAB") 'company-indent-or-complete-common)
(global-set-key (kbd "M-r") 'recompile)
(global-set-key (kbd "C-=") 'er/expand-region)
;; (global-set-key (kbd "M-/") 'hippie-expand)
(global-set-key (kbd "C-c t") 'visit-term-buffer)
(global-set-key (kbd "C-c C-f") 'projectile-find-file)

(global-set-key (kbd "C-;") 'avy-goto-word-or-subword-1)
(global-set-key (kbd "M-g l") 'avy-goto-line)
(after 'isearch (define-key isearch-mode-map (kbd "C-;") 'avy-isearch))

(global-set-key (kbd "C-a") 'mwim-beginning-of-code-or-line)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
