Skip to content

Instantly share code, notes, and snippets.

@m-242
Created February 12, 2019 21:25
Show Gist options
  • Save m-242/4dd906237c564dd7e7d07a35f5e1b467 to your computer and use it in GitHub Desktop.
Save m-242/4dd906237c564dd7e7d07a35f5e1b467 to your computer and use it in GitHub Desktop.
;;; init.el --- My try at making a clean emacs config that fits my needs
;;; Commentary:
;;; Code:
;;; Automatic stuff
(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-safe-themes
(quote
("990267981f6466c79f4788895fdc6ea0a3de0db083a4a8f05325fc7eef2b68ff" "36c2b7efdc064944eb067e56c7ec65808a6cee0f63ce068b693fb30b110e57e5" "8683104693e1ce927ad48d13702d948131533e03c421c9ad8c4816834457e716" default)))
'(package-selected-packages
(quote
(beacon ample-zen-theme dracula-theme monokai-theme cyberpunk-theme elfeed flycheck company-jedi company-irony company neotree all-the-icons kaolin-themes auto-complete counsel which-key wich-key try use-package))))
(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.
)
;;; My stuff
;;; Small cosmetics
(setq inhibit-startup-message t)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(menu-bar-mode -1)
(when (version<= "26.0.50" emacs-version )
(global-display-line-numbers-mode))
(setq-default cursor-type 'bar)
(global-hl-line-mode t) ; Highlights the current cursor line
(defalias 'yes-or-no-p 'y-or-n-p) ;; answer yes or no by y or n
(electric-pair-mode 1) ;; auto close pair
(show-paren-mode 1) ;; show matching pair
(setq backup-directory-alist `(("." . "~/.saves")))
;;; Window keybinding stuff
(global-set-key (kbd "C-x w h") 'split-window-right)
(global-set-key (kbd "C-x w v") 'split-window-below)
(global-set-key (kbd "C-x w k") 'delete-window)
(global-set-key (kbd "C-x w o") 'delete-other-windows)
(global-set-key (kbd "C-x w <right>") 'windmove-right)
(global-set-key (kbd "C-x w <left>") 'windmove-left)
(global-set-key (kbd "C-x w <up>") 'windmove-up)
(global-set-key (kbd "C-x w <down>") 'windmove-down)
;;; Setting up package manager
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;;; Packages and configs
(use-package kaolin-themes ;; theme
:ensure t
:config
(load-theme 'kaolin-bubblegum t)
)
(use-package try ;; Try a package without really installing it
:ensure t)
(use-package which-key ;; Show a cheatsheet of keybindings when waiting after C-x
:ensure t
:config (which-key-mode)
)
(use-package swiper ;; Better search
:ensure try
:config
(progn
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(global-set-key "\C-s" 'swiper)
))
(use-package company ;; auto complete
:ensure t
:config
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2)
(global-company-mode t)
)
(use-package company-irony ;; company c/c++ completion
:ensure t
:config
(add-to-list 'company-backends 'company-irony)
)
(use-package irony ;; c/c++ completion/syntax check thanks to libclang
:ensure t
:config
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
)
(add-hook 'python-mode-hook 'my/python-mode-hook)
(use-package company-jedi ;; company python completion
:ensure t
:config
(add-hook 'python-mode-hook 'jedi:setup)
)
(defun my/python-mode-hook ()
"A function that add jedi to company's backends."
(add-to-list 'company-backends 'company-jedi))
(add-hook 'python-mode-hook 'my/python-mode-hook)
(use-package flycheck ;; syntax checking on the fly
:ensure t
:init
(global-flycheck-mode t))
(use-package neotree ;; A file manager
:ensure t
:bind (("M-n" . neotree-toggle))
)
(use-package beacon ;; highlight cursor lign when moving fast
:ensure t
:config
(beacon-mode 1)
)
(use-package elfeed
:ensure t
:config
(setq elfeed-feeds
'("https://oremacs.com/atom.xml"
"https://lord.re/index.xml"
"https://www.xkcd.com/rss.xml"
))
(global-set-key (kbd "C-x n") 'elfeed)
)
(defun elfeed-mark-all-as-read ()
"Mark all elfeed entry as read. From cestlaz's config."
(interactive)
(mark-whole-buffer)
(elfeed-search-untag-all-unread))
(use-package all-the-icons ;; bubblegum and neotree dependecy
:ensure t
)
(use-package counsel ;; a swiper dependency
:ensure t
)
;;; list of tutorials and doc I followed to configure this, in addition to the official doc
;; C'est la Z : cestlaz.github.io/stories/emacs
;; Awesome-emacs : https://github.com/emacs-tw/awesome-emacs
(provide 'init)
;;; init.el ends here
@m-242
Copy link
Author

m-242 commented Feb 12, 2019

Dl le fichier, et enregistre le sous init.el dans ton emacs.d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment