;; init.el ;;; Code: (require 'package) (add-to-list 'load-path "~/dotfiles/.emacs.d/snippets") (add-to-list 'load-path "~/.guix-profile/share/emacs/site-lisp") (add-to-list 'load-path "~/dotfiles") (setq custom-file (concat user-emacs-directory "/custom.el")) (guix-emacs-autoload-packages) (setq package-archives '(("melpa" . "https://melpa.org/packages/") ("org" . "https://orgmode.org/elpa/") ("elpa" . "https://elpa.gnu.org/packages/"))) (setq browse-url-browser-function 'eww-browse-url) (package-initialize) (unless package-archive-contents (package-refresh-contents)) ;; Request some packages: (defconst my-package-list '(org-snooze all-the-icons dashboard general doom-themes doom-modeline counsel which-key ivy ivy-rich all-the-icons-ivy-rich helpful org org-modern visual-fill-column rainbow-delimiters flycheck lsp-mode lsp-ui json-mode rjsx-mode typescript-mode python-mode pyvenv company company-box magit elfeed elfeed-goodies eshell multi-vterm paredit corfu monkeytype sudo-edit exwm exwm-mff exwm-firefox-core consult alsamixer simple-httpd circe eshell-syntax-highlighting pdf-tools mastodon) "List of my favorite packages") (defvar my-missing-packages '() "List populated at each startup that contains the list of packages that need to be installed.") (dolist (p my-package-list) (when (not (package-installed-p p)) (add-to-list 'my-missing-packages p))) (when my-missing-packages (message "Emacs is now refreshing its package database...") (package-refresh-contents) ;; Install the missing packages (dolist (p my-missing-packages) (message "Installing `%s' .." p) (package-install p)) (setq my-missing-packages '())) (unless (package-installed-p 'use-package) (package-install 'use-package)) (require 'use-package) (setq use-package-always-ensure t) (load "functions.el") (load "keys.el") (load "all-the-icons-dired.el") (load "secret") (load "exwm-holyK-firefox") (load-file custom-file) ;; Load custom.el ;; if you are using guix, emacs-exwm will look for ~/.exwm.el ;; in case we are not using guix we are gonna load it anyway here, just to get the ;; transperancy and other modifications (load ".exwm") (setq inhibit-startup-message nil) (defvar apollo/default-font-size 130) (set-face-attribute 'default nil :font "JetBrains Mono" :height 130) (add-hook 'dired-mode-hook 'all-the-icons-dired-mode) (scroll-bar-mode -1) (tool-bar-mode -1) (tooltip-mode -1) (set-fringe-mode 10) (menu-bar-mode -1) (blink-cursor-mode -1) (menu-bar--visual-line-mode-enable) ;;Visible bell (setq visible-bell t) (column-number-mode) (global-display-line-numbers-mode 0) (menu-bar--display-line-numbers-mode-relative) ;;Disable line numbers for some modes (dolist (mode '(pdf-view-mode-hook org-mode-hook term-mode-hook shell-mode-hook eshell-mode-hook vterm-mode-hook elfeed)) (add-hook mode (lambda () (display-line-numbers-mode 0)))) (set-face-attribute 'default nil :font "JetBrains Mono" :height apollo/default-font-size) (set-face-attribute 'fixed-pitch nil :font "JetBrains Mono" :height apollo/default-font-size) (set-face-attribute 'variable-pitch nil :font "JetBrains Mono" :height apollo/default-font-size :weight 'regular) ;; Dashboard settings (require 'dashboard) (dashboard-setup-startup-hook) (setq dashboard-items '((recents . 5) (bookmarks . 5))) (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) (setq dashboard-item-names '(("Recent Files:" . "Recent Files:") ("Bookmarks:" . "Study:"))) ;; Set the banner (setq dashboard-startup-banner "~/dotfiles/pictures/medicine/plague-doctor-s.png") ;; Set the title (setq dashboard-banner-logo-title "Is that a flying flower?") ;; (setq dashboard-init-info "Bring me your sick and wounded!") ;; Content is not centered by default. To center, set (setq dashboard-set-init-info t) (setq dashboard-center-content t) (setq dashboard-set-navigator t) (setq dashboard-set-heading-icons t) (setq dashboard-set-file-icons t) (setq dashboard-show-shortcuts nil) (setq dashboard-set-footer t) (setq dashboard-footer-messages '("Welcome to the Church Of Emacs")) (setq dashboard-footer-icon (all-the-icons-octicon "broadcast" :height 1.15 :v-adjust -0.05 :face 'font-lock-keyword-face)) (defvar eshell-path-env (getenv "~/.local/bin")) (load-theme 'doom-ayu-dark t) (doom-modeline-mode 1) (setq doom-modeline-height 35) ;; (use-package counsel ;; :bind (("C-M-j" . 'counsel-switch-buffer) ;; :map minibuffer-local-map ;; ("C-r" . 'counsel-minibuffer-history) ;; ("C-'" . 'counsel-find-file)) ;; :config ;; (counsel-mode 1)) (which-key-mode) (setq which-key-idle-delay 0.5) (use-package ivy :diminish :bind (("C-s" . swiper) :map ivy-minibuffer-map ("TAB" . ivy-alt-done) ("C-l" . ivy-alt-done) ("C-j" . ivy-next-line) ("C-k" . ivy-previous-line) :map ivy-switch-buffer-map ("C-k" . ivy-previous-line) ("C-l" . ivy-done) ("C-d" . ivy-switch-buffer-kill) :map ivy-reverse-i-search-map ("C-k" . ivy-previous-line) ("C-d" . ivy-reverse-i-search-kill)) :config (ivy-mode 1)) (ivy-rich-mode 1) (all-the-icons-ivy-rich-mode 1) (use-package helpful :custom (counsel-describe-function-function #'helpful-callable) (counsel-describe-variable-function #'helpful-variable) :bind ([remap describe-function] . counsel-describe-function) ([remap describe-command] . helpful-command) ([remap describe-variable] . counsel-describe-variable) ([remap describe-key] . helpful-key)) ;; (use-package smart-cursor-color ;; :config ;; (smart-cursor-color-mode -1)) ;; Make ESC quit prompts (global-set-key (kbd "") 'keyboard-escape-quit) (define-prefix-command 'window) ;;; Developer ;;Essentials (electric-pair-mode 1) (setq sgml-quick-keys 'close) ;;emacs-lisp (setq tab-always-indent 'complete) (add-to-list 'completion-styles 'initials t) (add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode) (add-hook 'scheme-mode-hook #'rainbow-delimiters-mode) ;;instal flyckeck (global-flycheck-mode) ;;Enable globally ;;setup lsp-mode (defun apollo/lsp-mode-setup () (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols)) (lsp-headerline-breadcrumb-mode)) (use-package lsp-mode :commands (lsp lsp-deferred) :hook (lsp-mode . apollo/lsp-mode-setup) :init (setq lsp-keymap-prefix "C-c l") ;; Or 'C-l', 's-l' :config (lsp-enable-which-key-integration t) (setq lsp-pyls-server-command "~/.local/bin/pylsp") ) (use-package lsp-ui :hook (lsp-mode . lsp-ui-mode) :custom (lsp-ui-doc-position 'bottom)) ;; (use-package dap-node) ;; (use-package dap-mode ;; ;; Uncomment the config below if you want all UI panes to be hidden by default! ;; ;; :custom ;; ;; (lsp-enable-dap-auto-configure nil) ;; ;; :config ;; ;; (dap-ui-mode 1) ;; :config ;; ;; Set up Node debugging ;; (require 'dap-node) ;; (dap-node-setup) ;; Automatically installs Node debug adapter if needed ;; ;; Bind `C-c l d` to `dap-hydra` for easy access ;; (general-define-key ;; :keymaps 'lsp-mode-map ;; :prefix lsp-keymap-prefix ;; "d" '(dap-hydra t :wk "debugger"))) (use-package json-mode :mode ".json" :hook (json-mode . lsp-deferred)) (use-package rjsx-mode :mode ".js" :hook (rjsx-mode . lsp-deferred) :config (defadvice js-jsx-indent-line (after js-jsx-indent-line-after-hack activate) "Workaround sgml-mode and follow airbnb component style." (save-excursion (beginning-of-line) (if (looking-at-p "^ +\/?> *$") (delete-char sgml-basic-offset))))) ;; (use-package ac-html ;; :mode ".html" ;; :hook (html-mode . lsp-deferred) ;; :config ;; (defadvice js-jsx-indent-line (after js-jsx-indent-line-after-hack activate) ;; "Workaround sgml-mode and follow airbnb component style." ;; (save-excursion ;; (beginning-of-line) ;; (if (looking-at-p "^ +\/?> *$") ;; (delete-char sgml-basic-offset))))) (use-package typescript-mode :mode ".ts'" :hook (typescript-mode .lsp-deferred) :config (setq typescript-indent-level 2)) (use-package python-mode :ensure t :mode ".py" :hook (python-mode . lsp-deferred) :custom (dap-python-debugger 'debugpy) :config (require 'dap-python)) ;;autocomplete ;;Pyenv (use-package pyvenv :config (pyvenv-mode 1)) (use-package company :after lsp-mode :hook (lsp-mode . company-mode) :bind (:map company-active-map ("" . company-complete-selection)) (:map lsp-mode-map ("" . company-indent-or-complete-common)) :custom (company-minimum-prefix-length 1) (company-idle-delay 0.0)) (use-package company-box :hook (company-mode . company-box-mode)) (use-package magit :custom (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) ;;elfeed (setq elfeed-search-feed-face ":foreground #fff :weight bold" elfeed-feeds (quote ( ("https://hackaday.com/blog/feed/" hackaday linux) ("https://opensource.com/feed" opensource linux) ("https://linux.softpedia.com/backend.xml" softpedia linux) ("https://www.thelancet.com/rssfeed/ebiom_current.xml" Lancet ebiom) ("https://www.thelancet.com/rssfeed/lancet_current.xml" Lancet lancet) ("https://www.thelancet.com/rssfeed/ebiom_online.xml" LancetOnline ebiom) ("https://www.thelancet.com/rssfeed/lancet_online.xml" LancetOnline lancet) ("https://www.thelancet.com/rssfeed/lanmic_online.xml" LancetOnline Microbiology) ("https://www.techrepublic.com/rssfeeds/topic/open-source/" techrepublic linu) ))) (elfeed-goodies/setup) (setq elfeed-goodies/entry-pane-size 0.5) ;; (use-package vterm ;; :config ;; (setq vterm-shell "/bin/zsh") ;; :bind(("C-c C-v c" . 'vterm-send-stop))) (use-package eshell :ensure t :bind (("C-c e" . 'eshell))) (add-hook 'pdf-view-mode #'pdf-isearch-minor-mode) (define-key dired-mode-map "b" 'dired-up-directory) (put 'downcase-region 'disabled nil) (put 'dired-find-alternate-file 'disabled nil) (put 'set-goal-column 'disabled nil) ;; (use-package treemacs-icons-dired ;; :config ;; (add-hook 'dired-mode-hook 'treemacs-icons-dired-mode)) (use-package sudo-edit) (defun apollo/exwm-init-hook () "Do this upon start." (display-battery-mode 0) ;;Change to 1 to display battery (setq display-time-day-and-date t) (display-time-mode 1) ;;Launch apps that will run in the background ;; (apollo/run-in-background "blueman-applet") (apollo/run-in-background "picom") ;; (apollo/run-in-background "nm-applet") (apollo/emacs-keys) (apollo/restore-wallpaper) ) (defun apollo/exwm-update-class () (exwm-workspace-rename-buffer exwm-class-name)) (use-package consult :ensure t :bind(("M-g g" . consult-goto-line))) (use-package alsamixer :ensure t) (use-package simple-httpd :ensure t) (use-package circe :ensure t :config (setq circe-network-options '(("Libera Chat" :tls t :nick "apo11o" :sasl-username "apo11o" :sasl-password libera-pass)))) (use-package eshell-syntax-highlighting :ensure t :config (eshell-syntax-highlighting-global-mode)) (use-package pdf-tools :ensure t) ;;mastodon (setq mastodon-instance-url "https://emacs.ch" mastodon-active-user "apo11o")