dotfiles/conf.d/emacs/emacs

727 lines
22 KiB
Plaintext
Raw Normal View History

2018-06-27 14:05:11 +00:00
;;;; .emacs --- Emacs init file
;;;; Commentary:
;;;; Code:
;; ______ ______ _____ _____ __ __ ___ _ _ _____ ___ ____
;; / ___\ \ / / ___|_ _| ____| \/ | |_ _| \ | | ___/ _ \/ ___|
;; \___ \\ V /\___ \ | | | _| | |\/| | | || \| | |_ | | | \___ \
;; ___) || | ___) || | | |___| | | | | || |\ | _|| |_| |___) |
;; |____/ |_| |____/ |_| |_____|_| |_| |___|_| \_|_| \___/|____/
;;
;; Check if system is Darwin/Mac OS X
(setq is-mac (equal system-type 'darwin))
;; Check if system is GNU/Linux
(setq is-gnu (equal system-type 'gnu/linux))
;; Check if system is desktop "saitama"
(setq is-saitama (equal (system-name) "saitama"))
;; Check if system is laptop "genos"
(setq is-genos (equal (system-name) "genos.local"))
;; Check if there's we are connected to an host given as optional parameter
(defun is-connected-to (&optional host)
"Return if we are or not connected to an HOST."
(= 0 (call-process "ping" nil nil nil "-c" "1" "-W" "1"
(if host host "www.google.fr"))))
;; ____ _ ___ ____ _ _
;; / ___| | / _ \| __ ) / \ | |
;; | | _| | | | | | _ \ / _ \ | |
;; | |_| | |__| |_| | |_) / ___ \| |___
;; \____|_____\___/|____/_/ \_\_____|
;;
;; User details
(setq user-full-name "Jeff LANCE"
2018-06-28 21:56:02 +00:00
user-mail-address "jeff.lance@mala.fr")
2018-06-27 14:05:11 +00:00
;; My directory Location
(defconst jeff/emacsd (concat (getenv "HOME") "/.emacs.d/"))
(defun my-emacssubd (d)
"Define a subdirectory named D from the ~/.emacs.d location."
(expand-file-name d jeff/emacsd))
;; Directory structure
(let* ((subdirs '("elisp" "backups"))
(fulldirs (mapcar (lambda (d) (my-emacssubd d)) subdirs)))
(dolist (dir fulldirs)
(when (not (file-exists-p dir))
(message "Make directory: %s" dir)
(make-directory dir))))
;; Setting up the Load Path
;; Packages not available in the package manager are stored in the
;; personal directory: $HOME/.emacs.d/elisp
(add-to-list 'load-path (my-emacssubd "elisp"))
;;(let ((default-directory "~/.emacs.d/elisp" ))
;; (normal-top-level-add-subdirs-to-load-path))
;; Redirect custom system config to another file
(setq custom-file (concat jeff/emacsd "custom.el"))
2018-06-28 23:30:33 +00:00
(if (file-exists-p custom-file)
(load custom-file))
2018-06-27 14:05:11 +00:00
;; Force locale environment setting as it cause an error when compile
;; LaTeX file with LuaLaTeX.
(setenv "LC_ALL" "fr_FR.UTF-8")
2018-06-28 21:56:02 +00:00
2018-06-27 14:05:11 +00:00
;; ____ _____ _ ____ _____ _ _ ____
;; / ___|_ _|/ \ | _ \_ _| | | | | _ \
;; \___ \ | | / _ \ | |_) || |_____| | | | |_) |
;; ___) || |/ ___ \| _ < | |_____| |_| | __/
;; |____/ |_/_/ \_\_| \_\|_| \___/|_|
;;
;; Splash screen
(setq inhibit-splash-screen t
2018-08-08 09:34:12 +00:00
initial-scratch-message nil
2018-06-28 21:56:02 +00:00
initial-major-mode 'org-mode)
2018-06-27 14:05:11 +00:00
;; Scroll bar, menu bar, tool bar
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
;; Marking text
(delete-selection-mode t)
(transient-mark-mode t)
(setq select-enable-clipboard t)
;; UTF-8
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(setq current-language-environment "UTF-8")
(prefer-coding-system 'utf-8)
(setenv "LC_CTYPE" "UTF-8")
;; Column and line numbers
(setq column-number-mode t
2018-08-08 09:34:12 +00:00
line-number-mode t)
2018-06-27 14:05:11 +00:00
;; Indentation
2018-08-18 15:49:30 +00:00
; tabs for indentation.
(setq-default indent-tabs-mode nil)
; tab width is 2 spaces.
(setq tab-width 2)
2018-06-27 14:05:11 +00:00
; make tab key do indent first then completion.
(setq-default tab-always-indent 'complete)
;; Paren-mode
(show-paren-mode t)
;; ____ _ ____ _ __ _ ____ _____ ____
;; | _ \ / \ / ___| |/ / / \ / ___| ____/ ___|
;; | |_) / _ \| | | ' / / _ \| | _| _| \___ \
;; | __/ ___ \ |___| . \ / ___ \ |_| | |___ ___) |
;; |_| /_/ \_\____|_|\_\/_/ \_\____|_____|____/
;;
;; Package Manager
(require 'package)
2018-08-18 17:28:24 +00:00
(setq package-archives '(("org" . "http://orgmode.org/elpa/")
2018-06-28 21:56:02 +00:00
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
2018-06-27 14:05:11 +00:00
(package-initialize)
(if (is-connected-to) (package-refresh-contents)) ; package refresh if we are connected.
;; Use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
;; AucTeX
(use-package auctex
:ensure t
:mode ("\\.tex\\'" . latex-mode)
:commands (latex-mode LaTeX-mode plain-tex-mode)
:init
2018-06-28 21:56:02 +00:00
(progn
2018-08-18 17:20:42 +00:00
(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("LatexMk Clean" "latexmk -lualatex %t && latexmk -c %t" TeX-run-command)))
2018-06-27 14:05:11 +00:00
;; (add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
;; (add-hook 'LaTeX-mode-hook #'turn-on-reftex)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-save-query nil)
(setq TeX-PDF-mode t)
2018-08-18 17:20:42 +00:00
(setq-default TeX-master nil)))
2018-06-27 14:05:11 +00:00
;; AucTeX-LaTeXmk
(use-package auctex-latexmk
:ensure t
:config
2018-06-28 21:56:02 +00:00
(auctex-latexmk-setup))
2018-06-27 14:05:11 +00:00
;; Yasnippet
;; Needed to load yasnippet before auto-complete to make them work together.
(use-package yasnippet
:ensure t
:init
2018-06-28 21:56:02 +00:00
(unless (package-installed-p 'yasnippet-snippets)
2018-06-27 14:05:11 +00:00
(package-refresh-contents)
(package-install 'yasnippet-snippets))
:config
2018-06-28 21:56:02 +00:00
(yas-global-mode 1))
2018-06-27 14:05:11 +00:00
;; Auto-complete
(use-package auto-complete
:ensure t
:config
2018-06-28 21:56:02 +00:00
(add-to-list 'ac-dictionary-directories (concat jeff/emacsd "ac-dict"))
(setq ac-comphist-file (concat jeff/emacsd "ac-comphist.dat"))
(ac-config-default)
(ac-set-trigger-key "TAB")
2018-08-18 17:20:42 +00:00
(ac-set-trigger-key "<tab>")
2018-06-28 21:56:02 +00:00
(global-auto-complete-mode t)
(auto-complete-mode))
2018-06-27 14:05:11 +00:00
;; Auto-insert
(use-package autoinsert
:init
2018-06-28 21:56:02 +00:00
(setq auto-insert-query nil)
(setq auto-insert-directory (concat jeff/emacsd "my-templates/"))
(add-hook 'find-file-hook 'auto-insert)
(auto-insert-mode 1)
2018-08-18 17:20:42 +00:00
:config
2018-06-28 21:56:02 +00:00
(define-auto-insert "\\.py" ["python.py" my-autoinsert-yas-expand])
(define-auto-insert "\\.sh" ["shellscript.sh" my-autoinsert-yas-expand])
(define-auto-insert "\\.yml" ["yaml.yml" my-autoinsert-yas-expand]))
2018-06-27 14:05:11 +00:00
;; Better-defaults
(use-package better-defaults
:ensure t)
;; Darkroom-mode
(use-package darkroom-mode
2018-06-28 21:56:02 +00:00
:load-path "elisp/darkroom-mode"
:config
2020-04-15 11:15:10 +00:00
(setq darkroom-mode-face-foreground "Monofur Nerd Font Mono 15")
2018-06-28 21:56:02 +00:00
(setq darkroom-mode-face-size 150)
(setq darkroom-mode-center-margin 150))
2018-06-27 14:05:11 +00:00
;; Deft
(use-package deft
:ensure t)
;; Dired-open
(use-package dired-open
:ensure t)
;; Ditaa
(setq org-ditaa-jar-path "/usr/bin/ditaa")
2018-06-28 22:13:33 +00:00
;; EditorConfig
(use-package editorconfig
:ensure t
:config
(editorconfig-mode 1))
2018-06-27 14:05:11 +00:00
;; Elpy
(use-package elpy
:ensure t
:config
2018-06-28 21:56:02 +00:00
(elpy-enable))
2018-06-27 14:05:11 +00:00
2020-04-15 11:15:10 +00:00
;; EMMS
(use-package emms
:ensure t
:config
(emms-all)
(emms-default-players)
(setq emms-source-file-default-directory "/mnt/diskstation1/music/"))
(use-package emms-info-mediainfo
:ensure t)
(use-package emms-state
:ensure t)
2018-06-27 14:05:11 +00:00
;; Exec-path-from-shell
(use-package exec-path-from-shell
; :if (memq window-system '(mac ns))
:ensure t
:config
2018-06-28 21:56:02 +00:00
(exec-path-from-shell-copy-env "TEXPATH")
(setq exec-path-from-shell-check-startup-files nil)
(exec-path-from-shell-initialize))
2018-06-27 14:05:11 +00:00
;; Flycheck
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
;; Iso-transl
;; Support deadkeys
(use-package iso-transl)
;; Linum
(use-package hlinum
:ensure t
:pin melpa
:config
2018-06-28 21:56:02 +00:00
(hlinum-activate)
(setq linum-format "%4d \u2502")
(setq linum-highlight-face "#bc0744")
(global-linum-mode 1))
2018-06-27 14:05:11 +00:00
;; Lua-mode
(use-package lua-mode
:ensure t
:pin melpa
:mode ("\\.lua\\'")
:config
2018-06-28 21:56:02 +00:00
(setq lua-indent-level 2))
2018-06-27 14:05:11 +00:00
;; Magit
(use-package magit
:ensure t)
;; Markdown-mode
(use-package markdown-mode
:ensure t
:commands (markdown-mode gfm-mode)
:mode (("README\\.md\\'" . gfm-mode)
2018-08-18 17:20:42 +00:00
("\\.md\\'" . markdown-mode)
2018-06-27 14:05:11 +00:00
("\\.markdown\\'" . markdown-mode))
:init
2018-06-28 21:56:02 +00:00
(setq markdown-command "multimarkdown")
(unless (package-installed-p 'markdown-preview-mode)
(package-refresh-contents)
(package-install 'markdown-preview-mode)))
2018-06-27 14:05:11 +00:00
(eval-after-load "markdown-mode"
'(defalias 'markdown-add-xhtml-header-and-footer 'my-markdown-add-xhtml-header-and-footer))
2020-04-15 11:15:10 +00:00
;; Multiple-cursors
(use-package multiple-cursors
:ensure t
:config
(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))
2018-06-27 14:05:11 +00:00
;; Neotree
(use-package neotree
:ensure t
2020-04-15 11:15:10 +00:00
:config
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
2018-06-27 14:05:11 +00:00
:init
2018-06-28 21:56:02 +00:00
(unless (package-installed-p 'all-the-icons)
(package-refresh-contents)
(package-install 'all-the-icons)
2020-04-15 11:15:10 +00:00
(all-the-icons-install-fonts)))
2018-06-27 14:05:11 +00:00
;; Org
(use-package org
:ensure t
:pin org
:mode ("\\.org\\'" . org-mode)
:init
2018-06-28 21:56:02 +00:00
(unless (package-installed-p 'org-plus-contrib)
(package-refresh-contents)
(package-install 'org-plus-contrib))
(unless (package-installed-p 'org-bullets)
(package-refresh-contents)
(package-install 'org-bullets))
(unless (package-installed-p 'org-ac)
(package-refresh-contents)
(package-install 'org-ac))
2018-06-27 14:05:11 +00:00
:config
2018-06-28 21:56:02 +00:00
(require 'ox-latex)
(require 'ob-ditaa)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
(setq org-log-done t)
(setq org-list-allow-alphabetical t)
(setq org-agenda-files (file-expand-wildcards "~/Notes/*.org"))
(setq org-tag-alist
'((:startgroup . nil)
("@TRAVAIL" . ?t)
("@MAISON" . ?m)
2018-08-18 17:20:42 +00:00
(:endgroup . nil)
2018-06-28 21:56:02 +00:00
(:startgroup . nil)
("ADMINISTRATIF" . ?a)
("COURS" . ?c)
("RECHERCHE" . ?r)
("DEV" . ?d)
("OS" . ?o)
("WWW" . ?w)
(:endgroup . nil)
(:startgroup . nil)
("EASY" . ?1)
("MEDIUM" . ?2)
("HARD" . ?3)
(:endgroup . nil)
("URGENT" . ?u)
)
2018-06-27 14:05:11 +00:00
)
2018-08-18 17:28:24 +00:00
(setq org-tags-column 80)
(setq org-startup-indented t)
(setq org-hide-leading-stars nil)
2018-06-28 21:56:02 +00:00
(org-babel-do-load-languages
'org-babel-load-languages
'((ditaa . t))) ; this line activates ditaa
(setq org-support-shift-select 'always)
(setq org-latex-compiler "lualatex")
(setq org-latex-pdf-process
'("lualatex -shell-escape -synctex=1 -interaction nonstopmode %f"
"lualatex -shell-escape -synctex=1 -interaction nonstopmode %f"))
;(setq org-latex-pdf-process '("latexmk -f %f"))
(setq org-export-with-toc nil)
(add-to-list 'org-latex-classes
'("devoir"
"\\documentclass{cours_devoir}"
("\\section{%s}" . "\\section*{%s}")
2018-08-18 17:20:42 +00:00
("\\subsection{%s}" . "\\subsection*{%s}")
2018-08-08 09:34:12 +00:00
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
2018-06-28 21:56:02 +00:00
(add-to-list 'org-latex-classes
'("cours_prof"
"\\documentclass{cours_prof}"))
(add-to-list 'org-latex-classes
'("cours_beamer"
"\\documentclass{cours_beamer}")))
2018-06-27 14:05:11 +00:00
;; Pc-bufsw
(use-package pc-bufsw
:ensure t
:config
2018-06-28 21:56:02 +00:00
(pc-bufsw-default-keybindings))
2018-06-27 14:05:11 +00:00
;; Powerline
(use-package powerline
:ensure t
:config
2018-06-28 21:56:02 +00:00
(powerline-default-theme))
2018-06-27 14:05:11 +00:00
;; Rainbow-mode
(use-package rainbow-mode
:ensure t
:config
2018-06-28 21:56:02 +00:00
(rainbow-mode))
2018-06-27 14:05:11 +00:00
;; Rigid-tabs
(use-package rigid-tabs
:ensure t
:config
2018-06-28 21:56:02 +00:00
(rigid-tabs-mode))
2018-06-27 14:05:11 +00:00
;;; Rings
(use-package rings
:ensure t)
;; Smart-mode-line
(use-package smart-mode-line
:ensure t
:pin melpa
:config
2018-06-28 21:56:02 +00:00
(setq sml/theme 'dark)
(sml/setup))
2018-06-27 14:05:11 +00:00
;; Smart-tabs-mode
(use-package smart-tabs-mode
:ensure t
:config
2018-06-28 21:56:02 +00:00
(smart-tabs-add-language-support lua lua-mode-hook
((lua-indent-line . lua-basic-offset)
(lua-indent-region . lua-basic-offset)))
(smart-tabs-insinuate 'c 'c++ 'javascript 'lua 'python 'ruby))
2018-06-27 14:05:11 +00:00
;; Smartparens
(use-package smartparens
:ensure t
:pin melpa
:config
2018-06-28 21:56:02 +00:00
(smartparens-global-mode 1)
(sp-pair "$" "$") ;; latex math inline mode
(sp-pair "\[" "\]")) ;; latex math display mode
2018-06-27 14:05:11 +00:00
;; Smooth-scroll
(use-package smooth-scrolling
:ensure t
:pin melpa
:config
2018-06-28 21:56:02 +00:00
(smooth-scrolling-mode 1))
2018-06-27 14:05:11 +00:00
;; Tabbar-ruler
(use-package tabbar-ruler
:ensure t
:pin melpa
:config
2018-06-28 21:56:02 +00:00
(setq tabbar-ruler-global-tabbar t)
(setq tabbar-ruler-popup-menu t)
(setq tabbar-ruler-popup-scrollbar t))
2018-06-27 14:05:11 +00:00
;; Undo/Redo
(use-package undo-tree
:ensure t
:diminish undo-tree-mode
:init
2018-06-28 21:56:02 +00:00
(global-undo-tree-mode))
2018-06-27 14:05:11 +00:00
;; Which-key
(use-package which-key
:ensure t
:config
2018-06-28 21:56:02 +00:00
(which-key-mode))
2018-06-27 14:05:11 +00:00
;; _____ _ _ _ _ ____ _____ ___ ___ _ _ ____
;; | ___| | | | \ | |/ ___|_ _|_ _/ _ \| \ | / ___|
;; | |_ | | | | \| | | | | | | | | | \| \___ \
;; | _| | |_| | |\ | |___ | | | | |_| | |\ |___) |
;; |_| \___/|_| \_|\____| |_| |___\___/|_| \_|____/
;;
;; Generates a HTML 5 header instead of an XHTML header adds a UTF-8 charset declaration,
;; ignores markdown-content-type, markdown-coding-system and markdown-xhtml-header-content.
(defun my-markdown-add-xhtml-header-and-footer (title)
"Wrap XHTML header and footer with given TITLE around current buffer."
(goto-char (point-min))
(insert "<!DOCTYPE html5>\n"
"<html>\n"
"<head>\n<title>")
(insert title)
(insert "</title>\n")
(insert "<meta charset=\"utf-8\" />\n")
(when (> (length markdown-css-paths) 0)
(insert (mapconcat 'markdown-stylesheet-link-string markdown-css-paths "\n")))
(insert "\n</head>\n\n"
"<body>\n\n")
(goto-char (point-max))
(insert "\n"
"</body>\n"
"</html>\n"))
;; Clone current buffer to a file and switch to it.
(defun my-save-as-and-switch (filename)
"Clone the current buffer to FILENAME and switch to the clone."
(interactive "FCopy and switch to file: ")
(save-restriction
(widen)
(write-region (point-min) (point-max) filename nil nil nil 'confirm))
(find-file filename))
;; Clone current buffer to a file and don't switch to it.
(defun my-save-as-but-do-not-switch (filename)
"Clone the current buffer to FILENAME but don't switch to the clone."
(interactive "FCopy (without switching) to file:")
(write-region (point-min) (point-max) filename)
(find-file-noselect filename))
;; Clone current buffer to a file and switch or not to.
(defun my-save-as (filename)
"Prompt user whether to switch to the clone named FILENAME."
(interactive "FCopy to file: ")
(if (y-or-n-p "Switch to new file ? ")
(my-save-as-and-switch filename)
(my-save-as-but-do-not-switch filename)))
;; Insert a litteral tab when pressing TAB key.
(defun my-insert-tab-char ()
"Insert a tab char. (ASCII 9, \\t)."
(interactive)
(insert "\t"))
;; Mode-line
(defun my-add-mode-line-dirtrack ()
"Show the current directory in the mode line."
(add-to-list 'mode-line-buffer-identification
2018-08-18 17:20:42 +00:00
'(:propertize (" " default-directory " ") face dired-directory)))
2018-06-27 14:05:11 +00:00
;; Enable some minor modes
(defun my-enable-minor-modes ()
"Enables several minor modes."
(interactive "")
2018-06-28 21:56:02 +00:00
(define-globalized-minor-mode real-global-auto-complete-mode
2018-06-27 14:05:11 +00:00
auto-complete-mode (lambda ()
(if (not (minibufferp (current-buffer)))
(auto-complete-mode 1))))
(real-global-auto-complete-mode t)
(font-lock-mode 1)
(my-add-mode-line-dirtrack)
(rainbow-mode 1))
;; Insert date
(defun my-insert-date (prefix)
"Insert the current date.
With prefix-argument, use ISO format.
With two PREFIX arguments, write out the day and month name."
(interactive "P")
(let ((format (cond
((not prefix) "%d/%m/%Y")
((equal prefix '(4)) "%Y-%m-%d")
((equal prefix '(16)) "%A, %d. %B %Y")))
(system-time-locale "fr_FR"))
(insert (format-time-string format))))
;; Insert comment title for LaTeX source
(defun my-insert-comment-title (string)
"Insert STRING as a comment title for LaTeX sources."
(interactive "sComment title: ")
(insert (format "%%\n%%\n%% %s\n%%\n%%\n" string)))
;; Combining YAs and auto-insert
(defun my-autoinsert-yas-expand()
"Replace text in yasnippet template."
(yas-expand-snippet (buffer-string) (point-min) (point-max)))
2020-04-15 11:15:10 +00:00
;; Cycling between themes
(defun my-theme-set-default () ; Set the first row
(interactive)
(setq theme-current my-color-themes)
(load-theme (car theme-current) t))
(defun my-describe-theme () ; Show the current theme
(interactive)
(message "%s" (car theme-current)))
; Set the next theme (fixed by Chris Webber - tanks)
(defun my-theme-cycle ()
(interactive)
(setq theme-current (cdr theme-current))
(if (null theme-current)
(setq theme-current my-color-themes))
(load-theme (car theme-current) t)
(message "%S" (car theme-current)))
;; Transparency function
;; Set transparency of emacs
(defun transparency (value)
"Sets the transparency of the frame window. 0=transparent/100=opaque"
(interactive "nTransparency Value 0 - 100 opaque:")
(set-frame-parameter (selected-frame) 'alpha value))
2018-06-27 14:05:11 +00:00
;; _ _________ ______ ___ _ _ ____ ___ _ _ ____ ____
;; | |/ / ____\ \ / / __ )_ _| \ | | _ \_ _| \ | |/ ___/ ___|
;; | ' /| _| \ V /| _ \| || \| | | | | || \| | | _\___ \
;; | . \| |___ | | | |_) | || |\ | |_| | || |\ | |_| |___) |
;; |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/
;; CUA-Mode : ctrl-v, ctrl-z, ctrl-x
(cua-mode)
;; Reload-buffer
(global-set-key (kbd "<C-f5>") 'eval-buffer)
;; Distraction-free mode
(global-set-key (kbd "<C-f11>") 'darkroom-mode)
2020-04-15 11:15:10 +00:00
;; Cycling themes
(global-set-key (kbd "<f12>") 'my-theme-cycle)
2018-06-27 14:05:11 +00:00
;; Save-as and switch or not to cloned buffer
(global-set-key (kbd "C-x c") 'my-save-as)
;; Magit status
(global-set-key (kbd "C-x g") 'magit-status)
;; Neotree
(global-set-key (kbd "<f8>") 'neotree-toggle)
;; Org-mode
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cs" 'org-iswitchb)
(global-set-key "\C-ct" 'org-set-tags-command)
;; Pc-bufsw
(global-set-key (kbd "<C-next>") 'pc-bufsw-mru)
(global-set-key (kbd "<C-prior>") 'pc-bufsw-lru)
;; Rings
(global-set-key (kbd "<f2>") (rings-generate-cycler 2))
(global-set-key (kbd "C-<f2>") (rings-generate-setter 2))
(global-set-key (kbd "<f3>") (rings-generate-cycler 3))
(global-set-key (kbd "C-<f3>") (rings-generate-setter 3))
(global-set-key (kbd "<f4>") (rings-generate-cycler 4))
(global-set-key (kbd "C-<f4>") (rings-generate-setter 4))
;; Tab
(global-set-key (kbd "TAB") 'my-insert-tab-char) ; same as Ctrl+i
;; Tabbar-ruler
(global-set-key (kbd "C-<prior>") 'tabbar-ruler-backward)
(global-set-key (kbd "C-<next>") 'tabbar-ruler-forward)
;; Insert date
(global-set-key (kbd "C-c d") 'insert-date)
;; ___ _ _ _____ _____ ____ _____ _ ____ _____
;; |_ _| \ | |_ _| ____| _ \| ___/ \ / ___| ____|
;; | || \| | | | | _| | |_) | |_ / _ \| | | _|
;; | || |\ | | | | |___| _ <| _/ ___ \ |___| |___
;; |___|_| \_| |_| |_____|_| \_\_|/_/ \_\____|_____|
;;
;; Theme
2020-04-15 11:15:10 +00:00
(use-package alect-themes
:ensure t
:config
(alect-set-color 'dark 'fg "#FFFFFF")
(alect-set-color 'dark 'gray "#A1A8B9")
(alect-set-color 'dark 'bg "#000000")
(alect-set-color 'dark 'bg-1 "#0F1318")
(alect-set-color 'dark 'blue "#81A1C1")
(alect-set-color 'dark 'green "#A3BE8C")
(alect-set-color 'dark 'magenta "#BF616A")
(alect-set-color 'dark 'red "#B48EAD")
(alect-set-color 'dark 'yellow "#EBCB8B")
(setq alect-overriding-faces
'((alect-prompt ((t :foreground blue :weight bold)))
(font-lock-string-face ((t :foreground green-1)))
(font-lock-doc-face ((t :inherit font-lock-string-face)))
(font-lock-comment-face ((t :foreground gray)))
(mode-line-buffer-id ((t :foreground "yellow" :weight bold)))
(mode-line ((((background light))
:foreground fg+1 :background "#ffaaaa"
:box (:line-width 2 :color bg-2 :style nil))
(((background dark))
:foreground fg+1 :background "firebrick3"
:box (:line-width 2 :color bg-2 :style nil)))))))
(use-package arc-dark-theme
:ensure t)
(use-package atom-dark-theme
:ensure t)
2018-06-27 14:05:11 +00:00
(use-package dracula-theme
:ensure t)
2020-04-15 11:15:10 +00:00
(use-package exotica-theme
:ensure t)
(use-package madhat2r-theme
:ensure t)
2018-06-27 14:05:11 +00:00
(use-package melancholy-theme
:ensure t)
2018-08-18 15:49:30 +00:00
(use-package org-beautify-theme
:ensure t)
2018-06-27 14:05:11 +00:00
(use-package sourcerer-theme
:ensure t)
2020-04-15 11:15:10 +00:00
(setq my-color-themes (list 'alect-dark 'arc-dark 'atom-dark
'dracula 'exotica 'madhat2r
'melancholy 'org-beautify 'sourcerer))
(setq theme-current my-color-themes)
(setq color-theme-is-global nil) ; Initialization
(my-theme-set-default)
2018-06-27 14:05:11 +00:00
;; Set minor modes
(add-hook 'c-mode-hook 'my-enable-minor-modes)
(add-hook 'emacs-lisp-mode-hook 'my-enable-minor-modes)
(add-hook 'latex-mode-hook 'my-enable-minor-modes)
(add-hook 'lua-mode-hook 'my-enable-minor-modes)
(add-hook 'org-mode-hook 'my-enable-minor-modes)
2018-08-18 15:49:30 +00:00
(add-hook 'org-mode-hook (lambda() (load-theme 'org-beautify)))
2018-06-27 14:05:11 +00:00
(add-hook 'shell-mode-hook 'my-enable-minor-modes)
(add-hook 'text-mode-hook 'my-enable-minor-modes)
;; Depends on host
2020-04-15 11:15:10 +00:00
(set-frame-font "Monofur Nerd Font Mono 14") ;default font if not customized for host
2018-06-27 14:05:11 +00:00
(cond
2020-04-15 11:15:10 +00:00
(is-saitama (set-frame-font "Monofur Nerd Font Mono 14"))
(is-genos (set-frame-font "Monofur Nerd Font Mono 14") ;change font size on laptop
2018-06-27 14:05:11 +00:00
(display-battery-mode 1) ;battery status
))
(provide '.emacs)
;;; .emacs ends here