Skip to content

Latest commit

 

History

History
496 lines (429 loc) · 15 KB

svg-config.org

File metadata and controls

496 lines (429 loc) · 15 KB

This set of configuration is specific to my developmemt environment.

Interface tweeks

(setq inhibit-startup-message t)
(tool-bar-mode -1)
(fset 'yes-or-no-p 'y-or-n-p)
(defalias 'list-buffers 'ibuffer)

(windmove-default-keybindings)

(show-paren-mode 1)

(global-hl-line-mode t)

(global-display-line-numbers-mode) ;; Not looking good in zenburn theme

;; disable the annoying bell ring
(setq ring-bell-function 'ignore)

;; mode line settings
(line-number-mode t)
(column-number-mode t)
(size-indication-mode t)

;; nice scrolling
(setq scroll-margin 0
      scroll-conservatively 100000
      scroll-preserve-screen-position 1)

(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
  (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))

 ;;; Prevent Extraneous Tabs
(setq-default indent-tabs-mode nil)

(custom-set-variables
 '(initial-frame-alist (quote ((fullscreen . maximized)))))

;; opening custom agenda view when emacs starts
(org-agenda nil "c")

;; Whitespace management
;; Removes trailing whitespaces when saving the file
(add-hook 'before-save-hook 'whitespace-cleanup)

(defun on-after-init ()
  (unless (display-graphic-p (selected-frame))
    (set-face-background 'default "unspecified-bg" (selected-frame))
    (set-face-background 'default "nil" (selected-frame))))

(add-hook 'window-setup-hook 'on-after-init)

(setq user-full-name "Sunil Gunisetty"
      user-mail-address "sunilgunisetty@gmail.com")

;; GC settings
(setq gc-cons-threshold 50000000)
(setq large-file-warning-threshold 100000000)

(setq frame-title-format
      '((:eval (if (buffer-file-name)
                   (abbreviate-file-name (buffer-file-name))
                 "%b"))))

;; Automatically reload files edited outside emacs
(global-auto-revert-mode t)

Package try

Allows you try emacs packages without installing it.

(use-package try
  :ensure t)

Package which key

Used to display key bindings following currently entered incomplete key bindings. Example press C-x and wait for a second to see list of available key bindings.

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

Swiper

Better search

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

(use-package ivy
  :ensure t
  :diminish (ivy-mode)
  :bind (("C-x b" . ivy-switch-buffer))
  :config
  (ivy-mode 1)
  (setq ivy-use-virtual-buffers t)
  (setq ivy-display-style 'fancy))

(use-package swiper
  :ensure try
  :bind (("C-s" . swiper)
         ("C-r" . swiper)
         ("C-c C-r" . ivy-resume)
         ("M-x" .  counsel-M-x)
         ("C-x C-f" . counsel-find-file))
  :config
  (progn
    (ivy-mode 1)
    (setq ivy-use-virtual-buffer t)
    (setq ivy-display-style 'fancy)
    (define-key read-expression-map (kbd "C-r") 'counsel-expression-history)))

Tramp

Tramp mode enables you to edit remote files. Its already available in emacs

  • To edit remote file C-x C-f /shh:user-name@your-remote-host:file-name
  • To edit local root file C-x C-f /sudo::path-your-local-file -> password will be prompted
  • To edit remote root file C-x C-f /ssh:your-remote-host|sudo:your-remote-host:path-to-remote-file -> password will be prompted

Projectile mode

(use-package projectile
  :ensure t
  :init
  (progn
      (projectile-mode +1)
      (define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
      (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
      (setq projectile-completion-system 'ivy)))

LISP editing

(use-package paredit
  :ensure t
  :bind (("C-c d" . paredit-forward-down))
  :config
  (add-hook 'emacs-lisp-mode-hook       #'enable-paredit-mode)
  (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
  (add-hook 'ielm-mode-hook             #'enable-paredit-mode)
  (add-hook 'lisp-mode-hook             #'enable-paredit-mode)
  (add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
  (add-hook 'scheme-mode-hook           #'enable-paredit-mode))

(use-package paredit-everywhere
  :ensure t
  :diminish paredit-everywhere-mode
  :config
  (add-hook 'prog-mode-hook #'paredit-everywhere-mode))

(use-package highlight-parentheses
  :ensure t
  :diminish highlight-parentheses-mode
  :config
  (add-hook 'emacs-lisp-mode-hook
            (lambda()
              (highlight-parentheses-mode)
              )))

(use-package rainbow-delimiters
  :ensure t
  :config
  (add-hook 'lisp-mode-hook
            (lambda()
              (rainbow-delimiters-mode))))

(global-highlight-parentheses-mode)

Emacs git

(use-package magit
  :ensure t
  :bind (("C-c m" . magit-status)))

(use-package magit-gitflow
  :ensure t
  :config
  (add-hook 'magit-mode-hook 'turn-on-magit-gitflow))

Color theme

Best theme which I like and works well with terminal emacs

Uncomment the one which you like and comment rest.

;; (use-package zenburn-theme
;;   :ensure t
;;   :config (load-theme 'zenburn t))

;; (use-package waher-theme
;;   :ensure t
;;   :init
;;   (load-theme 'waher))

;; (use-package cyberpunk-theme
;;   :if (window-system)
;;   :ensure t
;;   :init
;;   (progn
;;     (load-theme 'cyberpunk t)
;;     (set-face-attribute `mode-line nil :box nil)
;;     (set-face-attribute `mode-line-inactive nil :box nil)))

(use-package kaolin-themes
  :ensure t
  :config
  (load-theme 'kaolin-dark t)
  (kaolin-treemacs-theme)
  (set-face-attribute hl-line-face nil :underline nil))

Font

*Note* : Comment this section if you are not using mac OSX. To comment start the line with ; (semicolon)

Following section is taken from Daniel Mai

Fire Code is a nice monospaced font.

To install it on macOS, you can use Homebrew with Homebrew Cask.

# You may need to run these two lines if you haven't set up Homebrew
# Cask and its fonts formula.
brew install caskroom/cask/brew-cask
brew tap caskroom/fonts

brew cask install font-fira-code
(add-to-list 'default-frame-alist
             (cond
              ((string-equal system-type "darwin")    '(font . "Fira Code Retina-12"))
              ((string-equal system-type "gnu/linux") '(font . "Fira Code Retina-12"))))

Multiple Cursors

Very useful for refactoring

(use-package multiple-cursors
  :ensure t
  :init
  (progn
    (defvar multiple-cursors-keymap nil "Multiple Cursor")
    (setq multiple-cursors-keymap (make-sparse-keymap))
    (global-set-key (kbd "C-x M-e") multiple-cursors-keymap)
    (define-key multiple-cursors-keymap (kbd "e") 'mc/edit-lines)
    (define-key multiple-cursors-keymap (kbd "n") 'mc/mark-next-like-this)
    (define-key multiple-cursors-keymap (kbd "p") 'mc/mark-previous-like-this)
    (define-key multiple-cursors-keymap (kbd "a") 'mc/mark-all-like-this)
    (define-key multiple-cursors-keymap (kbd ".") 'mc/mark-more-like-this-extended)))

(global-set-key (kbd "C-;") 'set-rectangular-region-anchor)

Expand-region

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

Clojure programming

(use-package clojure-mode
  :ensure t
  :config
  (add-hook 'clojure-mode-hook #'paredit-mode)
  (add-hook 'clojure-mode-hook #'subword-mode)
  (add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
  (add-hook 'clojure-mode-hook #'company-mode)
  (put-clojure-indent 'defui '(1 nil nil (1)))
  (put-clojure-indent 'facts 1)
  (put-clojure-indent 'fact 1)
  (put-clojure-indent 'future-fact 1)
  (put-clojure-indent 'not-join 1)
  (put-clojure-indent 'or-join 1)
  (put-clojure-indent 'match 1))

(use-package cider
  :ensure t
  :config
  (add-hook 'cider-mode-hook #'eldoc-mode)
  (add-hook 'cider-repl-mode-hook #'eldoc-mode)
  (add-hook 'cider-repl-mode-hook #'paredit-mode)
  (add-hook 'cider-repl-mode-hook #'rainbow-delimiters-mode))


(defun cider--gather-session-params (session)
  "Gather all params for a SESSION."
  (let (params)
    (dolist (repl (cdr session))
      (when (buffer-name repl)
        (setq params (cider--gather-connect-params params repl))))
    (when-let* ((server (cider--session-server session)))
      (setq params (cider--gather-connect-params params server)))
    params))

(use-package company
  :ensure t
  :config
  (add-hook 'cider-repl-mode-hook #'cider-company-enable-fuzzy-completion)
  (add-hook 'cider-mode-hook #'cider-company-enable-fuzzy-completion)
  (global-set-key (kbd "TAB") #'company-indent-or-complete-common))

Haskell programming

(use-package intero
  :ensure t
  :config
  (add-hook 'haskell-mode-hook 'intero-mode))

;; Need this for emacs to find stack
(add-to-list 'exec-path "/usr/local/bin/")

Org mode

(use-package org
  :ensure org-plus-contrib
  :pin org)

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

(use-package htmlize
  :ensure t
  :config
  (setq org-export-htmlize-output-type 'css))

;;(setq org-directory "~/Dropbox/orgfiles")
(setq org-export-html-postamble nil)
(setq org-hide-leading-stars t)
(setq org-startup-folded (quote overview))
(setq org-startup-indented t)
(setq org-support-shift-select t)

;; Use evince to open pdf files
(setq org-file-apps (append '(("\\.pdf\\'" . "evince %s")) org-file-apps))


;;(global-set-key "\C-ca" 'org-agenda)

(use-package org-ac
  :ensure t
  :init
  (progn
    (require 'org-ac)
    (org-ac/config-default)))


(setq org-todo-keywords
      '((sequence "  TODO" " ⚒ WORKING" " ⇵  MOVED" " 🔍 INVESTIGATE" " 📖 READ" "|" " ✔ DONE")
        (sequence " ⚑  REPORT" " 🐞 BUG" " ⚠  KNOWNCAUSE" "|" " ☑  FIXED")
        (sequence "|" " ✘ CANCELED")))

(setq org-todo-keyword-faces
      '(("  TODO" . (:foreground "purple" :weight bold))
        (" ✔ DONE" . (:foreground "orange" :weight bold))
        (" ⚑  REPORT" . (:foreground "yellow" :weight bold))
        ("  BUG" . (:foreground "red" :weight bold))
        (" ⚠  KNOWNCAUSE" . (:foreground "blue" :weight bold))
        (" ☑  FIXED" . (:foreground "orange" :weight bold))
        (" ✘ CANCELED" . (:foreground "brown" :weight bold))
        (" ⚒ WORKING" . (:foreground "pink" :weight bold))
        (" ⇵  MOVED" . (:foreground "white" :weight bold))))

(setq-default org-display-custom-times t)
(setq org-time-stamp-custom-formats '("[ %A %B %e %Y ]" . "[ %A %B %e %Y %H:%M ]"))

(defun org-pomodoro-finished-hook ()
  (with-output-to-temp-buffer "**Pomodora**"
    (print (concat "Finished pomodora for ---> " (upcase (eval org-clock-heading))))
    (pop-to-buffer "**Pomodora**")))

(use-package org-pomodoro
  :ensure t
  :config
  (add-hook 'org-pomodoro-finished-hook #'org-pomodoro-finished-hook))

(add-hook 'org-mode-hook (lambda ()
                           "Beautify Org Checkbox Symbol"
                           (setq prettify-symbols-alist
                                 (prettify-utils-generate
                                  ("[ ]" "")
                                  ("[X]" "")
                                  ("[-]" "")))
                           (prettify-symbols-mode)))

;;(global-set-key (kbd "C-c c") 'org-capture)

;; settings for org agends gcal

(setq package-check-signature nil)

;; (use-package org-gcal
;;   :ensure t
;;   :config
;;   (setq org-gcal-client-id ""
;;         org-gcal-client-secret ""
;;         org-gcal-file-alist '(("" .  ""))))

;; (add-hook 'org-agenda-mode-hook (lambda () (org-gcal-sync) ))
;; (add-hook 'org-mode-hook (lambda () (visual-line-mode 1)))
(require 'org-tempo)

All the icons

All the icons

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

(use-package all-the-icons-ivy
  :ensure t
  :init (all-the-icons-ivy-setup))

(use-package all-the-icons-dired
  :ensure t
  :hook (dired-mode . all-the-icons-dired-mode))

Neotree

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

Search and replace

(use-package ag
  :ensure t
  :commands (ag)
  :config (setq ag-highlight-search t
                ;ag-group-matches nil
                ))

(use-package wgrep
  :ensure t)

;; Only seems to work if resukts are bit grouped, ~ag-group-matches~ set to ~nil~.
(use-package wgrep-ag
  :ensure t
  :after ag)

No Backup file

(setq make-backup-files nil)

Doom Mode line

(use-package doom-modeline
  :ensure t
  :hook (after-init . doom-modeline-mode))

Javascript

(use-package prettier-js
  :ensure t
  :config
  (setq prettier-js-args '(
                           "--trailing-comma" "es5"
                           "--single-quote" "true"
                           "--print-width" "120"
                           "--tab-width" "4"
                           "--use-tabs" "false"
                           "--jsx-bracket-same-line" "false"
                           "--stylelint-integration" "true"
                           )))

(use-package js2-mode
  :ensure t)

(use-package rjsx-mode
  :ensure t
  :mode(("\\.js\\'" . rjsx-mode)
        ("\\.jsx\\'" . rjsx-mode))
  :init
  (add-hook 'rjsx-mode-hook 'prettier-js-mode))

(use-package json-mode
  :ensure t)

Yasnippet

(use-package yasnippet
  :ensure t
  :init
  (yas-global-mode 1)
  :config
  (add-to-list 'load-path "~/.emacs.d/yasnippet"))