          ("\\.markdown\\'" . markdown-mode))
   :init (setq markdown-command "multimarkdown"))
 
-;; Setup flycheck syntax checking
-(use-package flycheck
-  :ensure t
-  :init (global-flycheck-mode)
-  :config
-  (add-hook 'after-init-hook 'global-flycheck-mode)
-  (setq-default flycheck-highlighting-mode 'lines)
-  ;; Define fringe indicator / warning levels
-    (define-fringe-bitmap 'flycheck-fringe-bitmap-ball
-      (vector #b00000000
-              #b00000000
-              #b00000000
-              #b00000000
-              #b00000000
-              #b00000000
-              #b00000000
-              #b00011100
-              #b00111110
-              #b00111110
-              #b00111110
-              #b00011100
-              #b00000000
-              #b00000000
-              #b00000000
-              #b00000000
-              #b00000000))
-    (flycheck-define-error-level 'error
-      :severity 2
-      :overlay-category 'flycheck-error-overlay
-      :fringe-bitmap 'flycheck-fringe-bitmap-ball
-      :fringe-face 'flycplHeck-fringe-error)
-    (flycheck-define-error-level 'warning
-      :severity 1
-      :overlay-category 'flycheck-warning-overlay
-      :fringe-bitmap 'flycheck-fringe-bitmap-ball
-      :fringe-face 'flycheck-fringe-warning)
-    (flycheck-define-error-level 'info
-      :severity 0
-      :overlay-category 'flycheck-info-overlay
-      :fringe-bitmap 'flycheck-fringe-bitmap-ball
-      :fringe-face 'flycheck-fringe-info))
-
-;; Setup Tabs for Window
-(use-package centaur-tabs
-  :ensure t
-  :demand
-  :config
-  (centaur-tabs-mode t)
-  (setq centaur-tabs-style "bar")
-  :bind
-  ("C-<prior>" . centaur-tabs-backward)
-  ("C-<next>" . centaur-tabs-forward))
-
-;; Org-mode Configuration
-(require 'org)
-(setq org-catch-invisible-edits 'error)
-(setq org-return-follows-link t)
-(setq org-src-preserve-indentation t)
-(setq org-src-fontify-natively t)
-(setq org-src-tab-acts-natively t)
-(setq org-ellipsis " ▼")
-(setq org-cycle-separator-lines 1)
-
-;; Don't ask for confirmation on eval buffers
-(setq org-confirm-babel-evaluate nil)
-
-;; Support org-capture
-(define-key global-map "\C-cc" 'org-capture)
-
-;; All org mode files live in $HOME/org
-(setq org-directory "~/org")
-(setq org-agenda-files '("~/org/"))
-
-(setq custom-file (concat user-emacs-directory "/custom.el"))
-;;; init.el ends here
+;; use and enable writegood-mode
+(use-package writegood-mode
+  :ensure t
+  :after markdown-mode org
+  :config
+  (add-hook 'markdown-mode-hook 'writegood-mode)
+  (add-hook 'org-mode-hook 'writegood-mode))
+
+(use-package yaml-mode
+  :ensure t
+  :mode (("\\.yml\\'" . yaml-mode)
+         ("\\.yaml\\'" . yaml-mode)))
+
+(use-package sql-indent
+  :ensure t)
+
+(use-package sql
+  :after sql-indent
+  :ensure t)
+
+;; keep init.el clean
+(setq custom-file (concat user-emacs-directory "custom.el"))
+(load custom-file 'noerror)

  :after treemacs projectile
  :ensure t)

(use-package org
  :mode (("\\.org$" . org-mode))
  :ensure org-plus-contrib)

(use-package treemacs-magit
  :after treemacs magit
  :ensure t)

;; Setup whitespace cleanup
(add-hook 'before-save-hook 'whitespace-cleanup)

;; Have a much more intelligent deletion of whitespace before words
(use-package smart-hungry-delete
  :ensure t
  :bind (("<backspace>" . smart-hungry-delete-backward-char)
                 ("C-d" . smart-hungry-delete-forward-char))
  :defer nil ;; dont defer so we can add our functions to hooks
  :config (smart-hungry-delete-add-default-hooks)
  )

;; Docker support
(use-package dockerfile-mode
  :ensure t
  :mode  (("\\Dockerfile\\'" . dockerfile-mode)))

;; Enable YAML Support
(use-package yaml-mode
  :ensure t
  :mode (("\\.yml\\'" . yaml-mode)
         ("\\.yaml\\'" . yaml-mode)))

;; Create a dedicated backup directory
(setq
 backup-directory-alist '(("." . "~/.emacs.d/backups"))
 delete-old-versions -1
 version-control t
 vc-make-backup-files t
 backup-by-copying t)

;; Enable language server protocol support
;; https://github.com/golang/tools/blob/master/gopls/doc/emacs.md
(use-package lsp-mode
  :ensure t
  :commands (lsp lsp-deferred)
  :config
  (setq lsp-prefer-flymake nil)
  :hook (go-mode . lsp-deferred))

;; Set up before-save hooks to format buffer and add/delete imports.
;; Make sure you don't have other gofmt/goimports hooks enabled.
(defun lsp-go-install-save-hooks ()
  (add-hook 'before-save-hook #'lsp-format-buffer t t)
  (add-hook 'before-save-hook #'lsp-organize-imports t t))
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)

;; Optional - provides fancier overlays.
(use-package lsp-ui
  :ensure t
  :commands lsp-ui-mode
  :hook (lsp-mode-hook . lsp-ui-mode)
  :config
  (setq lsp-ui-doc-enable nil
        lsp-ui-peek-enable t
        lsp-ui-sideline-enable t
        lsp-ui-imenu-enable t
        lsp-ui-flycheck-enable t
        lsp-gopls-staticcheck t
        lsp-eldoc-render-all t
        lsp-gopls-complete-unimported t)
  :init
  (add-hook 'after-init-hook #'global-company-mode))

;; Company mode is a standard completion package that works well with lsp-mode.
(use-package company
  :ensure t
  :config
  ;; Optionally enable completion-as-you-type behavior.
  (setq company-idle-delay 0)
  (setq company-minimum-prefix-length 1)
  (setq company-tooltop-align-annotations t))

;; company-lsp integrates company mode completion with lsp-mode.
;; completion-at-point also works out of the box but doesn't support snippets.
(use-package company-lsp
  :ensure t
  :after company
  :commands company-lsp
  :config
  (push 'company-lsp company-backends))

;; Optional - provides snippet support.
(use-package yasnippet
  :ensure t
  :commands yas-minor-mode
  :hook (go-mode . yas-minor-mode))

;; Enable Golang Support
(use-package go-mode
  :ensure t
  :hook ((go-mode . lsp-deferred)
         (before-save . lsp-format-buffer)
         (before-save . lsp-organize-imports)))

(use-package sql-indent
  :ensure t)

;; Setup web-mode for gohtml and html
(use-package web-mode

  :ensure t
  :bind (("M-x" . counsel-M-x)))

;; enhanced version of isearch
(use-package swiper
  :ensure t
  :bind (("C-/" . counsel-grep-or-swiper)))

;; the best git support ever
(use-package magit
  :ensure t
  :bind (("C-x g" . magit-status)
