You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
dotfiles/emacs

171 lines
5.1 KiB

(require 'package)
;; fixing broken emacsclient config: emacsclient --eval "(load "~/.emacs")"
(add-to-list 'package-archives '("elpa" . "https://tromey.com/elpa/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; emacs preferences
(setq-default cursor-type 'bar)
(global-hl-line-mode 1)
(toggle-scroll-bar -1)
(menu-bar-mode -1)
(tool-bar-mode -1)
(column-number-mode t)
(set-fringe-mode 10)
(setq visible-bell t)
(setq vc-handled-backends nil)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
(setq custom-file (concat user-emacs-directory "custom.el"))
(load custom-file 'noerror)
(setq interprogram-cut-function nil)
(setq backup-directory-alist '(("" . "~/.emacs.d/backup")))
(eval-when-compile
(require 'use-package))
(setq package-check-signature nil)
(defun ensure-package-installed (&rest packages)
"Assure every package is installed, ask for installation if it’s not.
Return a list of installed packages or nil for every skipped package."
(mapcar
(lambda (package)
;; (package-installed-p 'evil)
(if (package-installed-p package)
nil
(if (y-or-n-p (format "Package %s is missing. Install it? " package))
(package-install package)
package)))
packages))
;; make sure to have downloaded archive description.
;; Or use package-archive-contents as suggested by Nicolas Dudebout
(or (file-exists-p package-user-dir)
(package-refresh-contents))
(ensure-package-installed 'use-package 'ivy 'magit 'centaur-tabs 'eglot 'telephone-line 'dashboard 'multiple-cursors 'flycheck 'which-key 'restart-emacs 'doom-themes 'rainbow-mode 'rainbow-delimiters 'neotree 'all-the-icons 'elpy 'rustic 'simpleclip 'messages-are-flowing 'hl-todo 'format-all 'auctex 'counsel 'swiper 'projectile 'org-roam)
(use-package company)
(add-hook 'after-init-hook 'global-company-mode)
(use-package eglot :ensure t)
(add-hook 'c++-mode-hook 'eglot-ensure)
(add-hook 'c-mode-hook 'eglot-ensure)
(use-package centaur-tabs :init
(setq centaur-tabs-enable-key-bindings t
centaur-tabs-set-icons t
centaur-tabs-set-modified-marker t
centaur-tabs-style "chamfer"
centaur-tabs-gray-out-icons 'buffer))
(centaur-tabs-headline-match)
(centaur-tabs-mode 1)
(add-hook 'after-init-hook #'global-flycheck-mode)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(add-hook 'css-mode-hook #'rainbow-mode)
(require 'telephone-line)
(telephone-line-mode 1)
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
(require 'which-key)
(which-key-mode)
(use-package dashboard
:init
(setq dashboard-set-footer nil
dashboard-org-agenda-categories '("Tasks" "appointments")
dashboard-center-content t
dashboard-set-heading-icons t
dashboard-set-file-icons t)
:ensure t
:config (dashboard-setup-startup-hook))
(require 'multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
(use-package elpy
:ensure t
:defer t
:init
(advice-add 'python-mode :before 'elpy-enable))
(use-package ivy :ensure t
:diminish ivy-mode
:init (setq projectile-completion-system 'ivy)
:config
(ivy-mode 1)
(setq ivy-height 13)
(setq ivy-wrap t)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) "))
(use-package counsel
:ensure t
:bind*
(("M-x" . counsel-M-x)
("C-c d d" . counsel-descbinds)
("C-c s s" . counsel-ag)
("C-c s d" . counsel-ag-projectile)
("C-x C-f" . counsel-find-file)
("C-x r f" . counsel-recentf)
("C-c g g" . counsel-git)
("C-c g G" . counsel-git-grep)
("C-x l" . counsel-locate)
("C-c g s" . counsel-grep-or-swiper)
("C-M-y" . counsel-yank-pop)
("C-c C-r" . ivy-resume)
("C-c i m" . counsel-imenu)
("C-c i M" . ivy-imenu-anywhere)
("C-c d s" . describe-symbol)))
(use-package swiper
:bind*
(("C-s" . swiper)))
(setq search-default-mode #'char-fold-to-regexp)
(use-package projectile
:ensure t
:init
(projectile-mode +1)
:bind (:map projectile-mode-map
("s-p" . projectile-command-map)
("C-c p" . projectile-command-map)))
(global-hl-todo-mode 1)
;; org settings
(setq org-replace-disputed-keys t)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-enforce-todo-dependencies t)
(setq org-enforce-todo-checkbox-dependencies t)
(setq org-log-done t)
; agenda settings
(setq org-agenda-include-diary t)
(setq org-agenda-skip-scheduled-if-done t)
(setq org-agenda-skip-deadline-if-done t)
(add-hook 'diary-list-entries-hook 'diary-sort-entries t)
(cond ((file-exists-p "~/.emacs_home.el") (load "~/.emacs_home.el")))
(cond ((file-exists-p "~/.emacs_work.el") (load "~/.emacs_work.el")))
;;; .emacs ends here