Skip to content

Latest commit

 

History

History
820 lines (729 loc) · 26 KB

README.org

File metadata and controls

820 lines (729 loc) · 26 KB

OPTIMIZE EMACS STARTUP TIME

;; Make startup faster by reducing the frequency of garbage
;; collection.  The default is 800 kilobytes
(setq gc-cons-threshold most-positive-fixnum)
;; Increase the amount of data which Emacs reads from the process.
;; The default is 4 kilobytes make it 1 Megabyte
(setq read-process-output-max (* 1024 1024))


(setq file-name-handler-alist nil)

;; In Emacs 27+, package initialization occurs before `user-init-file' is
;; loaded, but after `early-init-file'. Doom handles package initialization, so
;; we must prevent Emacs from doing it early!
(setq package-enable-at-startup nil)
(advice-add #'package--ensure-init-file :override #'ignore)

;; Prevent the glimpse of un-styled Emacs by disabling these UI elements early.
(push '(menu-bar-lines . 0) default-frame-alist)
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist)

;; Resizing the Emacs frame can be a terribly expensive part of changing the
;; font. By inhibiting this, we easily halve startup times with fonts that are
;; larger than the system default.
(setq frame-inhibit-implied-resize t)

UI CLEANUP

 ;; remove default menu bar
 (menu-bar-mode nil)

 ;; disable electric pair and show parent
 (electric-pair-mode nil)
 (show-paren-mode nil)

 ;; hide both frame title bar and the icon
 (setq ns-use-proxy-icon  nil
	   frame-title-format nil)

 ;; disable these GUI based behaviors
 (when window-system
   (scroll-bar-mode -1)
   (tool-bar-mode -1)
   (tooltip-mode -1))

 ;; disable and customize startup message
 (setq inhibit-startup-message t
	   initial-scratch-message ";; Happy Hacking\n")

TEXT RENDERING

;;; use UTF-8 everywhere
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

;; define the font family and size
(add-to-list 'default-frame-alist '(font . "PragmataPro-15"))

;; Load pragmatapro-lig.el
(add-to-list 'load-path "~/.emacs.d/files")
(require 'pragmatapro-lig)
(add-hook 'text-mode-hook 'prettify-hook)
(add-hook 'prog-mode-hook 'prettify-hook)
(global-prettify-symbols-mode t)

FRAME POSITIONING

   (defun set-initial-frame ()
     "Defines and center the frame window"
     (let* ((base-factor 0.54)
	     (a-width (* (display-pixel-width) base-factor))
	     (a-height (* (display-pixel-height) base-factor))
	     (a-left (truncate (/ (- (display-pixel-width) a-width) 2)))
	     (a-top (truncate (/ (- (display-pixel-height) a-height) 2))))
	(set-frame-position (selected-frame) a-left a-top)
	(set-frame-size (selected-frame) (truncate a-width) (truncate a-height) t)))

   (setq frame-resize-pixelwise t)
   (set-initial-frame)

MAC CONFIGS

;; enable transparent titlebar with dark-mode
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist '(ns-appearance . dark))

UX CLEANUP

 ;; disable backup
 (setq make-backup-files nil)

 ;; Don't make new frames when opening a new file with Emacs
 (setq ns-pop-up-frames nil)

 ;; define alias to answering just 'y' or 'n' instead
 (defalias 'yes-or-no-p 'y-or-n-p)

 ;; Highlight the current line
 (global-hl-line-mode t)

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

 ;; make buffer name unique with style
 (setq uniquify-buffer-name-style 'reverse
	  uniquify-separator "|"
	  uniquify-after-kill-buffer-p t
	  uniquify-ignore-buffers-re "^\\*")

GLOBAL BINDINGS

;; dependable keybindings
(global-set-key (kbd "C-c l") #'goto-line)
(global-set-key (kbd "\C-c n") #'rename-buffer)
(global-set-key (kbd "C-c w") #'whitespace-mode)
(global-set-key (kbd "<C-s-return>") #'toggle-frame-fullscreen)

PACKAGE MANAGER

	(require 'package)
	(setq package-check-signature nil)
	(setq package-enable-at-startup nil)
	(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/"))
	(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
	(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
	(package-initialize)

	(unless (package-installed-p 'use-package)
	  (package-refresh-contents)
	  (package-install 'use-package)
	  (package-install 'diminish)
	  (package-install 'bind-key))

	(eval-when-compile
	  (require 'use-package))
	(require 'diminish)
	(require 'bind-key)

EXEC PATH

	(use-package exec-path-from-shell
	  :ensure t
	  :if (memq window-system '(mac ns))
	  :config
	  (setq exec-path-from-shell-variables
		'("LANG" "LC_CTYPE" "LC_NUMERIC" "LC_ALL" "HOME" "PERSONAL_ACCESS_TOKEN"
		  "FLASK_APP" "FLASK_ENV" "SECRET_KEY" "FLASK_MODE" "SERVER_MODE"
		  "POSTGRES_DB" "POSTGRES_DB_TEST" "POSTGRES_USER" "POSTGRES_PASSWORD"
		  "POSTGRES_PORT" "POSTGRES_HOST" "POSTGRES_TEST_HOST"
		  "MAIL_USERNAME" "MAIL_PASSWORD" "SECURITY_PASSWORD_SALT"
		  "TELCO_63510_SMS_SEND_PASSWORD" "TELCO_63514_SMS_SEND_PASSWORD"
		  "TELCO_63513_SMS_SEND_PASSWORD" "SENDGRID_API_KEY"
		  "PATH"))
	  (exec-path-from-shell-initialize))

THEMING

(use-package doom-themes
  :ensure t
  :config
  (setq doom-themes-enable-bold nil
	    doom-themes-enable-italic nil)
  (load-theme 'doom-outrun-electric t)
  (doom-themes-visual-bell-config)
  (doom-themes-org-config))

(use-package doom-modeline
  :ensure t
  :config (setq doom-modeline-persp-name nil)
  :hook (after-init . doom-modeline-mode))

(use-package winum
  :ensure t
  :config (winum-mode))

(use-package all-the-icons
  :ensure t
  :config (setq inhibit-compacting-font-caches t))

OTHER DEFAULTS

;; better error details
;; (setq debug-on-error t)

;; default directory for dire-mode
(setq default-directory "~/")

;; don't backup please. I got this
(setq make-backup-files nil)

;; disable emacs lockfiles
(setq create-lockfiles nil)

;; disable recentf
(recentf-mode nil)

;; activate column-number-mode
(column-number-mode t)
(setq-default indicate-buffer-boundaries 'right)

;; delete marked region with 'DEL' key or backspace
(delete-selection-mode t)

;; define abbrev file
(setq abbrev-file-name (expand-file-name "abbrev.el" user-emacs-directory))
(unless (file-exists-p abbrev-file-name)
  (write-region "" "" abbrev-file-name))

;; supress some warning
(setq ad-redefinition-action 'accept)

;; add char-menu
(use-package char-menu
  :ensure t
  :bind ("M-p" . char-menu)
  :custom
  (char-menu '("" "‘’" "“”" "" "«»" ""
		    ("Typography" "" "©" "" "" "°" "·" "§" "" "")
		    ("Mathematical Operators"
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "")
		    ("Superscripts & Subscripts"
		     "" ""   "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "₍₎"
		     "" "" "" "" "" "" "" "" "" "" "" "" "")
		    ("Arrows"     "" "" "" "" "" "" "" "")
		    ("Greek"      "α" "β" "Y" "δ" "ε" "ζ" "η" "θ" "ι" "κ" "λ" "μ"
		     "ν" "ξ" "ο" "π" "ρ" "σ" "τ" "υ" "φ" "χ" "ψ" "ω")
		    ("Enclosed Alphanumerics"
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
		     "" "" "" "" "" "" "" "" "" "" "" "" "" "")
		    ("Annotations"
		     "" "" "" "" "" "" "" ""
		     "" "" "" "" "" ""))))

CURSOR STYLING

(setq-default cursor-type '(bar . 1)
	  blink-cursor-delay 0
	  blink-cursor-interval 0.4)

;; flashes the cursor's line switched buffer
(use-package beacon
  :ensure t
  :config
  (beacon-mode t)
  (setq beacon-color "#0057FF"))

WHICH-KEY

(use-package which-key
  :ensure t
  :custom
  (which-key-separator " ")
  (which-key-prefix-prefix "+")
  :config (which-key-mode t))

IVY, SWIPER & COUNSEL

(use-package ivy
  :ensure t
  :diminish (ivy-mode . "")
  :init (ivy-mode t) ; globally at startup
  :config
  (setq ivy-count-format "%d/%d "
	    ivy-display-style 'fancy
	    ivy-initial-input-alist nil
	    ;; ivy-re-builders-alist
	    ;; '((swiper . ivy--regex-plus)
	    ;;   (t      . ivy--regex-fuzzy))
	    ))

(use-package ivy-rich
  :ensure t
  :config
  (setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line)
  (ivy-rich-mode t))

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

(use-package amx
  :ensure t
  :after ivy
  :custom (amx-set-backend 'auto)
  :config (amx-mode t))

(use-package flx :ensure t)

(use-package counsel
  :ensure t
  :after (ivy amx)
  :bind* ; load when pressed
  (("C-x C-m" . counsel-M-x)
   ("M-x"     . counsel-M-x)
   ("C-s"     . swiper-isearch)
   ("C-r"     . swiper-isearch)
   ("C-x C-f" . counsel-find-file)
   ("C-x C-r" . counsel-recentf)
   ("C-c g"   . counsel-git)
   ("C-c j"   . counsel-git-grep)
   ("C-c /"   . counsel-ag)
   ("C-x l"   . counsel-locate)
   ("C-x C-f" . counsel-find-file)
   ("<f1> f"  . counsel-describe-function)
   ("<f1> v"  . counsel-describe-variable)
   ("<f1> l"  . counsel-find-library)
   ("<f2> i"  . counsel-info-lookup-symbol)
   ("<f2> u"  . counsel-unicode-char)
   ("C-c C-r" . ivy-resume)))

(use-package counsel-osx-app
  :ensure t)

(use-package avy-flycheck
  :ensure t
  :config
  (global-set-key (kbd "C-'") #'avy-flycheck-goto-error))

ORG

   (use-package org
    :ensure org-plus-contrib
    :config (setq
	      org-startup-folded t
	      org-src-fontify-natively t
	      org-src-tab-acts-natively t
	      org-todo-keywords '((sequence "BACKLOG(b)" "TODO(t)" "DOING(n)" "|" "DONE(d)")
				  (sequence "|"  "ONHOLD(h)" "CANCELED(c)"))
	      org-agenda-files '("~/.org/agenda.org")))


   (use-package restclient
     :ensure t
     :config (add-hook 'restclient-mode-hook 'company-restclient))

   (use-package company-restclient
     :ensure t
     :config
     (progn
	(add-hook 'restclient-mode-hook
		  (lambda ()
		    (set (make-local-variable 'company-backends)'(company-restclient))
		    (company-mode t)))))

   (use-package ob-restclient
     :ensure t
     :config 
     (org-babel-do-load-languages 'org-babel-load-languages '((restclient . t))))

ANSI-XTERM

   ;; ANSI & XTERM 256 color support
   (use-package xterm-color
     :ensure t
     :defines (compilation-environment
		eshell-preoutput-filter-functions
		eshell-output-filter-functions)
     :functions (compilation-filter my-advice-compilation-filter)
     :init
     ;; For shell and interpreters
     (setenv "TERM" "xterm-256color")
     (setq comint-output-filter-functions
	    (remove 'ansi-color-process-output comint-output-filter-functions))
     (add-hook 'comint-preoutput-filter-functions 'xterm-color-filter)
     (add-hook 'shell-mode-hook
		(lambda ()
		  ;; Disable font-locking to improve performance
		  (font-lock-mode -1)
		  ;; Prevent font-locking from being re-enabled
		  (make-local-variable 'font-lock-function)
		  (setq font-lock-function #'ignore)))
     ;; For eshell
     (with-eval-after-load 'esh-mode
	(add-hook 'eshell-before-prompt-hook
		  (lambda ()
		    (setq xterm-color-preserve-properties t)))
	(add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)
	(setq eshell-output-filter-functions
	      (remove 'eshell-handle-ansi-color eshell-output-filter-functions)))

     ;; For compilation buffers
     (setq compilation-environment '("TERM=xterm-256color"))
     (defun my-advice-compilation-filter (f proc string)
	(funcall f proc
		 (if (eq major-mode 'rg-mode) ; compatible with `rg'
		     string
		   (xterm-color-filter string))))
     (advice-add 'compilation-filter :around #'my-advice-compilation-filter)
     (advice-add 'gud-filter :around #'my-advice-compilation-filter))

FRAME, WINDOW & PROJECT MANAGEMENT

;; nameframe
(use-package nameframe
  :ensure t  
  :config
  (global-set-key (kbd "C-c :") 'nameframe-create-frame)
  (global-set-key (kbd "C-c ;") 'nameframe-switch-frame))

;; perspective
(use-package perspective
  :ensure t
  :init
  (setq persp-mode-prefix-key (kbd "C-c C-p"))
  :config
  (persp-mode)
  (persp-turn-on-modestring)
  (define-key persp-mode-map (kbd "C-x b") 'persp-switch-to-buffer*)
  (define-key persp-mode-map (kbd "C-x k") 'persp-kill-buffer*))

(use-package nameframe-perspective
  :ensure t  
  :config
  (nameframe-perspective-mode t))

;; projectile
(use-package projectile
  :ensure t
  :config
  (projectile-global-mode)
  (setq projectile-completion-system 'ivy)
  (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))

(use-package counsel-projectile
  :ensure t
  :config
  (counsel-projectile-mode))

ESHELL

   (setenv "PAGER" "cat")

   (use-package shrink-path
     :ensure t)

   (use-package esh-autosuggest
     :ensure t
     :hook (eshell-mode . esh-autosuggest-mode))

   (use-package eshell
     :ensure t
     :config
     (setq
      eshell-banner-message "...\n"
      eshell-hist-ignoredups t
      eshell-error-if-no-glob t
      eshell-cmpl-ignore-case t
      eshell-save-history-on-exit t
      eshell-history-size 1024
      eshell-prefer-lisp-functions nil
      eshell-destroy-buffer-when-process-dies t
      eshell-scroll-to-bottom-on-input 'all))

   (use-package eshell-fringe-status
     :ensure t
     :config
     (add-hook 'eshell-mode-hook 'eshell-fringe-status-mode))

   (defun git-get-current-branch ()
     "Get git branch in the current directory."
     (when (and (eshell-search-path "git") (locate-dominating-file (eshell/pwd) ".git"))
	(s-trim (shell-command-to-string (concat "git symbolic-ref --short HEAD --")))))

   (defun display-git-prompt-branch ()
     "Displays the git in the prompt."
     (if (not (null (git-get-current-branch))) (concat "│" (git-get-current-branch)) ""))


   (defun get-first-char (str)
     "Get first character of string STR."
     (if (zerop (length str)) "" (substring str 0 1)))

   (defun fill-window-with-char ()
     "Fill the window width with one character acting as a line."
     (concat (make-string (- (window-body-width) 1) ? ) "\n"))

   (defun pwd-shorten-dirs (pwd)
     "Shorten all directory names in PWD except the last two."
     (let ((path-items (split-string pwd "/")))
	(if (> (length path-items) 2)
	    (concat
	     (mapconcat 'get-first-char (butlast path-items 2) "/")
	     "/"
	     (mapconcat (lambda (item) item) (last path-items 2) "/"))
	  pwd)))

   (defun eshell/clear ()
     "Clear and scrollback."
     (eshell/clear-scrollback))

   (setq eshell-prompt-function
	  (lambda nil
	    (concat
	     (propertize "\n" 'face nil)
	     ;; (propertize "\n" 'face '(:background "#191919"))
	     (propertize "╭⟢" 'face '(:foreground "#A2DEB2"))
	     (propertize " " 'face nil)
	     (propertize (user-login-name) 'face '(:foreground "#5DC078"))
	     (propertize "@" 'face '(:foreground "#0057FF"))
	     (propertize (system-name) 'face '(:foreground "#0083FF"))
	     (propertize "" 'face nil)
	     (propertize "│" 'face '(:foreground "#74CAFF"))
	     (propertize (pwd-shorten-dirs (abbreviate-file-name (eshell/pwd)))
			 'face '(:foreground "#74CAFF"))
	     (propertize "" 'face nil)
	     (propertize (display-git-prompt-branch) 'face '(:foreground "#A2DEB2"))
	     (propertize "\n" 'face nil)
	     (propertize "╰🡢" 'face '(:foreground "#A2DEB2"))
	     (propertize " " 'face nil))))

   (setq eshell-highlight-prompt nil)

   ;; Set this to match eshell-prompt-function
   (setq eshell-prompt-regexp "^╰🡢 ")

FLYCHECK

(use-package flycheck
  :ensure t
  :hook ((prog-mode . flycheck-mode))
  :config
  (setq flycheck-highlighting-mode 'lines))

COMPANY

	(use-package company
	  :ensure t
	  :config
	  (global-company-mode t)
	  (setq company-idle-delay 0.0
		company-minimum-prefix-length 1
		company-global-modes '(not eshell-mode))
	  (define-key company-active-map (kbd "M-n") nil)
	  (define-key company-active-map (kbd "M-p") nil)
	  (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-active-map (kbd "TAB") 'company-complete)
	  (define-key company-active-map (kbd "<tab>") 'company-complete))

	(use-package company-flx
	  :ensure t
	  :config (company-flx-mode t))

LANGUAGE UTILS

(use-package smartparens
  :ensure t
  :config (progn (show-smartparens-global-mode t))
  :hook (prog-mode . turn-on-smartparens-mode))

(use-package rainbow-delimiters
  :ensure t
  :hook (prog-mode . rainbow-delimiters-mode))

(use-package highlight-indent-guides
  :ensure t
  :hook (prog-mode . highlight-indent-guides-mode)
  :custom
  (highlight-indent-guides-character ?\│)
  (highlight-indent-guides-auto-odd-face-perc 2)
  (highlight-indent-guides-auto-even-face-perc 2)
  (highlight-indent-guides-auto-character-face-perc 8)
  (highlight-indent-guides-method 'character)
  (highlight-indent-guides-responsive 'character)
  (highlight-indent-guides-delay 0))

LANGUAGES

PYTHON

(use-package lsp-python-ms
  :ensure t
  :config
  (add-to-list 'lsp-language-id-configuration '(python-mode . "python"))
  :hook (python-mode . (lambda () (require 'lsp-python-ms) (lsp))))

;; (use-package pyenv-mode :ensure t)

;; (use-package pyenv-mode-auto :ensure t)

;; (use-package blacken
;; :after python
;; :hook (python-mode . blacken-mode))

DART

   (defun flutter-lsp-save ()
     "Upgrade save in flutter to do formatting and hot-reload"
     (interactive)
     (lsp-format-buffer)
     (save-buffer)
     (if (flutter--running-p)
	   (flutter-hot-reload)))


   (use-package dart-mode
     :ensure t
     :config
     (add-to-list 'lsp-language-id-configuration '(dart-mode . "dart"))
     (with-eval-after-load "projectile"
	 (add-to-list 'projectile-project-root-files-bottom-up "pubspec.yaml")
	 (add-to-list 'projectile-project-root-files-bottom-up "build")))

   (use-package flutter
     :ensure t
     :after dart-mode
     ;; :custom (flutter-sdk-path "/Applications/flutter/")
     :bind (:map dart-mode-map ("C-x C-s" . #'flutter-lsp-save)))

LUA

(use-package lua-mode
  :ensure t)

GROOVY

(use-package groovy-mode
  :ensure t
  :mode "\\.groovy\\'\\|\\.gradle\\'")

RUST

(use-package toml-mode
  :ensure t)

(use-package rust-mode
  :ensure t
  :init
  (setq rust-format-on-save t)
  :hook (rust-mode . lsp))

(use-package cargo
  :ensure t
  :hook (rust-mode . cargo-minor-mode))

(use-package flycheck-rust
  :ensure t
  :after (rust-mode)
  :hook ((rust-mode . flycheck-rust-setup)
	      (flycheck-mode . flycheck-rust-setup)))

JAVASCRIPT

(use-package json-mode
  :ensure t
  :mode (("\\.json\\'" . json-mode)
	      ("\\.tmpl\\'" . json-mode)
	      ("\\.eslintrc\\'" . json-mode))
  :config (setq-default js-indent-level 2))

(use-package json-reformat
  :ensure t
  :after json-mode
  :bind (("C-c r" . json-reformat-region)))

(use-package js2-mode 
  :ensure t
  :mode "\\.jsx?\\'"
  :config (setq js2-basic-offset 2
		     js-indent-level 2)
  :hook (js2-mode . lsp))

(use-package rjsx-mode
  :ensure t
  :mode "\\.jsx?\\'"
  :config (setq-default js2-basic-offset 2))


(use-package typescript-mode
  :ensure t
  :mode "\\.tsx?\\'"
  :config (setq typescript-indent-level 2)
  :hook (typescript-mode . lsp))

(use-package prettier-js
  :ensure t
  :init
  (add-hook 'js2-mode-hook 'prettier-js-mode)
  (add-hook 'rjsx-mode-hook 'prettier-js-mode)
  (add-hook 'typescript-mode-hook 'prettier-js-mode))

(use-package skewer-mode
  :ensure t
  :bind (("C-c K" . run-skewer))
  :diminish skewer-mode
  :init
  (add-hook 'js2-mode-hook 'skewer-mode)
  (add-hook 'css-mode-hook 'skewer-css-mode)
  (add-hook 'html-mode-hook 'skewer-html-mode))

LSP

   (defun get-dart-path ()
     (string-trim-right
      (car
	(seq-filter
	 (lambda (str) (string-match "dart" str))
	 (split-string (getenv "PATH") ":")))
      "/bin"))

   (use-package lsp-mode
     :ensure t
     :config
     (setq lsp-prefer-flymake nil
	    ;; lsp-dart-sdk-dir (get-dart-path)
	    lsp-enable-on-type-formatting nil
	    lsp-headerline-breadcrumb-enable nil
	    lsp-idle-delay 0.500   ;; can improve performance
	    lsp-prefer-capf t      ;; replacing company-lsp
	    lsp-log-max 10000)
     :hook 
     (sh-mode . lsp)
     (python-mode . lsp)
     (dart-mode . lsp)
     (js2-mode . lsp)
     (typescript-mode . lsp)
     (lsp-mode . lsp-enable-which-key-integration)
     :commands (lsp lsp-ensurered))

   (use-package lsp-ui
     :ensure t
     :requires lsp-mode flycheck
     :config
     (setq lsp-ui-sideline-enable t
	    lsp-ui-sideline-show-symbol nil)
     :hook (lsp-mode . lsp-ui-mode))

   (use-package lsp-ivy :commands lsp-ivy-workspace-symbol)

   (use-package yasnippet
     :ensure t
     :diminish yas-minor-mode
     :config
     (use-package yasnippet-snippets
	:ensure t)
     (yas-global-mode t))

CLI CLIENTS

GIT

    (use-package magit
      :ensure t
      :config (setq magit-completing-read-function 'ivy-completing-read)
      :bind ("C-x g" . magit-status))

    (use-package forge
      :ensure t
      :after magit
      :config
      (add-to-list
	'forge-alist
	'("er.github.com" "api.github.com" "github.com"
	  forge-github-repository))
      (add-to-list
	'forge-alist
	'("er.bitbucket.org" "api.bitbucket.org/2.0" "bitbucket.org"
	  forge-bitbucket-repository)))

    (if (display-graphic-p)
	 (use-package git-gutter-fringe
	   :ensure t
	   :init (global-git-gutter-mode))
      (use-package git-gutter
	 :ensure t
	 :init (global-git-gutter-mode)))

DOCKER

(use-package dockerfile-mode :ensure t)
(use-package docker-compose-mode :ensure t)
(use-package docker-tramp :ensure t)

CUSTOM.EL CONFIG FILE

  (add-hook
   'after-init-hook
   (lambda ()
     (let ((custom-file
	      (expand-file-name "custom.el" user-emacs-directory)))
	 (unless (file-exists-p custom-file)
	   (write-region "" "" custom-file))
	 (load custom-file))))

REDUCE GARBAGE COLLECTION

;; Make gc pauses faster by decreasing the threshold.
(setq gc-cons-threshold (* 16 1000 1000))