Add first version of myconfig.org

main
Sergio Alvariño 2 years ago
parent d182ef9de3
commit dabd44db58

@ -0,0 +1,299 @@
#+startup: overview
* Famous init files
- [[https://github.com/zamansky/dot-emacs][The Big Zemansky]]
- [[https://github.com/patrickt/emacs][Patrick: GOAT init emacs]]
- [[https://github.com/manugoyal/.emacs.d][Manugoyal: Emacs config]]
- [[https://github.com/daviwil/dotfiles/blob/master/Emacs.org][System Crafters]]
- [[https://github.com/daviwil/emacs-from-scratch/blob/master/Emacs.org][System Crafters emacs-from-scratch]]
- [[https://github.com/SystemCrafters/crafter-configs][System Crafters configs compilation]]
* Interface tweaks
** Some GUI optimizations
#+begin_src emacs-lisp
(setq inhibit-x-resources t) ; avoid problems with emacs daemon and cursor colors
(set-face-attribute 'default nil :family "Mensch" :foundry "PfEd" :height 158)
(setq inhibit-startup-message t) ; Eliminate FSF startup msg
(setq frame-title-format "%b") ; Put filename in titlebar
(setq visible-bell t) ; Flash instead of beep
(set-scroll-bar-mode 'right) ; Scrollbar placement
(show-paren-mode t) ; Blinking cursor shows matching parentheses
(electric-pair-mode t) ; electric-pair-mode on
(setq column-number-mode t) ; Show column number of current cursor location
(mouse-wheel-mode t) ; wheel-mouse support
(setq fill-column 78)
(setq auto-fill-mode t) ; Set line width to 78 columns...
(setq-default indent-tabs-mode nil) ; Insert spaces instead of tabs
(setq-default tab-width 4) ; set default tab 4 spaces
(global-set-key "\r" 'newline-and-indent) ; turn autoindenting on
;(set-default 'truncate-lines t) ; Truncate lines for all buffers
(fset 'yes-or-no-p 'y-or-n-p)
(setq sentence-end-double-space nil)
; delete trailing whitespace before saving
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Enable line numbers for some modes
(dolist (mode '(;;text-mode-hook
prog-mode-hook
conf-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 1))))
;; Override some modes which derive from the above
(dolist (mode '(org-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
#+end_src
** Set encoding
Use utf-8 please
#+begin_src emacs-lisp
;; Set encoding
(prefer-coding-system 'utf-8)
#+end_src
** Some shortcuts
Useful shortcuts:
- Revert buffer (recargar)
- fichero org de configuración de emacs
- fichero org ppal, aquí está todo
- journal org file
- org para el blog público, ideas para el blog
- org para el blog privado
- org notes file: para tomar una nota rápida, no lo uso mucho
- phone org file: por si tomo notas en el teléfono, no lo uso mucho
#+begin_src emacs-lisp
(global-set-key (kbd "<f5>") 'revert-buffer)
;; emacs configuration org file
(global-set-key
(kbd "\e\ec")
(lambda () (interactive) (find-file "~/.emacs.d/myconfig.org")))
;; Main org file
(global-set-key
(kbd "\e\ei")
(lambda () (interactive) (find-file "~/Dropbox/orgfiles/i.org")))
;; journal org file
(global-set-key
(kbd "\e\ej")
(lambda () (interactive) (find-file "~/Dropbox/orgfiles/journal.org")))
;; Notes file
(global-set-key
(kbd "\e\en")
(lambda () (interactive) (find-file "~/Dropbox/orgfiles/notes.org")))
;; public blog org file
(global-set-key
(kbd "\e\eb")
(lambda () (interactive) (find-file "~/Dropbox/orgfiles/b.org")))
;; private blog file
(global-set-key
(kbd "\e\ep")
(lambda () (interactive) (find-file "~/work/repos/Personal/blog/comacero_priv/content-org/blog_privado.org")))
;; phone org file
(global-set-key
(kbd "\e\eh")
(lambda () (interactive) (find-file "~/share/Mob_orgzly/phone.org")))
(global-set-key [C-tab] 'hippie-expand) ; expand
(global-set-key [C-kp-subtract] 'undo) ; [Undo]
(global-set-key [C-kp-multiply] 'goto-line) ; goto line
(global-set-key [C-kp-add] 'toggle-truncate-lines) ; truncate lines
(global-set-key [C-kp-divide] 'delete-trailing-whitespace) ; delete trailing whitespace
(global-set-key [C-kp-decimal] 'completion-at-point) ; complete at point
(global-set-key [C-M-prior] 'previous-buffer) ; previous-buffer
(global-set-key [C-M-next] 'next-buffer) ; next-buffer
#+end_src
** Own map
Defines own key map
#+begin_src emacs-lisp
(define-prefix-command 'own-map)
(global-set-key (kbd "C-ñ") 'own-map)
(define-key own-map (kbd "y") 'aya-create)
(define-key own-map (kbd "e") 'aya-expand)
#+end_src
** Syntax highlight
Set maximum colors
#+begin_src emacs-lisp
(cond ((fboundp 'global-font-lock-mode) ; Turn on font-lock (syntax highlighting)
(global-font-lock-mode t) ; in all modes that support it
(setq font-lock-maximum-decoration t))) ; Maximum colors
#+end_src
** Kill buffer quick
Kill current buffer without questions
#+begin_src emacs-lisp
;;------------------------------------------------------------
;; Kill current buffer with C-Supr
(defun geosoft-kill-buffer ()
;; Kill default buffer without the extra emacs questions
(interactive)
(kill-buffer (buffer-name))
(set-name))
(global-set-key [C-delete] 'geosoft-kill-buffer)
#+end_src
** rainbow-delimiters
#+begin_src emacs-lisp
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode)
)
#+end_src
* which-key
Some help with composed hotkeys
#+begin_src emacs-lisp
(use-package which-key
:diminish
:config
(which-key-mode)
(setq which-key-idle-delay 0.3)
)
#+end_src
* ace-windows
To jump to different windows easily
#+begin_src emacs-lisp
(use-package ace-window
:init
(global-set-key [remap other-window] 'ace-window)
(custom-set-faces
'(aw-leading-char-face
((t (:inherit ace-jump-face-foreground :height 3.0)))))
)
#+end_src
* Completion systems
** Selectrum
#+begin_src emacs-lisp
;; (use-package selectrum
;; :init
;; (selectrum-mode +1))
#+end_src
** Vertico (the choosed one)
Have a look [[https://github.com/minad/vertico][here]]
#+begin_src emacs-lisp
(use-package vertico
:init
(vertico-mode +1)
:config
;; Different scroll margin
;; (setq vertico-scroll-margin 0)
;; Show more candidates
;; (setq vertico-count 20)
;; Grow and shrink the Vertico minibuffer
;; (setq vertico-resize t)
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
(setq vertico-cycle t)
)
#+end_src
*** Orderless
Have a look at [[https://github.com/oantolin/orderless][repo]]
#+begin_src emacs-lisp
(use-package orderless
:init
(icomplete-mode)
:custom
(completion-styles '(orderless))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion))))
)
#+end_src
*** Marginalia
Check the [[https://github.com/minad/marginalia][doc]]
#+begin_src emacs-lisp
(use-package marginalia
:init
(marginalia-mode +1)
:bind
(; ("M-A" . marginalia-cycle) ;; Uncomment for global bind
:map minibuffer-local-map
("M-A" . marginalia-cycle))
)
#+end_src
#+begin_src emacs_lisp
#+end_src
* ivy - counsel - swipper
An enhanced incremental search and a lot of features from counsel
- Counsel is a collection of emacs commands rewrited to use Ivy
- Ivy se encarga del autocompletado
- Ivy-rich se encarga de completar algunas opciones de Ivy
- Swipper se encarga de las busquedas en el fichero
#+begin_src emacs-lisp
;; (use-package counsel
;; :bind
;; (("C-S-o" . counsel-rhythmbox)
;; ("M-x" . counsel-M-x)
;; ("C-x b" . counsel-switch-buffer)
;; ("C-x C-f" . counsel-find-file)
;; ("<f1> f" . counsel-describe-function)
;; ("<f1> v" . counsel-describe-variable)
;; ("<f1> l" . counsel-load-library)
;; ("<f2> i" . counsel-info-lookup-symbol)
;; ("<f2> u" . counsel-unicode-char)
;; ("C-c g" . counsel-git)
;; ("C-c j" . counsel-git-grep)
;; ("C-c k" . counsel-ag) ;; requires installation: apt install silversearcher-ag
;; ("C-x l" . counsel-locate)
;; ("M-y" . counsel-yank-pop)
;; :map ivy-minibuffer-map
;; ("M-y" . ivy-next-line))
;; )
;; ;; Takes care of completion in elections menus
;; (use-package ivy
;; :diminish (ivy-mode)
;; :bind
;; (
;; ;; ("C-x b" . ivy-switch-buffer)
;; ("<f6>" . ivy-resume)
;; )
;; :config
;; (ivy-mode 1)
;; (setq ivy-use-virtual-buffers t
;; ivy-count-format "%d/%d "
;; ivy-display-style 'fancy)
;; )
;; ;; Ivy enriched
;; (use-package ivy-rich
;; :config
;; (ivy-rich-mode 1)
;; )
;;
;; (use-package swiper
;; :bind
;; (("C-s" . swiper)
;; ("C-r" . swiper-isearch-backward)
;; :map minibuffer-local-map
;; ("C-r" . counsel-minibuffer-history)
;; )
;; :config
;; (ivy-mode 1)
;; (setq ivy-use-virtual-buffers t)
;; )
#+end_src
* doom-modeline
A fancy modeline. Remember to execute =M-x all-the-icons-install-fonts=
See [[http://sodaware.sdf.org/notes/emacs-daemon-doom-modeline-icons/][this]] for fixing icons in terminal
#+begin_src emacs-lisp
(use-package all-the-icons
)
(use-package doom-modeline
:init
(doom-modeline-mode 1)
(setq doom-modeline-icon 1) ;; this fixes icons in emacs-client
:custom
(doom-modeline-height 15)
;;(doom-modeline-icon (display-graphic-p))
)
#+end_src
Loading…
Cancel
Save