Skip to content

Latest commit

 

History

History
1159 lines (906 loc) · 29.4 KB

config.org

File metadata and controls

1159 lines (906 loc) · 29.4 KB

Emacs configuration file

Theme

Theme configuration

I have a few options, for easy switching.

(if (display-graphic-p)
(use-package doom-themes
  :ensure t
;;  :config (load-theme 'doom-gruvbox) ;; divider ok, but comments too pale
;;  :config (load-theme 'doom-dark+)
;;  :config (load-theme 'faff)
;;  :config (load-theme 'doom-one)
;;  :config (load-theme 'doom-acario-dark) ;; duvider ok, but not great colors.
;;  :config (load-theme 'doom-ephemeral) ;; looks reasonable, but too dark. not great on gui.
;;  :config (load-theme 'doom-laserwave)
;;  :config (load-theme 'doom-molokai)
;;  :config (load-theme 'doom-monokai-pro)
;;  :config (load-theme 'doom-sourcerer)
))

(use-package faff-theme
   :ensure t)

;;(use-package poet-theme
;;   :ensure t)

(load-theme 'faff t)

;; (unless (display-graphic-p) (load-theme 'wheatgrass))
;; (unless (display-graphic-p) (load-theme 'wombat))
(unless (display-graphic-p) (load-theme 'tsdh-dark))

;; Set the default font. A few options. 

;; (set-default-font "Source Code Pro 11")
 (set-default-font "DejaVu Sans Mono 12")
;;  (set-default-font "Go 11")
;; (set-default-font "Fira Code 11")
;; (set-default-font "Hack 11")
;; (set-default-font "Inconsolata 12")

Spaceline

Modeline inspired by the spacemacs distribution

    ;; enable spacemacs mode-line
    (use-package spaceline
      :ensure t
      :init 
      (progn 
      ;; size of modeline
         (setq powerline-height 20)
;;         (setq spaceline-highlight-face-func 'spaceline-highlight-face-evil-state)
)
      :config
      (require 'spaceline-config)
    ;;    (setq spaceline-buffer-encoding-abbrev-p nil)
    ;;    (setq spaceline-line-column-p nil)
    ;;    (setq spaceline-line-p nil)
    ;;    (setq powerline-default-separator (quote arrow))
    ;;  (spaceline-emacs-theme)
      (spaceline-spacemacs-theme)
      (setq
    ;;      spaceline-buffer-encoding-abbrev-p nil
            spaceline-window-numbers-unicode t
            )
    ;;        spaceline-minor-modes-separator nil
            (powerline-reset)
      )

    ;; Change some powerline colors in the terminal
      (unless (display-graphic-p) 
              (set-face-background 'powerline-inactive2 "color-233")
              (set-face-foreground 'powerline-inactive2 "white")
              (set-face-background 'powerline-inactive1 "cyan")
              (set-face-foreground 'powerline-inactive1 "white")
              (set-face-foreground 'mode-line "white")
  ;;            (set-face-background 'mode-line-inactive "")
             (set-face-foreground 'mode-line-inactive "white")
      )
      ;; (when (display-graphic-p) 
      ;;         (set-face-background 'powerline-inactive2 "gray30")
      ;;         (set-face-foreground 'powerline-inactive2 "gray5")
      ;;         (set-face-background 'powerline-inactive1 "gray30")
      ;;         (set-face-foreground 'powerline-inactive1 "gray5")
      ;;         (set-face-background 'mode-line-inactive "gray30")
      ;;         (set-face-foreground 'mode-line-inactive "gray5")
      ;; )
   ;; change vertical divider line
      (set-face-background 'fringe "gray42") 
      (set-fringe-style 4)
      (scroll-bar-mode 0)

Doom modeline (off)

If necessary, doom’s modeline can be used (not activated now)

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

All the icons package

I don’t think this is used, but it’s good to have it, just in case

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

Which key passage

This displays completion options when you type emacs shortcuts.

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

Evil Mode ( ͡° ͜ʖ ͡°)

This activates the emacs evil mode, which allows most vim keybindings

emacs keybindings are also enabled in INSERT state.

I tried this for a while, but it’s not for me.

;; EVIL mode buahhahahaha
;; (use-package evil
;;   :ensure t
;;   :init
;;   (setq evil-disable-insert-state-bindings t)
;; ;;  (setq evil-mode-line-format 'before)
;;   :config (evil-mode)
;; )
;; (define-key evil-normal-state-map "\C-r" 'swiper-isearch-backward)

(global-set-key (kbd "C-<Backspace>") 'backward-kill-word)


;;(setq-default mode-line-format 'before)

Org-mode config

Org bullets

fancy org-bullets

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

  ;; change size of org titles
  (custom-set-faces
    '(org-level-1 ((t (:inherit outline-1 :height 1.5))))
    '(org-level-2 ((t (:inherit outline-2 :height 1.3))))
    '(org-level-3 ((t (:inherit outline-3 :height 1.1))))
    '(org-level-4 ((t (:inherit outline-4 :height 1.0))))
    '(org-level-5 ((t (:inherit outline-5 :height 1.0))))
  )
(setq org-list-allow-alphabetical t)

Org indent mode

;; Add org indent mode
(add-hook 'org-mode-hook 'org-indent-mode)

Org-sidebar

(use-package org-sidebar
    :ensure t)

Line wrapping in org-mode

(add-hook 'org-mode-hook 
          '(lambda () (visual-line-mode 1)))
(use-package adaptive-wrap
    :ensure t
)
(setq-default adaptive-wrap-extra-indent 2)

Images

(setq org-image-actual-width nil)

Text and faces

Change some org-mode faces.

   (set-face-foreground 'org-document-info-keyword "RoyalBlue4")
   (set-face-attribute 'org-document-title nil :height 200)

  (when (display-graphic-p) 
   (set-face-attribute 'org-block nil :background
                      (color-darken-name
                      (face-attribute 'default :background) 8))
   (set-face-attribute 'org-block-begin-line nil :background
                      (color-darken-name
                      (face-attribute 'default :background) 14))
  )

(custom-set-faces
 '(italic ((t (:foreground "blue" :slant italic)))))

Open PDFs externally

(add-to-list 'org-file-apps '("pdf" . "okular %s"))

Org2Blog

Set up wordpress blogging directly from org-mode

(use-package org2blog
    :ensure t)

;; set up my wordpress site.

(setq org2blog/wp-blog-alist
      '(("mildly-scientific"
         :url "https://www.mildlyscientific.com//xmlrpc.php"
         :username "mildlyscientific")))
(defun org2blog-sample-keybindings ()
  (local-set-key (kbd "M-1") #'org2blog-user-interface))
(add-hook 'org2blog/wp-mode-hook #'org2blog-sample-keybindings)
(setq org2blog/wp-image-upload t)

Copy RTF text directly.

(use-package ox-clip
    :ensure t)

(global-set-key (kbd "C-x M-w") 'ox-clip-formatted-copy)

Latex export

Book class with no parts, just chapters

(add-to-list 'org-latex-classes
           '("book-noparts"
              "\\documentclass{book}"
              ("\\chapter{%s}" . "\\chapter*{%s}")
              ("\\section{%s}" . "\\section*{%s}")
              ("\\subsection{%s}" . "\\subsection*{%s}")
              ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
              ("\\paragraph{%s}" . "\\paragraph*{%s}")
              ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

org-ref and reftex package

For easy references and bibliographies

(use-package reftex
    :ensure t)

(use-package org-ref
    :ensure t
    :after org)

Minor fixes

Line and column numbers

(setq line-number-mode t)
(setq column-number-mode t)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)

Electric pair mode

Automatically pair matching parenthesis ()

;; electric pair mode
(electric-pair-mode t)

color code different parenthesis

;; color code parenthesis
(use-package rainbow-delimiters
  :ensure t
  :init (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
)

Scrolling behavior

Scroll 1 line at a time.

;; Change scrolling behavior
(setq scroll-conservatively 100)

Disable bell sound

;; Disable bell sound
(setq ring-bell-function 'ignore)

Highlight cursor line

  ;; Highlite cursor line and set color
  (global-hl-line-mode t)
;;  (set-face-background hl-line-face "gray25")

  ;; Highlight only one-line in visual-line-mode
  ;; (defun highlight-visual-line ()
  ;;   (save-excursion
  ;;     (cons (progn (beginning-of-visual-line) (point))
  ;;           (progn (end-of-visual-line) (point)))))

(setq hl-line-range-function
      (lambda()
         (save-excursion
           (cons
            (progn
              (beginning-of-visual-line)
              (point))
            (progn
              (beginning-of-visual-line 2)
              (point))))))

;;  (setq hl-line-range-function 'highlight-visual-line)

Disable auto-indent mode(electric indent mode)

;; disable auto-indent mode
(when (fboundp 'electric-indent-mode) (electric-indent-mode -1))

Disable emacs startup screen

;; Disable startup screen.
(setq inhibit-startup-screen t)

Enable ibuffer

;; enable ibuffer
(global-set-key (kbd "C-x C-b") 'ibuffer)

Follow window splits

Make cursor go to new window after a split

(defun split-and-follow-horizontally ()
  (interactive)
  (split-window-below)
  (balance-windows)
  (other-window 1))
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally)

(defun split-and-follow-vertically ()
  (interactive)
  (split-window-right)
  (balance-windows)
  (other-window 1))
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically)

Highlight matching parentheses

(show-paren-mode 1)
;; (set-face-background 'show-paren-match "grey40")

Change ‘yes-or-no’ to ‘y-or-n’

(defalias 'yes-or-no-p 'y-or-n-p)

Enable system clock in emacs

(display-time-mode 1)

Make bash shell the default bash in ansi-term

(defvar my-term-shell "/bin/bash")
(defadvice ansi-term (before force-bash)
  (interactive (list my-term-shell)))
(ad-activate 'ansi-term)

;; Set shortcut
(global-set-key (kbd "C-x t b") 'ansi-term)

Quickly visit configuration file

(defun config-visit ()
  (interactive)
  (find-file "~/.emacs.d/config.org"))
(global-set-key (kbd "C-c e") 'config-visit)

Beacon Mode

Cursor flashes briefly when new window is opened

;; (use-package beacon
;;   :ensure t
;;   :config
;;     (beacon-mode 1))

Hungry delete

This deletes all empty space. Tried it for a while. Did not like it.

;; (use-package hungry-delete
;;   :ensure t
;;   :config
;;     (global-hungry-delete-mode))

Shift Select

This should work in all modes, including org-mode. Must be in insert state.

(setq shift-select-mode 1)
(setq org-support-shift-select 1)

Backups in different folder

(setq backup-directory-alist '(("." . "~/EmacsBackups")))

Cursor style

(setq-default cursor-type '(bar . 3)) 

IDO-mode package (currently disabled)

This is the emacs default alternative to ivy. Disabled.

;; enable IDO mode :: alternative to ivy, below.
;; (setq ido-enable-flex-matching nil)
;; (setq ido-create-new-buffer 'always)
;; (setq ido-everywhere t)
;; (ido-mode 1)

;; ;; enable IDO vertical mode
;; (use-package ido-vertical-mode
;;   :ensure t
;;   :init (ido-vertical-mode 1))

;; ;; Enable smex : like IDO but for M-x
;; (use-package smex
;;   :ensure t
;;   :init (smex-initialize)
;;   :bind ("M-x" . smex)
;; )

IVY and swiper

For completion of file and buffer selection, etc....

swiper is a better search package (C-s)

;; Ivy for completion. 
(use-package ivy
  :ensure t
  :config (ivy-mode 1)
)

;; swiper for faster search
(use-package swiper
  :ensure t
  :bind (
  ("C-r" . swiper-isearch-backward)
  ("C-s" . swiper))
)

Flyspell (spellcheck) and Flycheck (syntax check)

(use-package flyspell
   :ensure t
   :hook 
   (org-mode . flyspell-mode)
;;   (prog-mode . flyspell-prog-mode)     
)

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

;; (add-hook 'after-init-hook #'global-flycheck-mode)


(add-hook 'f90-mode-hook
      (lambda ()
        (make-local-variable 'flycheck-gfortran-language-standard)
        (setq flycheck-gfortran-language-standard "f95")))

(add-hook 'fortran-mode-hook
      (lambda ()
        (make-local-variable 'flycheck-gfortran-language-standard)
        (setq flycheck-gfortran-language-standard "legacy")))

Company Mode

(use-package company
   :ensure t
   :config
   (setq company-idle-delay 0)
  (setq company-minimum-prefix-length 3)
)

(global-company-mode t)
(global-set-key (kbd "C-M-l") 'company-complete)

Better window switching

Two options here: ace-window and switch-window

Ace-window

(use-package ace-window
   :ensure t
   :bind ("M-o" . ace-window)
   :delight
   :config (ace-window-display-mode 1)
   )

Switch-window

;; (use-package switch-window
;;   :ensure t
;;   :config
;;     (setq switch-window-input-style 'minibuffer)
;;     (setq switch-window-increase 4)
;;     (setq switch-window-threshold 2)
;;     (setq switch-window-shortcut-style 'qwerty)
;;     (setq switch-window-qwerty-shortcuts
;;         '("a" "s" "d" "f" "j" "k" "l" "i" "o"))
;;   :bind
;;     ([remap other-window] . switch-window))

Programing specifics

Fortran

GAMESS uses src for F77 files.

(add-to-list 'auto-mode-alist '("\\.src\\'" . fortran-mode))

;; setup files with .f90 to be read as f90
(add-to-list 'auto-mode-alist '("\\.f90\\'" . f90-mode))
(add-to-list 'auto-mode-alist '("\\.F90\\'" . f90-mode))

General Package

The general package adds space leader key style keybindings.

Taken from https://github.com/suyashbire1/emacs.d/blob/master/init.el

  (use-package general
    :ensure t
    :after which-key
    :config
    (general-override-mode 1)

    (defun find-user-init-file ()
      "Edit the `user-init-file', in same window."
      (interactive)
      (find-file user-init-file))
    (defun load-user-init-file ()
      "Load the `user-init-file', in same window."
      (interactive)
      (load-file user-init-file))

    ;;Taken from http://emacsredux.com/blog/2013/05/04/rename-file-and-buffer/
    (defun rename-file-and-buffer ()
      "Rename the current buffer and file it is visiting."
      (interactive)
      (let ((filename (buffer-file-name)))
        (if (not (and filename (file-exists-p filename)))
            (message "Buffer is not visiting a file!")
          (let ((new-name (read-file-name "New name: " filename)))
            (cond
             ((vc-backend filename) (vc-rename-file filename new-name))
             (t
              (rename-file filename new-name t)
              (set-visited-file-name new-name t t)))))))


    (defun disable-all-themes ()
      "disable all active themes."
      (dolist (i custom-enabled-themes)
        (disable-theme i)))

    (defadvice load-theme (before disable-themes-first activate)
      (disable-all-themes))

    ;; Following lines to cycle through themes adapted from ivan's answer on
    ;; https://emacs.stackexchange.com/questions/24088/make-a-function-to-toggle-themes
    (setq my/themes (custom-available-themes))
    (setq my/themes-index 0)

    (defun my/cycle-theme ()
      "Cycles through my themes."
      (interactive)
      (setq my/themes-index (% (1+ my/themes-index) (length my/themes)))
      (my/load-indexed-theme))

    (defun my/load-indexed-theme ()
      (load-theme (nth my/themes-index my/themes)))

    (defun load-leuven-theme ()
      "Loads `leuven' theme"
      (interactive)
      (load-theme 'leuven))

    (defun load-dichromacy-theme ()
      "Loads `dichromacy' theme"
      (interactive)
      (load-theme 'dichromacy))

    (general-create-definer tyrant-def
;;      :states '(normal visual insert motion emacs)
      :prefix "M-m"
;;      :non-normal-prefix "M-m"
     )

    (general-create-definer despot-def
;;      :states '(normal insert emacs)
      :prefix "M-m"
;;      :non-normal-prefix "M-m"
     )

    ;; (general-define-key
    ;;   :keymaps 'key-translation-map
    ;;   "ESC" (kbd "C-g"))

    (general-def
      "C-x x" 'eval-defun)

    (tyrant-def

      ""     nil
      "c"   (general-simulate-key "C-c")
      "h"   (general-simulate-key "C-h")
      "u"   (general-simulate-key "C-u")
      "x"   (general-simulate-key "C-x")
      "<SPC>" (general-simulate-key "M-x")

      ;; Package manager
      "lp"  'list-packages

      ;; Theme operations
      "t"   '(:ignore t :which-key "themes")
      "tn"  'my/cycle-theme
      "tt"  'load-theme
      "tl"  'load-leuven-theme
      "td"  'load-dichromacy-theme

      ;; Quit operations
      "q"	  '(:ignore t :which-key "quit emacs")
      "qq"  'kill-emacs
      "qz"  'delete-frame

      ;; Buffer operations
      "b"   '(:ignore t :which-key "buffer")
      "bb"  'mode-line-other-buffer
      "bd"  'kill-this-buffer
      "b]"  'next-buffer
      "b["  'previous-buffer
      "bq"  'kill-buffer-and-window
      "bR"  'rename-file-and-buffer
      "br"  'revert-buffer

      ;; Window operations
      "w"   '(:ignore t :which-key "window")
      "wm"  'maximize-window
      "w/"  'split-window-horizontally
      "wv"  'split-window-vertically
      "wm"  'maximize-window
      "wu"  'winner-undo
      "ww"  'other-window
      "wd"  'delete-window
      "wD"  'delete-other-windows

      ;; File operations
      "f"   '(:ignore t :which-key "files")
      "fc"  'write-file
      "fe"  '(:ignore t :which-key "emacs")
      "fed" 'find-user-init-file
      "feR" 'load-user-init-file
      "fj"  'dired-jump
      "fl"  'find-file-literally
      "fR"  'rename-file-and-buffer
      "fs"  'save-buffer

      ;; Applications
      "a"   '(:ignore t :which-key "Applications")
      "ad"  'dired
      ":"   'shell-command
      ";"   'eval-expression
      "ac"  'calendar
      "oa"  'org-agenda)

    ;; (general-def doc-view-mode-map
    ;;   "j"   'doc-view-next-line-or-next-page
    ;;   "k"   'doc-view-previous-line-or-previous-page
    ;;   "gg"  'doc-view-first-page
    ;;   "G"   'doc-view-last-page
    ;;   "C-d" 'doc-view-scroll-up-or-next-page
    ;;   "C-f" 'doc-view-scroll-up-or-next-page
    ;;  "C-b" 'doc-view-scroll-down-or-previous-page) 

    ;; (general-def  outline-minor-mode-map
    ;;   "zn"  'outline-next-visible-heading
    ;;   "zp"  'outline-previous-visible-heading
    ;;   "zf"  'outline-forward-same-level
    ;;   "zB"  'outline-backward-same-level)

    (general-def package-menu-mode-map
      "i"   'package-menu-mark-install
      "U"   'package-menu-mark-upgrades
      "d"   'package-menu-mark-delete
      "u"   'package-menu-mark-unmark
      "x"   'package-menu-execute
      "q"   'quit-window)

    (general-def calendar-mode-map
      "h"   'calendar-backward-day
      "j"   'calendar-forward-week
      "k"   'calendar-backward-week
      "l"   'calendar-forward-day
      "0"   'calendar-beginning-of-week
      "^"   'calendar-beginning-of-week
      "$"   'calendar-end-of-week
      "["   'calendar-backward-year
      "]"   'calendar-forward-year
      "("   'calendar-beginning-of-month
      ")"   'calendar-end-of-month
      "SPC" 'scroll-other-window
      "S-SPC" 'scroll-other-window-down
      "<delete>" 'scroll-other-window-down
      "<"   'calendar-scroll-right
      ">"   'calendar-scroll-left
      "C-b" 'calendar-scroll-right-three-months
      "C-f" 'calendar-scroll-left-three-months
      "{"   'calendar-backward-month
      "}"   'calendar-forward-month
      "C-k" 'calendar-backward-month
      "C-j" 'calendar-forward-month
      "gk"  'calendar-backward-month
      "gj"  'calendar-forward-month
      "v"   'calendar-set-mark
      "."   'calendar-goto-today
      "q"   'calendar-exit)
    )

  (use-package suggest
    :general (tyrant-def "as" 'suggest))

Dired

Set a few Dired enhancements

(setq dired-dwim-target t)

(use-package dired-narrow
:ensure t
:config
(bind-key "C-c C-n" #'dired-narrow)
(bind-key "C-c C-f" #'dired-narrow-fuzzy)
(bind-key "C-x C-N" #'dired-narrow-regexp)
)

(use-package dired-subtree :ensure t
  :after dired
  :config
  (bind-key "<tab>" #'dired-subtree-toggle dired-mode-map)
  (bind-key "<backtab>" #'dired-subtree-cycle dired-mode-map))

Treemacs

Add the treemacs package. This is a tree like navigation that appears on the side.

  (use-package treemacs
    :ensure t
    :defer t
    :init
    (with-eval-after-load 'winum
      (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
    :config
    (progn
      (setq treemacs-collapse-dirs                 (if treemacs-python-executable 3 0)
            treemacs-deferred-git-apply-delay      0.5
            treemacs-directory-name-transformer    #'identity
            treemacs-display-in-side-window        t
            treemacs-eldoc-display                 t
            treemacs-file-event-delay              5000
            treemacs-file-extension-regex          treemacs-last-period-regex-value
            treemacs-file-follow-delay             0.2
            treemacs-file-name-transformer         #'identity
            treemacs-follow-after-init             t
            treemacs-git-command-pipe              ""
            treemacs-goto-tag-strategy             'refetch-index
            treemacs-indentation                   2
            treemacs-indentation-string            " "
            treemacs-is-never-other-window         nil
            treemacs-max-git-entries               5000
            treemacs-missing-project-action        'ask
            treemacs-move-forward-on-expand        nil
            treemacs-no-png-images                 nil
            treemacs-no-delete-other-windows       t
            treemacs-project-follow-cleanup        nil
            treemacs-persist-file                  (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
            treemacs-position                      'left
            treemacs-recenter-distance             0.1
            treemacs-recenter-after-file-follow    nil
            treemacs-recenter-after-tag-follow     nil
            treemacs-recenter-after-project-jump   'always
            treemacs-recenter-after-project-expand 'on-distance
            treemacs-show-cursor                   nil
            treemacs-show-hidden-files             t
            treemacs-silent-filewatch              nil
            treemacs-silent-refresh                nil
            treemacs-sorting                       'alphabetic-asc
            treemacs-space-between-root-nodes      t
            treemacs-tag-follow-cleanup            t
            treemacs-tag-follow-delay              1.5
            treemacs-user-mode-line-format         nil
            treemacs-user-header-line-format       nil
            treemacs-width                         35)

      ;; The default width and height of the icons is 22 pixels. If you are
      ;; using a Hi-DPI display, uncomment this to double the icon size.
      ;;(treemacs-resize-icons 44)

      (treemacs-follow-mode t)
      (treemacs-filewatch-mode t)
      (treemacs-fringe-indicator-mode t)
      (pcase (cons (not (null (executable-find "git")))
                   (not (null treemacs-python-executable)))
        (`(t . t)
         (treemacs-git-mode 'deferred))
        (`(t . _)
         (treemacs-git-mode 'simple))))
    :bind
    (:map global-map
          ("M-0"       . treemacs-select-window)
          ("C-x t 1"   . treemacs-delete-other-windows)
          ("C-x t t"   . treemacs)
          ("C-x t B"   . treemacs-bookmark)
          ("C-x t C-t" . treemacs-find-file)
          ("C-x t M-t" . treemacs-find-tag)
;;          ([f9]        . treemacs-projectile-toggle)
          )
          )
;; (use-package treemacs-projectile
;;     :defer t
;;     :ensure t
;;     :config
;;     (setq treemacs-header-function #'treemacs-projectile-create-header)
;; )

  ;; (use-package treemacs-evil
  ;;   :after treemacs evil
  ;;   :ensure t)

  (use-package treemacs-icons-dired
    :after treemacs dired
    :ensure t
    :config (treemacs-icons-dired-mode))

Dictionary

Add dictionary

(use-package dictionary
  :ensure t)

(use-package synosaurus
  :ensure t)

LSP MODE

Add lsp-mode, especially for fortran code.

;; (setq lsp-keymap-prefix "M-l")

;; (use-package lsp-mode
;;     :ensure t
;;     :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
;;   ;;          (fortran-mode . lsp)
;;             (f90-mode . lsp)
;;             ;; if you want which-key integration
;;             (lsp-mode . lsp-enable-which-key-integration))
;;     :commands lsp)

;; (use-package lsp-ui 
;;     :ensure t
;;     :commands lsp-ui-mode)

;; ;; if you are ivy user
;; (use-package lsp-ivy 
;;     :ensure t
;;     :commands lsp-ivy-workspace-symbol)

;; (use-package lsp-treemacs 
;;     :ensure t
;;     :commands lsp-treemacs-errors-list)

Eglot

;; (use-package eglot
;;     :ensure t)

;; (add-to-list 'eglot-server-programs '(fortran-mode . ("fortls")))
;; (add-to-list 'eglot-server-programs '(f90-mode . ("fortls")))

Rigrep

(use-package deadgrep 
:ensure t)

(use-package rg
:ensure t
:commands rg)

(global-set-key (kbd "<f5>") #'deadgrep)

HTML/CSS/Web stuff

(use-package web-mode
   :ensure t
   :config 
       (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
;;       (add-to-list 'auto-mode-alist '("\\.css?\\'" . web-mode))
       (add-to-list 'auto-mode-alist '("\\.vue?\\'" . web-mode))
       (add-to-list 'auto-mode-alist '("\\.js?\\'" . web-mode))
       (setq web-mode-enable-auto-closing t)
       (setq web-mode-enable-auto-quoting t)
       (setq web-mode-enable-auto-pairing t)
       (setq web-mode-enable-auto-expanding t)
)

;; emmet mode for easy completion

(use-package emmet-mode
    :ensure t
    :config
;; Auto-start on any markup modes
    (add-hook 'sgml-mode-hook 'emmet-mode) 
;; Auto-start on any markup modes
    (add-hook 'web-mode-hook 'emmet-mode) 
;; enable Emmet's css abbreviation.
    (add-hook 'css-mode-hook  'emmet-mode) 
)

(use-package company-web
    :ensure t)
(define-key web-mode-map (kbd "C-'") 'company-web-html)

Lorem Ipsum

(use-package lorem-ipsum
    :ensure t    
    :config (lorem-ipsum-use-default-bindings)
)

nov-mode

(use-package nov
    :ensure t)

(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
(setq nov-text-width 80)

PDF-TOOLS

;; (use-package pdf-tools
;;     :ensure t
;;    :config (pdf-tools-install)
;; )

;; (use-package org-pdftools
;;    :ensure t
;;    :hook (org-load . org-pdftools-setup-link))

Openwith package

Not working as it should, so I’m gonna disable it for now.

;; (use-package openwith
;;     :ensure t
;;     :init (openwith-mode 1)
;;     :config (setq openwith-associations '(("\\.pdf\\'" "evince" (file)))))

Projectile and Dashboard

Projectile project manager.

    (use-package projectile
      :ensure t
      :bind ("C-c p" . projectile-command-map)
      :init
      (when (display-graphic-p)
      (projectile-mode 1)
      (setq projectile-completion-system 'ivy)
      )
      )

(use-package dashboard
  :ensure t
  :config
  (when (display-graphic-p)
    (dashboard-setup-startup-hook)
    (setq dashboard-items '((recents  . 5)
                            (projects . 5)))
    (setq dashboard-banner-logo-title "")))

Eloud

A text to speech package

(use-package eloud
    :ensure t
    :config (setq eloud-espeak-path "/usr/bin/espeak"))

(defun speak-my-text () "Speaks text in buffer."
  (interactive)
(if (region-active-p)
  (progn
    (kill-ring-save (region-beginning) (region-end))
      (start-process-shell-command "speakbuffvar" nil
        "bash -c \"killall espeak;xsel --clipboard|espeak -s 290\""))
  (progn
    (kill-ring-save (point-min) (point-max))
      (start-process-shell-command "speakbuffvar" nil
        "bash -c \"killall espeak;xsel --clipboard|espeak -s 290\""))))

(global-set-key (kbd "C-M-z") 'speak-my-text)