made .emacs work everywhere

master
Rostyslav Hnatyshyn (Student) 3 years ago
parent 5eef6017db
commit 070fbe7a6b
  1. 2
      bashrc
  2. 81
      emacs
  3. 76
      emacs~

@ -8,7 +8,7 @@ if [[ -f ~/.bash_home ]]; then
. ~/.bash_home . ~/.bash_home
fi fi
alias emacs='emacsclient -ct' #alias emacs='emacsclient -ct'
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias diff='diff --color=auto' alias diff='diff --color=auto'
alias grep='grep --color=auto' alias grep='grep --color=auto'

81
emacs

@ -1,29 +1,36 @@
(require 'package) (require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(eval-when-compile
(require 'use-package))
;list the packages you want
(setq package-list '(rustic calfw multiple-cursors transient magit restart-emacs dashboard simpleclip auctex company eglot centaur-tabs telephone-line rainbow-delimiters smex format-all flycheck neotree rainbow-mode use-package))
; list the repositories containing them
(setq package-archives '(("elpa" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
; activate all the packages (in particular autoloads) (add-to-list 'package-archives '("elpa" . "http://tromey.com/elpa/") t)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-initialize) (package-initialize)
; fetch the list of packages available (eval-when-compile
(unless package-archive-contents (require 'use-package))
(package-refresh-contents))
; install the missing packages (setq package-check-signature nil)
(dolist (package package-list) (defun ensure-package-installed (&rest packages)
(unless (package-installed-p package) "Assure every package is installed, ask for installation if it’s not.
(package-install package)))
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 'smex 'magit `centaur-tabs `eglot `telephone-line `dashboard `multiple-cursors `flycheck `which-key `restart-emacs `doom-themes `rainbow-delimiters `neotree `all-the-icons)
(package-initialize)
(use-package company) (use-package company)
(add-hook 'after-init-hook 'global-company-mode) (add-hook 'after-init-hook 'global-company-mode)
@ -32,9 +39,6 @@
(add-hook 'c++-mode-hook 'eglot-ensure) (add-hook 'c++-mode-hook 'eglot-ensure)
(add-hook 'c-mode-hook 'eglot-ensure) (add-hook 'c-mode-hook 'eglot-ensure)
(use-package rustic :init
(setq rustic-lsp-client 'eglot))
(use-package centaur-tabs :init (use-package centaur-tabs :init
(setq centaur-tabs-enable-key-bindings t (setq centaur-tabs-enable-key-bindings t
centaur-tabs-set-icons t centaur-tabs-set-icons t
@ -42,8 +46,10 @@
centaur-tabs-style "chamfer")) centaur-tabs-style "chamfer"))
(centaur-tabs-headline-match) (centaur-tabs-headline-match)
(centaur-tabs-mode 1) (centaur-tabs-mode 1)
(add-hook 'after-init-hook #'global-flycheck-mode) (add-hook 'after-init-hook #'global-flycheck-mode)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode) (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(global-set-key (kbd "M-x") 'smex) (global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands) (global-set-key (kbd "M-X") 'smex-major-mode-commands)
@ -69,7 +75,32 @@
(global-set-key (kbd "C->") 'mc/mark-next-like-this) (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-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(scroll-bar-mode -1)
(cond ((file-exists-p "~/.emacs_home.el") (load "~/.emacs_home.el"))) (menu-bar-mode -1)
(toggle-scroll-bar -1)
(tool-bar-mode -1)
(require `neotree)
(global-set-key [f8] `neotree-toggle)
;;(cond ((file-exists-p "~/.emacs_home.el") (load "~/.emacs_home.el")))
;;; .emacs ends here ;;; .emacs ends here
(custom-set-variables
;; custom-set-variables 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.
'(custom-enabled-themes (quote (doom-wilmersdorf)))
'(custom-safe-themes
(quote
("a6e620c9decbea9cac46ea47541b31b3e20804a4646ca6da4cce105ee03e8d0e" "a9a67b318b7417adbedaab02f05fa679973e9718d9d26075c6235b1f0db703c8" default)))
'(package-selected-packages
(quote
(restart-emacs which-key flycheck use-package telephone-line smex multiple-cursors magit eglot dashboard company centaur-tabs))))
(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.
)

@ -0,0 +1,76 @@
(require 'package)
;;(eval-when-compile
;; (require 'use-package))
(setq package-check-signature nil)
;list the packages you want
(setq package-list '(multiple-cursors transient magit restart-emacs dashboard simpleclip auctex company eglot centaur-tabs telephone-line rainbow-delimiters smex format-all flycheck neotree rainbow-mode use-package))
; activate all the packages (in particular autoloads)
(package-initialize)
; list the repositories containing them
(setq package-archives '(("elpa" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
; fetch the list of packages available
(unless package-archive-contents
(package-refresh-contents))
; install the missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
(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 rustic :init
;; (setq rustic-lsp-client 'eglot))
(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-headline-match)
(centaur-tabs-mode 1)
(add-hook 'after-init-hook #'global-flycheck-mode)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
(require 'telephone-line)
(telephone-line-mode 1)
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
(setq-default cursor-type 'bar)
(setq backup-directory-alist '(("" . "~/.emacs.d/backup")))
(which-key-mode)
(use-package dashboard
:ensure t
:config (dashboard-setup-startup-hook)
(setq dashboard-set-footer nil
dashboard-org-agenda-categories '("Tasks" "appointments")))
(setq interprogram-cut-function nil)
(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)
(scroll-bar-mode -1)
(cond ((file-exists-p "~/.emacs_home.el") (load "~/.emacs_home.el")))
;;; .emacs ends here
Loading…
Cancel
Save