summary refs log tree commit diff
path: root/mixins/emacs
diff options
context:
space:
mode:
authortzlil <tzlils@protonmail.com>2023-03-05 15:11:22 +0200
committertzlil <tzlils@protonmail.com>2023-03-05 15:11:22 +0200
commit60b419fc85154d9027bd6a5861f8bb8b7d2ff880 (patch)
tree1dc6f0d007dece5b38570a544b0e093234056185 /mixins/emacs
parent37ae3fd19009e6cdc0efbe00a055b9a1173d21ea (diff)
readd swaylock 30 sec, remove some headers from caddy
Diffstat (limited to 'mixins/emacs')
-rw-r--r--mixins/emacs/default.nix33
-rw-r--r--mixins/emacs/init.el213
2 files changed, 246 insertions, 0 deletions
diff --git a/mixins/emacs/default.nix b/mixins/emacs/default.nix
new file mode 100644
index 0000000..a22523e
--- /dev/null
+++ b/mixins/emacs/default.nix
@@ -0,0 +1,33 @@
+{
+  pkgs,
+  lib,
+  config,
+  inputs,
+  ...
+}: {
+  imports = [
+    inputs.home-manager.nixosModules."home-manager"
+  ];
+  config = {
+    home-manager.users.tzlil = {
+      pkgs,
+      config,
+      nixosConfig,
+      ...
+    } @ hm: {
+      home = {
+        packages = with pkgs; [
+          
+        ];
+      };
+      services.emacs = {
+        enable = true;
+        defaultEditor = true;
+      };
+      programs.emacs = {
+        enable = true;
+        extraConfig = builtins.readFile ./init.el
+      };
+    };
+  }
+}
diff --git a/mixins/emacs/init.el b/mixins/emacs/init.el
new file mode 100644
index 0000000..c9a34b6
--- /dev/null
+++ b/mixins/emacs/init.el
@@ -0,0 +1,213 @@
+;; ---------------------      INITIALIZE       -----------------------------------------
+;; -------------------------------------------------------------------------------------
+
+;; SETUP YOUR PROXY IF NEEDED
+;; (setq url-proxy-services
+;;       '(("no_proxy" . "^\\(localhost\\|10.*\\)")
+;;         ("http" . "company.com:8080")
+;;         ("https" . "company.com:8080")))
+
+
+
+
+
+
+;; -------------------------------------------------------------------------------------
+;; ----------------------------    THEME     -------------------------------------------
+;; -------------------------------------------------------------------------------------
+
+(load-theme 'wombat)
+;; a great font: https://www.fontyukle.net/en/Monaco.ttf
+(condition-case nil
+    (set-default-font "Monaco")
+  (error nil))
+
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(default ((t (:inherit nil :stipple nil :background "#242424" :foreground "#f6f3e8" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "APPL" :family "Monaco"))))
+ '(fringe ((t (:background "#242424"))))
+ '(linum ((t (:inherit (shadow default) :background "#191919" :foreground "#505050")))))
+
+
+
+
+
+;; -------------------------------------------------------------------------------------
+;; ---------------------    ENHANCEMENTS     -------------------------------------------
+;; -------------------------------------------------------------------------------------
+
+;; remove unecessary UI
+(menu-bar-mode -1)
+(scroll-bar-mode 0)
+(tool-bar-mode 0)
+(setq visible-bell 1)
+(setq ring-bell-function 'ignore)
+
+;; startup screen
+(setq inhibit-splash-screen t)
+(setq inhibit-startup-message t)
+(setq initial-scratch-message nil)
+
+;; remove whitespace before saving
+(add-hook 'before-save-hook 'whitespace-cleanup)
+
+;; faster to quit
+(fset 'yes-or-no-p 'y-or-n-p)
+
+;; highlight selected text
+(transient-mark-mode t)
+
+;; set path
+;;(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
+;;(add-to-list 'exec-path "/usr/local/bin")
+
+;; display matching parenthesis
+(show-paren-mode 1)
+
+;; move faster up and down faster
+(global-set-key (kbd "M-n") (kbd "C-u 5 C-n"))
+(global-set-key (kbd "M-p") (kbd "C-u 5 C-p"))
+
+;; usefull stuff before saving
+(add-hook 'before-save-hook 'delete-trailing-whitespace)
+(add-hook 'before-save-hook '(lamdba () (require 'saveplace)(setq-default save-place t)))
+
+;; refresh buffers when any file change
+(global-auto-revert-mode t)
+
+;; display time
+(load "time" t t)
+(display-time)
+
+;; track recently opened file
+(recentf-mode t)
+(global-set-key (kbd "C-x C-r") 'recentf-open-files)
+(setq recentf-max-saved-items 1000)
+(setq recentf-max-menu-items 50)
+
+;; display pictures and other compressed files
+(setq auto-image-file-mode t)
+(setq auto-compression-mode t)
+
+;; line and column numbering
+(column-number-mode 1)
+(line-number-mode 1)
+
+;; code folding
+(global-set-key (kbd "C-c C-d") 'hs-hide-all)
+(global-set-key (kbd "C-c C-f") 'hs-show-all)
+(global-set-key (kbd "C-c C-c") 'hs-toggle-hiding)
+(add-hook 'prog-mode-hook #'(lambda () (hs-minor-mode t) ))
+
+;; Search using regexp
+(global-set-key "\C-s" 'isearch-forward-regexp)
+(global-set-key "\C-r" 'isearch-backward-regexp)
+
+;; Usable on OSX and windows
+;; (setq mac-command-modifier 'meta)
+;; (setq mac-option-modifier 'alt)
+;; (setq mac-right-option-modifier 'super)
+;; (setq w32-get-true-file-attributes nil)
+;; (setq vc-handled-backends nil)
+;; (remove-hook 'find-file-hooks 'vc-find-file-hook)
+
+;; scroll
+(setq scroll-step 1)
+(setq scroll-conservatively 10)
+(setq scroll-margin 7)
+(setq scroll-conservatively 5)
+
+;; indentation
+(setq-default indent-tabs-mode nil)
+(setq-default tab-width 4)
+(setq standard-indent 4)
+(setq indent-line-function 'insert-tab)
+(setq tab-width 4)
+(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 4--:--:-- --:--:-- --:--:-- 11647
+4 48 52 56 60 64 68 72 76 80))
+(setq indent-tabs-mode nil)
+
+;; disable backup files
+(setq make-backup-files nil)
+
+;; auto wraping
+(set-default 'truncate-lines t)
+(add-hook 'text-mode-hook (lambda () (setq truncate-lines nil)))
+
+;; setup ido for selecting file
+(ido-mode)
+(setq ido-enable-flex-matching t)
+(setq resize-mini-windows t)
+(add-hook 'minibuffer-setup-hook
+      (lambda () (setq truncate-lines nil)))
+(setq ido-decorations '("\n-> " "" "\n   " "\n   ..."
+            "[" "]" " [No match]" " [Matched]"
+            " [Not readable]" " [Too big]" " [Confirm]"))
+(add-to-list 'ido-ignore-buffers "*Messages*")
+(add-to-list 'ido-ignore-buffers "*Buffer*")
+(add-to-list 'ido-ignore-buffers "*ESS*")
+(add-to-list 'ido-ignore-buffers "*NeoTree*")
+(add-to-list 'ido-ignore-buffers "*Completions*")
+(add-to-list 'ido-ignore-buffers "*Help*")
+(custom-set-faces
+ '(ido-subdir ((t (:inherit 'font-lock-keyword-face))))
+ '(ido-first-match ((t (:inherit 'font-lock-comment-face))))
+ '(ido-only-match ((t (:inherit 'font-lock-comment-face)))))
+
+
+;; line wrap
+(setq linum-format "%d ")
+;;(global-linum-mode 1)
+
+;; usefull shortcuts
+(global-set-key [f3] 'comment-region)
+(global-set-key [f4] 'uncomment-region)
+(global-set-key [f5] 'eshell)
+(global-set-key [f11] 'toggle-frame-fullscreen)
+(global-set-key (kbd "C-h C-s") 'info-apropos)
+
+;; ARTIST MODE
+(eval-after-load "artist" '(define-key artist-mode-map [(down-mouse-3)] 'artist-mouse-choose-operation))
+
+;; EWW - emacs web browser
+;; (setq eww-search-prefix "https://www.google.com.au/search?q=")
+;; (setq shr-color-visible-luminance-min 78) ;; improve readability (especially for google search)
+;;(setq url-user-agent "User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7\n")
+;; (global-set-key (kbd "C-c b") 'eww)
+
+;; Setup the package manager
+;;(defun load-package-manager ()
+;;  (package-initialize)
+;;  (require 'package)
+;;  (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")))
+;;(add-hook 'after-init-hook 'load-package-manager)
+
+
+
+;; Hide left line indicator
+(setf (cdr (assq 'continuation fringe-indicator-alist))
+      '(nil nil) ;; no continuation indicators
+      ;; '(nil right-curly-arrow) ;; right indicator only
+      ;; '(left-curly-arrow nil) ;; left indicator only
+      ;; '(left-curly-arrow right-curly-arrow) ;; default
+      )
+
+
+;; Window split line
+(set-face-attribute 'vertical-border nil :foreground "#303030")
+
+
+
+;; -------------------------------------------------------------------------------------
+;; ---------------------      PLUGINS          -----------------------------------------
+;; -------------------------------------------------------------------------------------
+
+;; Our plugins configuration will leave under the conf folder, so let's load this up:
+;;(mapc
+;; (lambda(path) (load-file path))
+;; (condition-case nil
+;;     (directory-files "~/.emacs.d/conf/" t "\.el$")
+;;   (error (make-directory "~/.emacs.d/conf/"))))