Skip to content

Latest commit

 

History

History
417 lines (334 loc) · 10 KB

config.org

File metadata and controls

417 lines (334 loc) · 10 KB

Interface tweaks

 (setq inhibit-startup-message t)
 (setq powerline-arrow-shape 'curve)
 (setq make-backup-files nil)
 ;; show file path in title bar
 (setq
  frame-title-format
  '((:eval (if (buffer-file-name)
		(abbreviate-file-name (buffer-file-name))
	      "%b"))))

 ;;(setq-default frame-title-format "%b (%f)")


 (tool-bar-mode -1)
 (scroll-bar-mode -1)
 (fset 'yes-or-no-p 'y-or-n-p)

 (global-display-line-numbers-mode)
 ;;(global-linum-mode t)

 (defalias 'list-buffers 'ibuffer)
 (windmove-default-keybindings)


 (defmacro move-back-horizontal-after (&rest code)
   `(let ((horizontal-position (current-column)))
      (progn
	 ,@code
	 (move-to-column horizontal-position))))

 (defun comment-or-uncomment-line-or-region ()
   (interactive)
   (if (region-active-p)
	(comment-or-uncomment-region (region-beginning) (region-end))
     (move-back-horizontal-after
      (comment-or-uncomment-region (line-beginning-position) (line-end-position))
      (forward-line 1))))



 (global-set-key (kbd "M-;") 'comment-or-uncomment-line-or-region)
 (global-set-key (kbd "<f5>") 'revert-buffer)
 (global-hl-line-mode t) ;;highlight current line
 (global-auto-revert-mode 1) ;; revert-buffer on save.
 (global-set-key (kbd "M-s-<right>") 'switch-to-next-buffer)
 (global-set-key (kbd "M-s-<left>") 'switch-to-prev-buffer)
 (global-set-key (kbd "s-Z") 'undo-tree-redo)

 (electric-pair-mode 1)
 ;;parens
 (require 'paren)
 (show-paren-mode 1)
 (setq show-paren-delay 1)
 (set-face-background 'show-paren-match (face-background 'default))
 (if (eq (frame-parameter nil 'background-mode) 'dark)
     (set-face-foreground 'show-paren-match "red")
   (set-face-foreground 'show-paren-match "black"))
 (set-face-attribute 'show-paren-match nil :weight 'extra-bold)

Grep

ripgrep

(use-package ripgrep ;; brew install ripgrep
:ensure t)

projectile-ripgrep

(use-package projectile-ripgrep
:bind (("C-c g" . projectile-ripgrep)))

Ag

silver searcher

(use-package ag ;;brew install the_silver_searcher
  :ensure t
  :commands (ag ag-files ag-regexp ag-project ag-dired helm-ag) 
  :config (setq ag-highlight-search t
		    ag-reuse-buffers t))

Dumb jump

jump to definition

(use-package dumb-jump
  :bind (("M-g o" . dumb-jump-go-other-window)
	     ("M-g f" . dumb-jump-go)
	     ("M-g b" . dumb-jump-back)
	     ("M-g i" . dumb-jump-go-prompt)
	     ("M-g x" . dumb-jump-go-prefer-external)
	     ("M-g z" . dumb-jump-go-prefer-external-other-window))
  :config (setq dumb-jump-selector 'ivy) ;; (setq dumb-jump-selector 'helm)
  :ensure)

Projectile

 (use-package projectile
	  :ensure t
	  :defer 1
	  :bind ("C-c p" . projectile-command-map)
	  :config
	  (projectile-global-mode)
	  (setq projectile-completion-system 'ivy)
	  (setq-default projectile-enable-caching t
                     projectile-mode-line '(:eval (projectile-project-name))))

	  (global-set-key (kbd "s-t") 'projectile-find-file)
	  (global-set-key (kbd "s-g") 'projectile-grep)
	  (global-set-key (kbd "s-p") 'projectile-switch-project)

 ;(use-package counsel-projectile
 ;  :config
 ;  (setq counsel-projectile-on t))

try

Try out emacs packages without installing them.

(use-package try
  :ensure t
  :defer 4)

which key

Keybindings help

(use-package which-key
:ensure t
:config (which-key-mode))

Org Mode

(use-package org-bullets
  :ensure t
  :config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))

Ido

(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)

Counsel

(use-package counsel
  :ensure t
  :bind (("M-y" . counsel-yank-pop)
  :map ivy-minibuffer-map
  ("M-y" . ivy-next-line)))

Swiper

Isearch

(use-package swiper
 :ensure t
 :config (ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
;; enable this if you want `swiper' to use it
;; (setq search-default-mode #'char-fold-to-regexp)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history))

Autocomplete

(use-package company
  :ensure t
  :bind (("C-c C-/" . company-complete))
  :config (global-company-mode)
  (setq company-idle-delay 0.2)
  (setq company-require-match nil)
  (setq company-selection-wrap-around t)
  (setq company-tooltip-align-annotations t)
  (setq company-tooltip-flip-when-above t)
  (setq company-transformers '(company-sort-by-occurrence))
  (define-key company-active-map (kbd "C-n") 'company-select-next)
  (define-key company-active-map (kbd "C-p") 'company-select-previous)
  (define-key company-search-map (kbd "C-n") 'company-select-next)
  (define-key company-search-map (kbd "C-p") 'company-select-previous)
  (define-key company-search-map (kbd "C-t") 'company-search-toggle-filtering))

(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

(add-hook 'python-mode-hook 'my/python-mode-hook)
(use-package company-jedi
  :ensure t
  :config
  (add-hook 'python-mode-hook 'jedi:setup))

(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

(add-hook 'python-mode-hook 'my/python-mode-hook)

;; (use-package auto-complete
;;   :ensure t
;;   :init
;;   (progn
;;     (ac-config-default)
;;     (global-auto-complete-mode t)))

Reveal.js

(use-package ox-reveal
  :ensure ox-reveal)
  (setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
  (setq org-reveal-mathjax t)

Flycheck

(use-package flycheck
  :ensure t
  :init
  (global-flycheck-mode t))

Customizations:

Theme

(use-package material-theme
 :ensure t
 :config (load-theme 'material t))
(set-face-attribute 'default nil :height 150)
(set-face-attribute 'mode-line nil
                     :height 140
		     :foreground "Black"
		     :background "DarkOrange"
		     :box nil)
(set-face-attribute 'isearch nil
		    :foreground "#000000"
		    :background "#ffff00")

Beacon

(use-package beacon
  :ensure t
  :config
  (beacon-mode 1)
  (setq beacon-color "red")
  (setq beacon-blink-delay 0.4)
  (setq beacon-blink-duration 0.4)
  (setq beacon-blink-when-point-moves 7)
  (setq beacon-push-mark 5)
  (setq beacon-size 25))

Modeline

;; (use-package doom-modeline
;; :ensure t
;; :init (doom-modeline-mode 1))

YASnippet

It allows you to type an abbreviation and automatically expand it into function templates. (https://github.com/joaotavora/yasnippet#where-are-the-snippets => follow instructions to add snippets)

(use-package yasnippet
  :ensure t
  :init (yas-global-mode 1))

Undo Tree

(use-package undo-tree
  :ensure t
  :init 
  (global-undo-tree-mode))

Expand Region

(use-package expand-region
  :ensure t
  :config
  (global-set-key (kbd "C-=") 'er/expand-region))

Tramp

 (use-package tramp
   :defer 4
   :config
	  (setq tramp-default-method "ssh"))

ALl the icons

(use-package all-the-icons
:ensure t)

Neotree

(use-package neotree
 :ensure t
 :ensure all-the-icons
 :config
 (global-set-key [f8] 'neotree-toggle)
 (setq neo-theme (if (display-graphic-p) 'icons 'arrow)))

Aggresive Indent

(use-package aggressive-indent
  :ensure t
  :config
  (global-aggressive-indent-mode 1)
  ;;(add-to-list 'aggressive-indent-excluded-modes 'html-mode)
  )

Rainbow Delimiters

(use-package rainbow-delimiters
  :ensure t
  :init (add-hook 'prog-mode-hook #'rainbow-delimiters-mode))

esup

(use-package esup
:ensure t)

Markdown Mode

(use-package markdown-mode
  :ensure t
  :mode (("README\\.md\\'" . gfm-mode)
	     ("\\.md\\'" . markdown-mode)
	     ("\\.markdown\\'" . markdown-mode))
  :init (setq markdown-command "multimarkdown"))

Multiple cursors

(use-package multiple-cursors
  :ensure t
  :config
  (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
  (global-set-key (kbd "C->") 'mc/mark-next-like-this)
  (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
  (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this))

Delsel

(use-package delsel
  :ensure t
  :config
  (delete-selection-mode t))