summaryrefslogtreecommitdiffstats
path: root/README.org
diff options
context:
space:
mode:
authorGearnode <bryan@frimin.fr>2020-03-18 23:06:00 +0100
committerGearnode <bryan@frimin.fr>2020-03-18 23:06:00 +0100
commit65e4448987e59f3db0c16d9fae1f047a8a5c6575 (patch)
treef10370ebed34a221d10d7bb21cf396e8afad31fb /README.org
parent3fc16e52280a049d58b95cd69db0005fa2d42bc7 (diff)
rename configuration file
Diffstat (limited to 'README.org')
-rw-r--r--README.org186
1 files changed, 186 insertions, 0 deletions
diff --git a/README.org b/README.org
new file mode 100644
index 0000000..c3ecea9
--- /dev/null
+++ b/README.org
@@ -0,0 +1,186 @@
+* Emacs configuration
+** General
+#+BEGIN_SRC emacs-lisp
+ (setq enable-local-variables nil)
+#+END_SRC
+
+*** Auto save
+#+BEGIN_SRC emacs-lisp
+ (setq make-backup-files nil)
+ (setq auto-save-default nil)
+
+ (setq desktop-path (list user-emacs-directory))
+ (setq desktop-auto-save-timeout 30)
+ (desktop-save-mode 1)
+#+END_SRC
+
+*** Auto delete trailing whitespaces
+#+BEGIN_SRC emacs-lisp
+ (defun gearnode/remove-trailing-whitespaces ()
+ (delete-trailing-whitespace))
+
+ (add-hook 'before-save-hook 'gearremove-trailing-whitespaces)
+#+END_SRC
+
+*** Style
+#+BEGIN_SRC emacs-lisp
+ (face-spec-set 'default '((t :font "Roboto Mono for Powerline")))
+#+END_SRC
+
+Replace tab by space
+#+BEGIN_SRC emacs-lisp
+(setq-default indent-tabs-mode nil)
+(setq-default tab-width 4)
+(setq-default show-trailing-whitespace t)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+(setq-default fill-column 78)
+#+END_SRC
+
+*** Window
+#+BEGIN_SRC emacs-lisp
+ (add-to-list 'default-frame-alist '(height . 101))
+ (add-to-list 'default-frame-alist '(width . 170))
+
+ (setq inhibit-startup-screen t)
+ (menu-bar-mode -1)
+ (toggle-scroll-bar -1)
+ (tool-bar-mode -1)
+#+END_SRC
+
+Display line number in the gutter.
+#+BEGIN_SRC emacs-lisp
+ (setq column-number-mode t)
+ (global-display-line-numbers-mode)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+ (blink-cursor-mode 0)
+ (setq x-stretch-cursor t)
+#+END_SRC
+
+*** Alias yes or no
+#+BEGIN_SRC emacs-lisp
+ (defalias 'yes-or-no-p 'y-or-n-p)
+#+END_SRC
+
+*** Load PATH env
+#+BEGIN_SRC emacs-lisp
+ (when (memq window-system '(mac ns x))
+ (exec-path-from-shell-initialize))
+#+END_SRC
+
+*** Cursor
+#+BEGIN_SRC emacs-lisp
+ (blink-cursor-mode 0)
+ (setq x-stretch-cursor t)
+#+END_SRC
+
+** Modes
+*** helm
+#+BEGIN_SRC emacs-lisp
+ (require 'helm)
+
+ (helm-mode 1)
+
+ (setq helm-always-two-window nil)
+ (setq helm-display-buffer-default-height 16)
+ (setq helm-default-display-buffer-functions '(display-buffer-in-side-window))
+
+ (global-set-key (kbd "M-x") 'helm-M-x)
+ (global-set-key (kbd "C-x C-b") 'helm-buffers-list)
+ (global-set-key (kbd "C-x C-f") 'helm-find-files)
+
+
+ (setq helm-buffer-max-length 30)
+
+ (setq helm-boring-buffer-regexp-list
+ (list
+ "\\*"
+ "\\*Echo Area"
+ "\\*Minibuf"
+ "\\*Shell Command Output\\*"
+ "\\*helm "
+ "\\*godoc "))
+#+END_SRC
+
+*** magit & forge
+#+BEGIN_SRC emacs-lisp
+ (global-set-key (kbd "C-x g") 'magit-status)
+
+ (with-eval-after-load 'magit
+ (require 'forge))
+#+END_SRC
+*** company
+#+BEGIN_SRC emacs-lisp
+ (require 'company)
+
+ (company-quickhelp-mode 1)
+
+ (setf company-idle-delay nil)
+
+ (add-hook 'after-init-hook 'global-company-mode)
+
+ (global-set-key (kbd "M-TAB") 'company-complete)
+ (define-key emacs-lisp-mode-map (kbd "M-TAB") 'company-complete)
+
+ (define-key company-active-map (kbd "C-n") 'company-select-next)
+ (define-key company-active-map (kbd "C-p") 'company-select-previous)
+ (define-key company-active-map (kbd "TAB") 'company-complete-selection)
+ (define-key company-active-map [tab] 'company-complete-selection)
+#+END_SRC
+*** protobuf
+#+BEGIN_SRC emacs-lisp
+ (require 'protobuf-mode)
+
+ (defun gearnode/protobuf-mode-init ()
+ (c-add-style "protobuf"'((c-basic-offset . 2)) t))
+
+ (add-hook 'protobuf-mode-hook 'gearnode/protobuf-mode-init)
+#+END_SRC
+*** markdown
+#+BEGIN_SRC emacs-lisp
+ (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
+ (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
+ (add-to-list 'auto-mode-alist '("\\.mkd\\'" . markdown-mode))
+#+END_SRC
+*** json
+#+BEGIN_SRC emacs-lisp
+ (defun gearnode/json-mode-init ()
+ (setq js-indent-level 2))
+
+ (add-hook 'json-mode-hook 'gearnode/json-mode-init)
+#+END_SRC
+*** makefile
+#+BEGIN_SRC emacs-lisp
+ (defun gearnode/makefile-mode-init ()
+ (setq tab-width 8))
+
+ (add-hook 'makefile-mode-hook 'gearnode/makefile-mode-init)
+#+END_SRC
+*** go
+#+BEGIN_SRC emacs-lisp
+ (add-hook 'before-save-hook 'gofmt-before-save)
+#+END_SRC
+*** disable
+#+BEGIN_SRC emacs-lisp
+ (global-disable-mouse-mode)
+ (setq-default global-disable-mouse-mode-lighter "")
+#+END_SRC
+*** yasnippet
+#+BEGIN_SRC emacs-lisp
+ (setq yas-snippet-dir
+ (expand-file-name "snippets"
+ user-emacs-directory))
+#+END_SRC
+*** org
+#+BEGIN_SRC emacs-lisp
+ (org-babel-do-load-languages
+ 'org-babel-load-languages
+ '((C . t)
+ (makefile . t)
+ (shell . t)
+ (sql . t)
+ (ruby . t)))
+#+END_SRC