emacs-config/init.org.d/50-ui.org

5.4 KiB

UI Configurations

Intro

this file/section configures the UI settings

Toolbar and Scrollbar

removing this stuff makes emacs looks more cleaner

  (tool-bar-mode -1)
  (menu-bar-mode -1)
  (scroll-bar-mode -1)

Maximize

Start emacs as a maximized window at start

  ;; (add-hook 'window-setup-hook 'toggle-frame-maximized t)

Window Size

Set the default window size when making a new frame

  (defun set-window-size ()
    (add-to-list 'default-frame-alist '(width . 80))
    (add-to-list 'default-frame-alist '(height . 40))
    (add-to-list 'initial-frame-alist '(width . 80))
    (add-to-list 'initial-frame-alist '(height . 40)))

run the function at startup of a frame

    (when (display-graphic-p)
      (set-window-size))
    (add-hook 'before-make-frame-hook 'set-window-size)

80 Column Line with fill-column-indicator

  (when (> emacs-major-version 27)    
    (add-hook 'text-mode-hook #'display-fill-column-indicator-mode)
    (add-hook 'prog-mode-hook #'display-fill-column-indicator-mode))

Cursor Shape

The most visible type of cursor shape

	(setq-default cursor-type 'box)

Tab Size

sets the tab size 5 spaces

  (let ((custom-tab-size 5))
    (setq-default default-tab-width custom-tab-size
                  tab-width custom-tab-size
                  c-basic-offset custom-tab-size))

Line Highlight

Highlights the current line

  (global-hl-line-mode 1)

Indentation guides

  (use-package highlight-indent-guides
    :hook (prog-mode . highlight-indent-guides-mode))
    ;; :custom
    ;; (highlight-indent-guides-method 'character "set the guide style to a bitmap picture")
    ;; (highlight-indent-guides-character "│" "set the guide character to a horizontal line")
    ;; (highlight-indent-guides-auto-enabled nil)
    ;; :config
    ;; (set-face-foreground 'highlight-indent-guides-character-face (face-foreground 'fill-column-indicator)))

Matching Pairs

Highlight

highlight matching pairs of parenthesis, and other characters

  (show-paren-mode 1)

Electric-pair-mode

Automatically pair parentheses, and other characters, built in on emacs

  (electric-pair-mode 1)

Clock/Time in Modeline

currently unused

  ;; (display-time-mode)

Focus on Hover

  (setq mouse-autoselect-window t)

Ligatures

  ;; (when (> emacs-major-version 28)
  ;;   (use-package ligature
  ;;     :config
  ;;     ;; Enable the "www" ligature in every possible major mode
  ;;     (ligature-set-ligatures 't '("www"))
  ;;     ;; Enable traditional ligature support in eww-mode, if the
  ;;     ;; `variable-pitch' face supports it
  ;;     (ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi"))
  ;;     ;; Enable all ligatures in programming modes
  ;;     (ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
  ;;                                          ":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
  ;;                                          "!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
  ;;                                          "<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
  ;;                                          "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
  ;;                                          "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
  ;;                                          "~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
  ;;                                          "[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
  ;;                                          ">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
  ;;                                          "<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
  ;;                                          "##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
  ;;                                          "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
  ;;                                          "\\\\" "://"))
  ;;     ;; Enables ligature checks globally in all buffers. You can also do it
  ;;     ;; per mode with `ligature-mode'.
  ;;     (global-ligature-mode t)))

Theme

Load theme (that is built-in)

  (load-theme 'modus-vivendi t)
  ;; (use-package solarized-theme
  ;;   :config
  ;;   (load-theme 'solarized-selenized-black))

Fringes

Fringes are the small gap at the side of emacs.

  (fringe-mode '(12 . 6))

Line numbers

Turn on line numbers in text mode/code modes.

  (add-hook 'term-mode-hook (lambda () (display-line-numbers-mode -1)))
  (add-hook 'text-mode-hook 'display-line-numbers-mode)
  (add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode)
  (add-hook 'prog-mode-hook 'display-line-numbers-mode)

Welcome Screen

Having a blank screen at the start is much more simpler and better

  (setq inhibit-startup-screen t)