Last active
August 11, 2023 02:58
-
-
Save mickael-kerjean/364d1e2ce2a236451b0273239b5f2a5b to your computer and use it in GitHub Desktop.
emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'hydra) | |
(defun my/browser-open-at-point (&optional arg) | |
(interactive "P") | |
(let ((url (thing-at-point 'url))) | |
(xwidget-webkit-browse-url | |
(if url url (read-string "url: " ""))))) | |
(defun my/browser-google (&optional arg) | |
(interactive "P") | |
(xwidget-webkit-browse-url | |
(concat "https://google.com/search?q=" (read-string "search: " "")))) | |
(defun my/browser-open (&optional url) | |
(interactive "P") | |
(xwidget-webkit-browse-url url)) | |
(defhydra my/hydra-internet (:color blue :hint nil) | |
" | |
webkit : _o_pen _g_oogle _h_n | |
filestash : _c_ontact c_a_lendar #_f_ilestash #filestash__d_ev | |
" | |
("o" (my/browser-open-at-point)) | |
("g" (my/browser-google)) | |
("h" (my/browser-open "http://news.ycombinator.com")) | |
("c" (eww "https://pages.kerjean.me/projects/filestash/logs/?key=mickael")) | |
("a" (my/browser-open "https://calendar.google.com/calendar/u/0/r")) | |
("f" (eww "https://support.filestash.app")) | |
("d" (eww "https://support.filestash.app"))) | |
(global-set-key (kbd "C-c o") 'my/hydra-internet/body) | |
(global-set-key (kbd "C-c b") 'my/browser-open-at-point) | |
(global-set-key (kbd "s-e") 'xwidget-webkit-edit-mode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; adapted from a link taken from emacs.org | |
(defun dired-sort-toggle () | |
"This is a redefinition of the fn from dired.el. Normally, | |
dired sorts on either name or time, and you can swap between them | |
with the s key. This function one sets sorting on name, size, | |
time, and extension. Cycling works the same. | |
" | |
(setq dired-actual-switches | |
(let (case-fold-search) | |
(cond | |
((string-match " " dired-actual-switches) ;; contains a space | |
;; New toggle scheme: add/remove a trailing " -t" " -S", | |
;; or " -U" | |
;; -t = sort by time (date) | |
;; -S = sort by size | |
;; -X = sort by extension | |
(cond | |
((string-match " -t\\'" dired-actual-switches) | |
(concat | |
(substring dired-actual-switches 0 (match-beginning 0)) | |
" -X")) | |
((string-match " -X\\'" dired-actual-switches) | |
(concat | |
(substring dired-actual-switches 0 (match-beginning 0)) | |
" -S")) | |
((string-match " -S\\'" dired-actual-switches) | |
(substring dired-actual-switches 0 (match-beginning 0))) | |
(t | |
(concat dired-actual-switches " -t")))) | |
(t | |
;; old toggle scheme: look for a sorting switch, one of [tUXS] | |
;; and switch between them. Assume there is only ONE present. | |
(let* ((old-sorting-switch | |
(if (string-match (concat "[t" dired-ls-sorting-switches "]") | |
dired-actual-switches) | |
(substring dired-actual-switches (match-beginning 0) | |
(match-end 0)) | |
"")) | |
(new-sorting-switch | |
(cond | |
((string= old-sorting-switch "t") "S") | |
((string= old-sorting-switch "S") "") | |
(t "t")))) | |
(concat | |
"-l" | |
;; strip -l and any sorting switches | |
(dired-replace-in-string (concat "[-lt" | |
dired-ls-sorting-switches "]") | |
"" | |
dired-actual-switches) | |
new-sorting-switch)))))) | |
(revert-buffer)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq gnus-select-method '(nnnil "")) | |
(setq gnus-secondary-select-methods '((nnimap "gmail" | |
(nnimap-address "imap.gmail.com") | |
(nnimap-stream ssl) | |
(nnimap-list-pattern ("INBOX")) | |
(nnir-search-engine imap) | |
(nnimap-authinfo-file "~/.authinfo")) | |
(nnimap "perso" | |
(nnimap-address "ssl0.ovh.net") | |
(nnimap-stream ssl) | |
(nnimap-list-pattern ("INBOX")) | |
(nnir-search-engine imap) | |
(nnimap-authinfo-file "~/.authinfo")) | |
(nnimap "filestash" | |
(nnimap-address "imappro.zoho.com.au") | |
(nnimap-stream ssl) | |
(nnimap-list-pattern ("INBOX")) | |
(nnir-search-engine imap) | |
(nnimap-authinfo-file "~/.authinfo")) | |
)) | |
(add-hook 'gnus-group-mode-hook #'gnus-topic-mode) | |
(setq mm-text-html-renderer 'gnus-w3m) | |
(setq gnus-novice-user nil) | |
(setq gnus-expert-user t) | |
;; (bind-key "<delete>" 'gnus-summary-delete-article gnus-summary-mode-map) | |
(setq gnus-summary-line-format "[%U%R] %-11,11&user-date; %-32,32f %B%s (%k)\n") | |
(setq gnus-user-date-format-alist | |
'(((gnus-seconds-today) . "Tod. %R") | |
((+ (* 60 60 24) (gnus-seconds-today)) . "Yest %R") | |
((+ (* 5 60 60 24) (gnus-seconds-today)) . "%a. %R") | |
(t . "%d/%m/%Y"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setenv "PATH" (concat (getenv "PATH") ":/home/mickael/Documents/go/bin:/usr/local/go/bin/")) | |
(setq exec-path (append exec-path '("/usr/local/go/bin"))) | |
(setq exec-path (append exec-path '("/home/mickael/Documents/go/bin"))) | |
(defun my/gostart () | |
(require 'lsp-mode) | |
;; Before save | |
(add-hook 'before-save-hook #'gofmt-before-save) | |
(add-hook 'before-save-hook #'lsp-format-buffer t t) | |
(add-hook 'before-save-hook #'lsp-organize-imports t t) | |
;; Jump to definition | |
(local-set-key (kbd "M-.") 'godef-jump) | |
;; autocomplete | |
(lsp-mode)) | |
(add-hook 'go-mode-hook 'my/gostart) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq org-todo-keywords (quote ((sequence "TODO(t)" "DOING(d)" "WAITING(w)" "|" "CANCEL(C)" "DEFERRED(F)" "DONE(D)")))) | |
(global-set-key (kbd "C-c b") 'org-iswitchb) | |
(global-set-key (kbd "C-c a") 'org-agenda) | |
(global-set-key (kbd "C-c c") 'org-capture) | |
(add-hook 'org-mode-hook 'org-loader) | |
(defun org-loader () | |
;; mode related settings | |
(org-indent-mode t) | |
(setq truncate-lines nil) | |
;; capture & archive | |
(setq org-default-notes-file "~/.emacs.d/files/default.org") | |
(setq org-agenda-files (list "~/.emacs.d/files/")) | |
(setq org-archive-location "~/.emacs.d/files/docs/archive.org::") | |
(setq org-refile-targets (quote ((nil :maxlevel . 1) (org-agenda-files :maxlevel . 1)))) | |
(setq org-capture-templates | |
(quote (("t" "todo" entry (file "~/.emacs.d/files/backlog.org") | |
"* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t) | |
("d" "doing" entry (file "~/.emacs.d/files/backlog.org") | |
"* BREAK %?\n%U\n%a\n" :clock-in t :clock-resume t)))) | |
;; design | |
(defvar org-level-star (make-face 'org-level-star)) | |
(font-lock-add-keywords 'org-mode (list (list (concat "\\*") '(0 org-level-star t)) )) | |
;; (set-face-attribute 'org-block-begin-line nil :background "#191919") | |
;; (set-face-attribute 'org-block nil :background "#191919") | |
(set-face-attribute 'org-level-star nil :inherit 'font-lock-comment-face) | |
(set-face-attribute 'org-level-1 nil :inherit 'font-lock-keyword-face :height 180) | |
(set-face-attribute 'org-level-2 nil :inherit 'font-lock-keyword-face :height 150) | |
(set-face-attribute 'org-level-3 nil :inherit 'font-lock-keyword-face :height 140) | |
(set-face-attribute 'org-level-4 nil :inherit 'font-lock-keyword-face :height 140) | |
(set-face-attribute 'org-level-5 nil :inherit 'font-lock-keyword-face :height 140) | |
(set-face-attribute 'org-level-6 nil :inherit 'font-lock-keyword-face :height 140) | |
(set-face-attribute 'org-link nil :inherit 'font-lock-warning-face) | |
(set-face-attribute 'org-date nil :foreground (face-foreground 'font-lock-warning-face)) | |
(set-face-attribute 'org-tag nil :inherit 'font-lock-warning-face) | |
;; Task status and state | |
(setq org-use-fast-todo-selection t) | |
(add-hook 'org-after-todo-state-change-hook | |
(lambda () (cond | |
((and (org-entry-is-done-p) (org-clock-is-active)) (org-clock-out)) | |
((equal (org-get-todo-state) "DOING") (org-clock-in)) | |
((org-clock-is-active) (org-clock-out))))) | |
;; encrypt | |
(require 'org-crypt) | |
(require 'epa-file) | |
(setq auto-save-default nil) | |
(epa-file-enable) | |
(org-crypt-use-before-save-magic) | |
(setq org-tags-exclude-from-inheritance (quote ("crypt"))) | |
(setq org-crypt-key nil) | |
(setq auto-save-default nil) | |
;;(global-set-key (kbd "C-c d") 'org-decrypt-entry) | |
;; images | |
(org-redisplay-inline-images) | |
;; org mode export | |
(setq org-html-head "<meta http-equiv='X-UA-Compatible' content='IE=edge'><meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'><style>html{touch-action:manipulation;-webkit-text-size-adjust:100%}body{margin:5% auto;padding:0 25px;background:#fafeff;max-width:950px;color:#3c495a;font-weight:400;font-size:18px;line-height:25px;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif}h1,h2,h3,h4,h5,h6{font-family:Ubuntu,'Trebuchet MS',Verdana,sans-serif;color:#586b82;padding:0;margin:15px 0 10px 0;font-size:1.05em}h2{margin:50px 0 15px 0;font-size:1.3em}h3{font-size:1.15em}h1.title{color:#343c44;padding:50px 0 50px 0;font-weight:400;font-size:2.2em;text-shadow:1px 1px 1px rgba(0,0,0,.1)}h1.title:after{content:' ';border-bottom:4px solid;width:150px;height:4px;display:block;margin:10px auto 20px auto;border-radius:2px;box-shadow:1px 1px 1px rgba(0,0,0,.1)}a{color:#3fa7ba;text-decoration:none}p{margin:15px 0 0 0;text-align:justify}img{max-width:100%;display:block;border-radius:3px}ol,ul{margin:0 0 5px 0;text-align:justify;overflow:auto}@media only screen and (max-width:600px){ul.org-ul{padding-left:20px}}ul>li>code{color:#586b82}pre{white-space:pre-wrap}pre.src:hover:before{display:inline;background:#fff;border-radius:5px;padding:0 10px;font-size:15px;border:1px solid #e2e9f0}.verse,pre,pre.src{box-shadow:none;background-color:#fff;border:1px solid #e2e9f0;color:#586b82;padding:15px;font-family:Monaco,monospace;overflow:auto;margin:6px 0;border-radius:2px}#table-of-contents{font-family:Ubuntu,'Trebuchet MS',Verdana,sans-serif;margin-bottom:50px;margin-top:50px}#text-table-of-contents ul{padding-left:30px;margin:0}#text-table-of-contents>ul{padding-left:0}#text-table-of-contents li{list-style-type:none}#text-table-of-contents a{color:#7c8ca1;text-decoration:none}table{border-color:#586b82;font-size:.95em}table thead{color:#586b82}table tbody tr:nth-child(even){background:#f9f9f9}table tbody tr:hover{background:#586b82!important;color:#fff}table .left{text-align:left}table .right{text-align:right}.todo{font-family:inherit;color:inherit;opacity:.9}.done{color:inherit;opacity:.9}.tag{background:initial}.tag>span{background-color:#eee;font-family:monospace;padding-left:7px;padding-right:7px;border-radius:2px;float:right;margin-left:5px}#text-table-of-contents .tag>span{float:none;margin-left:0}.timestamp{color:#7c8ca1}#postamble{margin-top:100px;text-align:right;opacity:.5}#postamble p{text-align:inherit}@media print{@page{margin-bottom:3cm;margin-top:3cm;margin-left:2cm;margin-right:2cm}h1.title{padding-top:0}body{margin-top:0}}</style>") | |
(setq org-html-validation-link nil) | |
(setq org-html-creator-string "")) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; begin(powerline) | |
(add-to-list 'load-path "~/.emacs.d/plugins/powerline") | |
(require 'powerline) | |
;; end(powerline) | |
(defun my/powerline () | |
(interactive) | |
(setq-default mode-line-format | |
'("%e" | |
(:eval | |
(let* ((active (powerline-selected-window-active)) | |
(mode-line-buffer-id (if active 'mode-line-buffer-id 'mode-line-buffer-id-inactive)) | |
(mode-line (if active 'mode-line 'mode-line-inactive)) | |
(face1 (if active 'powerline-active1 'powerline-inactive1)) | |
(face2 (if active 'powerline-active2 'powerline-inactive2)) | |
(separator-left (intern (format "powerline-%s-%s" | |
(powerline-current-separator) | |
(car powerline-default-separator-dir)))) | |
(separator-right (intern (format "powerline-%s-%s" | |
(powerline-current-separator) | |
(cdr powerline-default-separator-dir)))) | |
(lhs (list | |
(powerline-buffer-id mode-line-buffer-id 'l) | |
(powerline-raw " " mode-line 'l) | |
(funcall separator-left mode-line face1) | |
(powerline-narrow face1 'l) | |
(funcall separator-left face1 face2) | |
(powerline-vc face2 'r))) | |
(rhs (list | |
(powerline-raw (format-time-string "%H:%M" (current-time)) face2 'l) | |
(powerline-raw "|" face2 'l) | |
(powerline-major-mode face2 'l) | |
(powerline-raw " " face2) | |
(funcall separator-right face2 mode-line) | |
(powerline-raw " ") | |
(powerline-raw "%4l:%3c" mode-line 'r) | |
(when powerline-display-hud | |
(powerline-hud face1 mode-line))))) | |
(concat (powerline-render lhs) | |
(powerline-fill face2 (powerline-width rhs)) | |
(powerline-render rhs))))))) | |
(my/powerline) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; terminal | |
;; (autoload 'vterm "vterm" "vterm" t) | |
;; (require 'vterm) | |
;; (setq vterm-buffer-name "term: %s") | |
;; autocompletion | |
(require 'lsp-mode) | |
(setq lsp-headerline-breadcrumb-enable nil) | |
(setq lsp-ui-doc-enable nil) | |
(setq | |
company-format-margin-function nil | |
company-minimum-prefix-length 1 | |
company-idle-delay 0.0 | |
company-tooltip-minimum-width 40) | |
;; seen from the doc | |
(setq gc-cons-threshold 100000000) | |
(setq read-process-output-max (* 1024 1024)) ;; 1mb | |
(setq | |
lsp-ui-doc-background "#1c1c1c" | |
lsp-ui-doc-border "#1c1c1c" | |
lsp-ui-doc-enable nil | |
lsp-ui-imenu-enable nil | |
lsp-ui-peek-enable nil | |
lsp-ui-sideline-enable nil) | |
(custom-set-faces | |
'(company-tooltip ((t (:inherit default :background "#1e1e1e")))) | |
'(company-scrollbar-bg ((t (:background "#1e1e1e")))) | |
'(company-scrollbar-fg ((t (:background "#2b2b2b")))) | |
'(company-preview-common ((t (:background "#2b2b2b" :foreground "#99968b")))) | |
'(company-tooltip-selection ((t (:foreground "#8ac6f2")))) | |
'(company-tooltip-common ((t (:inherit font-lock-default-face)))) | |
'(company-tooltip-annotation ((t (:inherit font-lock-comment-face))))) | |
;; git | |
(global-set-key (kbd "C-c g") 'magit-status) | |
;; projectile | |
(projectile-mode +1) | |
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) | |
(add-to-list 'projectile-globally-ignored-directories "node_modules" "dist") | |
;; roam | |
(setq org-roam-directory (file-truename "~/Documents/org")) | |
;; lsp | |
;; lsp-ui-doc-border | |
;; lsp-ui-doc-background | |
;; (set-face-attribute 'lsp-ui-doc-border nil :height 140) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq eshell-prompt-function (lambda nil | |
(concat | |
(propertize (eshell/pwd) 'face `(:inherit 'font-lock-keyword-face :foreground "#5995be")) | |
(propertize " # " 'face `(:foreground "white"))))) | |
(defun my/shell-hook () | |
(set-face-attribute 'eshell-ls-directory nil :inherit 'font-lock-keyword-face) | |
(set-face-attribute 'eshell-ls-archive nil :inherit 'font-lock-keyword-face :foreground "#b85149") | |
(require 'company) | |
(company-mode) | |
(define-key eshell-mode-map (kbd "C-l") (lambda () | |
(interactive) | |
(my/shell-exec "clear 1"))) | |
(define-key eshell-mode-map (kbd "<tab>") 'company-complete)) | |
(defun my/shell-exec (cmd) | |
"Runs the command 'cmd' in eshell." | |
(with-current-buffer "*eshell*" | |
(eshell-kill-input) | |
(end-of-buffer) | |
(insert cmd) | |
(eshell-send-input) | |
(end-of-buffer) | |
(yank))) | |
(add-hook 'eshell-mode-hook 'my/shell-hook) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ------------------------------------------------------------------------------------- | |
;; --------------------- INITIALIZE ----------------------------------------- | |
;; ------------------------------------------------------------------------------------- | |
;; SETUP YOUR PROXY IF NEEDED | |
;; (setq url-proxy-services | |
;; '(("no_proxy" . "^\\(localhost\\|10.*\\)") | |
;; ("http" . "company.com:8080") | |
;; ("https" . "company.com:8080"))) | |
;; ------------------------------------------------------------------------------------- | |
;; ---------------------------- THEME ------------------------------------------- | |
;; ------------------------------------------------------------------------------------- | |
(load-theme 'wombat) | |
;; a great font: https://www.fontyukle.net/en/Monaco.ttf | |
(condition-case nil | |
(set-default-font "Monaco") | |
(error nil)) | |
(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. | |
'(default ((t (:inherit nil :stipple nil :background "#242424" :foreground "#f6f3e8" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "APPL" :family "Monaco")))) | |
'(ace-jump-face-foreground ((t (:inherit font-lock-keyword-face)))) | |
'(company-scrollbar-bg ((t (:background "#1c1c1c")))) | |
'(company-scrollbar-fg ((t (:background "#99968b")))) | |
'(company-tooltip ((t (:inherit default :background "#1e1e1e")))) | |
'(company-tooltip-annotation ((t (:inherit font-lock-comment-face)))) | |
'(company-tooltip-common ((t (:inherit font-lock-default-face)))) | |
'(company-tooltip-selection ((t (:inherit font-lock-keyword-face)))) | |
'(compilation-face ((t (:inherit 'font-lock-keyword-face)))) | |
'(compilation-info ((t (:inherit 'font-lock-keyword-face)))) | |
'(erc-current-nick-face ((t (:inherit 'font-lock-keyword-face)))) | |
'(erc-err-face ((t (:inherit 'font-lock-comment-face)))) | |
'(erc-nick-default-face ((t (:inherit 'font-lock-comment-face)))) | |
'(erc-notice-face ((t (:inherit 'font-lock-comment-face)))) | |
'(erc-prompt-face ((t (:inherit 'font-lock-keyword-face)))) | |
'(erc-timestamp-face ((t (:inherit 'font-lock-comment-face)))) | |
'(eww-valid-certificate ((t (:inherit 'font-lock-comment-face)))) | |
'(fringe ((t (:background "#242424" :underline nil)))) | |
'(header-line ((t (:background "#242424")))) | |
'(ido-first-match ((t (:inherit 'font-lock-comment-face)))) | |
'(ido-only-match ((t (:inherit 'font-lock-comment-face)))) | |
'(ido-subdir ((t (:inherit 'font-lock-keyword-face)))) | |
'(linumb ((t (:inherit (shadow default) :background "#191919" :foreground "#505050")))) | |
'(variable-pitch ((t (:inherit 'default) :background nil))) | |
'(window-divider ((t (:foreground "#181818")))) | |
'(xref-file-header ((t (:inherit 'font-lock-builtin-face))))) | |
;; ------------------------------------------------------------------------------------- | |
;; --------------------- ENHANCEMENTS ------------------------------------------- | |
;; ------------------------------------------------------------------------------------- | |
;; remove unecessary UI | |
(menu-bar-mode -1) | |
(scroll-bar-mode 0) | |
(tool-bar-mode 0) | |
(setq visible-bell 1) | |
(setq ring-bell-function 'ignore) | |
;; startup screen | |
(setq inhibit-splash-screen t) | |
(setq inhibit-startup-message t) | |
(setq initial-scratch-message nil) | |
;; remove whitespace before saving | |
(add-hook 'before-save-hook 'whitespace-cleanup) | |
;; faster to quit | |
(fset 'yes-or-no-p 'y-or-n-p) | |
;; highlight selected text | |
(transient-mark-mode t) | |
;; set path | |
(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH"))) | |
(add-to-list 'exec-path "/usr/local/bin") | |
;; display matching parenthesis | |
(show-paren-mode 1) | |
;; move faster up and down faster | |
(global-set-key (kbd "M-n") (kbd "C-u 5 C-n")) | |
(global-set-key (kbd "M-p") (kbd "C-u 5 C-p")) | |
;; usefull stuff before saving | |
(add-hook 'write-file-hooks 'delete-trailing-whitespace) | |
(add-hook 'before-save-hook '(lamdba () (require 'saveplace)(setq-default save-place t))) | |
;; refresh buffers when any file change | |
(global-auto-revert-mode t) | |
;; display time | |
(load "time" t t) | |
(display-time) | |
;; track recently opened file | |
(recentf-mode t) | |
(global-set-key (kbd "C-x C-r") 'recentf-open-files) | |
(setq recentf-max-saved-items 1000) | |
(setq recentf-max-menu-items 50) | |
;; display pictures and other compressed files | |
(setq auto-image-file-mode t) | |
(setq auto-compression-mode t) | |
;; line and column numbering | |
(column-number-mode 1) | |
(line-number-mode 1) | |
;; code folding | |
(global-set-key (kbd "C-c C-d") 'hs-hide-all) | |
(global-set-key (kbd "C-c C-f") 'hs-show-all) | |
(global-set-key (kbd "C-c C-c") 'hs-toggle-hiding) | |
(add-hook 'prog-mode-hook #'(lambda () (hs-minor-mode t) )) | |
;; Search using regexp | |
(global-set-key "\C-s" 'isearch-forward-regexp) | |
(global-set-key "\C-r" 'isearch-backward-regexp) | |
;; Usable on OSX and windows | |
(setq mac-command-modifier 'meta) | |
(setq mac-option-modifier 'alt) | |
(setq mac-right-option-modifier 'super) | |
(setq w32-get-true-file-attributes nil) | |
(setq vc-handled-backends nil) | |
(remove-hook 'find-file-hooks 'vc-find-file-hook) | |
;; scroll | |
(setq scroll-step 1) | |
(setq scroll-conservatively 10) | |
(setq scroll-margin 7) | |
(setq scroll-conservatively 5) | |
;; indentation | |
(setq-default indent-tabs-mode nil) | |
(setq-default tab-width 4) | |
(setq standard-indent 4) | |
(setq indent-line-function 'insert-tab) | |
(setq tab-width 4) | |
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80)) | |
(setq indent-tabs-mode nil) | |
;; disable backup files | |
(setq make-backup-files nil) | |
;; auto wraping | |
(set-default 'truncate-lines t) | |
(add-hook 'text-mode-hook (lambda () (setq truncate-lines nil))) | |
;; remove stupid shortcut | |
(global-unset-key (kbd "C-x C-l")) | |
;; setup ido for selecting file | |
(ido-mode) | |
(setq ido-enable-flex-matching t) | |
(setq resize-mini-windows t) | |
(add-hook 'minibuffer-setup-hook | |
(lambda () (setq truncate-lines nil))) | |
(setq ido-decorations '("\n-> " "" "\n " "\n ..." | |
"[" "]" " [No match]" " [Matched]" | |
" [Not readable]" " [Too big]" " [Confirm]")) | |
(add-to-list 'ido-ignore-buffers "*Messages*") | |
(add-to-list 'ido-ignore-buffers "*Buffer*") | |
(add-to-list 'ido-ignore-buffers "*ESS*") | |
(add-to-list 'ido-ignore-buffers "*NeoTree*") | |
(add-to-list 'ido-ignore-buffers "*Completions*") | |
(add-to-list 'ido-ignore-buffers "*Help*") | |
;; usefull shortcuts | |
(global-set-key [f3] 'comment-region) | |
(global-set-key [f4] 'uncomment-region) | |
(global-set-key [f5] 'eshell) | |
(global-set-key [f11] 'toggle-frame-fullscreen) | |
(global-set-key (kbd "C-h C-s") 'info-apropos) | |
;; ARTIST MODE | |
(eval-after-load "artist" '(define-key artist-mode-map [(down-mouse-3)] 'artist-mouse-choose-operation)) | |
;; EWW - emacs web browser | |
(setq | |
browse-url-browser-function 'eww-browse-url ; Use eww as the default browser | |
shr-use-fonts nil ; No special fonts | |
shr-use-colors t ; No colours | |
shr-indentation 2 ; Left-side margin | |
shr-width 120 ; Fold text to 70 columns | |
eww-search-prefix "https://google.com/?q=") | |
;; (setq shr-color-visible-luminance-min 78) ;; improve readability (especially for google search) | |
(setq url-user-agent "User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7\n") | |
(global-set-key (kbd "C-c b") 'eww) | |
;; Setup the package manager | |
(defun load-package-manager () | |
(package-initialize) | |
(require 'package) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))) | |
(add-hook 'after-init-hook 'load-package-manager) | |
;; Hide left line indicator | |
(setf (cdr (assq 'continuation fringe-indicator-alist)) | |
'(nil nil)) | |
;; Window split line | |
(set-face-attribute 'window-divider-first-pixel nil :foreground "#2b2b2b") | |
(set-face-attribute 'window-divider-last-pixel nil :foreground "#2b2b2b") | |
(set-face-attribute 'window-divider nil :foreground "#2b2b2b") | |
(setq window-divider-default-right-width 5) (window-divider-mode 1) | |
;; ------------------------------------------------------------------------------------- | |
;; --------------------- PLUGINS ----------------------------------------- | |
;; ------------------------------------------------------------------------------------- | |
;; Our plugins configuration will leave under the conf folder, so let's load this up: | |
(mapc | |
(lambda(path) (load-file path)) | |
(condition-case nil | |
(directory-files "~/.emacs.d/conf/" t "\.el$") | |
(error (make-directory "~/.emacs.d/conf/")))) | |
;; ------------------------------------------------------------------------------------- | |
;; --------------------- VARIABLES ----------------------------------------- | |
;; ------------------------------------------------------------------------------------- | |
;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment