 	ivy-wrap t
 	counsel-switch-buffer-preview-virtual-buffers nil
 	ivy-truncate-lines t)
+  (add-hook 'ivy-mode-hook
+	    (lambda ()
+	      (define-key ivy-mode-map (kbd "M-n") 'ivy-next-history-element)
+	      (define-key ivy-mode-map (kbd "M-p") 'ivy-previous-history-element)))
   :config
   (ivy-mode 1))
-
-(use-package ivy-posframe
-  ;; https://github.com/tumashu/ivy-posframe
-  ;; Let ivy use posframe to show its candidate menu
-  :after ivy
-  :init
-  (setq ivy-posframe-display-functions-alist
-	'((t . ivy-posframe-display-at-window-bottom-left)
-	  (counsel-find-file . ivy-display-function-fallback))
-	ivy-posframe-hide-minibuffer t
-	ivy-posframe--ignore-prompt nil
-	ivy-posframe-parameters '((left-fringe . 8)
-				  (right-fringe . 8)
-				  (lines-truncate . t)))
-  :config
-  (ivy-posframe-mode 1))
-
-;;;###autoload
-(defun danylo/ivy-posframe-get-size ()
-  "The function which is used to deal with ivy posframe's size."
-  (list
-   :height ivy-posframe-height
-   :width ivy-posframe-height
-   :min-height (or ivy-posframe-min-height ivy-height)
-   :min-width (or ivy-posframe-min-width (round (* (window-width) 1.0)))))
-
-(with-eval-after-load "ivy-posframe"
-  (setq ivy-posframe-size-function #'danylo/ivy-posframe-get-size))
 
 (use-package counsel-projectile
   ;; https://github.com/ericdanan/counsel-projectile

  (defun danylo/term-send-tab () (interactive) (term-send-raw-string "\t"))
  (define-key term-raw-map (kbd "S-SPC") 'danylo/term-send-tab)
  ;; Switch between char and line move
  (define-key term-raw-map (kbd "C-c t c") 'danylo/switch-to-term-char-mode)
  (define-key term-raw-map (kbd "C-c t l") 'danylo/switch-to-term-line-mode)
  ;; Copy/paste native Emacs keystrokes
  (define-key term-raw-map (kbd "C-k") 'term-send-raw)

  (scroll-bar-mode 0)
  (tooltip-mode 0)
  (blink-cursor-mode 0))

;; Mouse behaviour

;;;###autoload
(defun danylo/mouse-set-point (event &optional promote-to-region)
  "Only allow mouse clicks if the minibuffer is not active.
When minibuffer is active, mouse clicks cause weird behaviour by losing focus
of the minibuffer prompt."
  (interactive "e\np")
  (unless (active-minibuffer-window)
    (mouse-set-point event promote-to-region)))

(global-unset-key [drag-mouse-1])
(global-unset-key [down-mouse-1])
(global-set-key [mouse-1] 'danylo/mouse-set-point)

;; Frame size
(setq default-frame-alist
