init-gui.el 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. ;;; init-gui.el --- .Emacs Configuration -*- lexical-binding: t -*-
  2. ;;; Commentary:
  3. ;;
  4. ;;; Code:
  5. ;;-----------------------
  6. ;; Remove some GUI stuff
  7. ;;-----------------------
  8. (setq use-file-dialog nil)
  9. (setq use-dialog-box nil)
  10. (setq inhibit-startup-screen t)
  11. (setq inhibit-startup-echo-area-message t)
  12. (tool-bar-mode 0)
  13. (set-scroll-bar-mode nil)
  14. (menu-bar-mode 0)
  15. (setq make-backup-files nil) ; stop creating backup~ files
  16. (setq auto-save-default nil) ; stop creating #autosave# files
  17. (setq create-lockfiles nil) ; stop creating #create-lockfiles
  18. ;; Suppressing ad-handle-definition Warnings in Emacs
  19. (setq ad-redefinition-action 'accept)
  20. ;;------------------------------
  21. ;; Core settings | UTF-8 please
  22. ;;------------------------------
  23. (set-charset-priority 'unicode)
  24. (set-language-environment "UTF-8")
  25. (set-terminal-coding-system 'utf-8) ; pretty
  26. (set-keyboard-coding-system 'utf-8) ; pretty
  27. (set-selection-coding-system 'utf-8) ; please
  28. (prefer-coding-system 'utf-8) ; with sugar on top
  29. ;;----------------------------------------------------------------------------
  30. ;; Editor configuration
  31. ;;----------------------------------------------------------------------------
  32. (setq indicate-empty-lines t)
  33. (let ((no-border '(internal-border-width . 0)))
  34. (add-to-list 'default-frame-alist no-border)
  35. (add-to-list 'initial-frame-alist no-border))
  36. (setq frame-title-format
  37. '((:eval (if (buffer-file-name)
  38. (abbreviate-file-name (buffer-file-name))
  39. "%b"))))
  40. ;; Non-zero values for `line-spacing' can mess up ansi-term and co,
  41. ;; so we zero it explicitly in those cases.
  42. (add-hook 'term-mode-hook
  43. (lambda ()
  44. (setq line-spacing 0)))
  45. ;; Font theme (Monospace, or DejaVu Sans Mono if Monospace is not
  46. ;; present)
  47. (condition-case nil
  48. (set-frame-font "Hack-9")
  49. ;; (set-frame-font "Monospace-9")
  50. ;; (set-frame-font "Anonymous Pro-10")
  51. (error (set-frame-font "DejaVu Sans Mono-10")))
  52. ;;----------------------------------------------------------------------------
  53. ;; Configure keys
  54. ;;----------------------------------------------------------------------------
  55. (global-unset-key (kbd "C-z")) ; Stops C-z from minimizing window
  56. (global-set-key (kbd "M-0") (lambda () (interactive) (modify-frame-parameters nil '((alpha . 100))))) ; M-0 standard visibility
  57. (global-set-key (kbd "s-C-+") 'sacha/increase-font-size) ; C-+ increase font size
  58. (global-set-key (kbd "s-C--") 'sacha/decrease-font-size) ; C-- decrease font size
  59. (global-set-key (kbd "<f12>") 'revert-buffer-no-confirm)
  60. (global-set-key (kbd "s-h") 'global-hl-line-mode) ; Highlight current line
  61. (global-set-key (kbd "M-c") nil) ; disable capitalize-word
  62. ;; muti-curses
  63. (global-set-key (kbd "C->") 'mc/mark-next-like-this)
  64. (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
  65. (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
  66. ;;---------------------------------------------------------------------------
  67. ;; FullScreen
  68. ;;---------------------------------------------------------------------------
  69. (defun myemacs/toggle-fullscreen ()
  70. "Return a message string if the current doc string is invalid."
  71. (interactive)
  72. (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
  73. '(2 "_NET_WM_STATE_FULLSCREEN" 0)))
  74. (global-set-key (kbd "<f11>") 'myemacs/toggle-fullscreen) ; F11 FullScreen
  75. ;;----------------------------------------------------------------------------
  76. ;; Define custom browser
  77. ;;----------------------------------------------------------------------------
  78. (setq browse-url-browser-function 'browse-url-generic
  79. browse-url-generic-program (getenv "WEB_BROWSER_APP"))
  80. ;;----------------------------------------------------------------------------
  81. ;; doas open file option
  82. ;;----------------------------------------------------------------------------
  83. (defun doas-find-file (file-name)
  84. "Like find file, but opens the file as root."
  85. (interactive "FDoas Find File: ")
  86. (let ((tramp-file-name (concat "/doas::" (expand-file-name file-name))))
  87. (find-file tramp-file-name)))
  88. ;;----------------------------------------------------------------------------
  89. ;; clock
  90. ;;----------------------------------------------------------------------------
  91. (setq display-time-day-and-date t)
  92. (display-time)
  93. (provide 'init-gui)
  94. ;; End:
  95. ;;; init-gui.el ends here