First commit.

This commit is contained in:
kj 2022-03-29 19:21:13 -04:00
commit da8f068975
293 changed files with 3002 additions and 0 deletions

626
configs/base-extensions.el Normal file
View File

@ -0,0 +1,626 @@
;;; base-extensions.el --- Extenciones/paquetes instalados y su configuración
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;;; Code:
;; use-package - No necesita presentación
(use-package use-package
:config
(setq use-package-always-ensure t) ; auto-instalar extenciones que no lo estén
)
;; Auto-actualizar los paquetes
(use-package auto-package-update
:custom
(auto-package-update-interval 7)
(auto-package-update-prompt-before-update t)
(auto-package-update-hide-results t)
:config
(auto-package-update-maybe)
(auto-package-update-at-time "06:00")
:init
(setq
auto-package-update-last-update-day-filename
(expand-file-name ".last-package-update-day" private-dir)))
;; Iconos principalmente para ser usados por neotree
(use-package all-the-icons)
;; Highlight en los números.
(use-package highlight-numbers
:ensure t
:hook
(prog-mode . highlight-numbers-mode))
;; Barra lateral de archivos
(use-package treemacs
:ensure t
:hook (treemacs-mode . (lambda() (display-line-numbers-mode -1)))
:bind ([mouse-1] . treemacs-single-click-expand-action)
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display 'simple
treemacs-file-event-delay 5000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-expand-after-init t
treemacs-find-workspace-method 'find-for-file-or-pick-first
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-forward-on-expand nil
treemacs-no-png-images nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name "cache/treemacs-persist" private-dir)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-asc
treemacs-select-when-already-in-treemacs 'move-back
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-text-scale nil
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-wide-toggle-width 70
treemacs-width 35
treemacs-width-increment 1
treemacs-width-is-initially-locked t
treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(pcase (cons (not (null (executable-find "git")))
(not (null treemacs-python-executable)))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple)))
(treemacs-hide-gitignored-files-mode nil))
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("<f9>" . treemacs)
("<f8>" . treemacs-display-current-project-exclusively)
("<f7>" . treemacs-add-and-display-current-project)
("C-x t d" . treemacs-select-directory)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-evil
:after (treemacs evil)
:ensure t
:config
;; Atajos de tecla con leader key de evil-mode.
(evil-set-leader 'treemacs (kbd "SPC"))
(evil-define-key 'treemacs 'global (kbd "<leader>b") 'ivy-switch-buffer)
(evil-define-key 'treemacs 'global (kbd "<leader>v") 'counsel-projectile)
(evil-define-key 'treemacs 'global (kbd "<leader>p") 'counsel-projectile)
(evil-define-key 'treemacs 'global (kbd "<leader>cp") 'treemacs-projectile)
(evil-define-key 'treemacs 'global (kbd "<leader>d") 'treemacs-remove-project-from-workspace))
(use-package treemacs-projectile
:after (treemacs projectile)
:ensure t)
(use-package treemacs-icons-dired
:hook (dired-mode . treemacs-icons-dired-enable-once)
:ensure t)
(use-package treemacs-magit
:after (treemacs magit)
:ensure t)
(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
:after (treemacs persp-mode) ;;or perspective vs. persp-mode
:ensure t
:config (treemacs-set-scope-type 'Perspectives))
(use-package treemacs-tab-bar ;;treemacs-tab-bar if you use tab-bar-mode
:after (treemacs)
:ensure t
:config (treemacs-set-scope-type 'Tabs))
;; Recentf - Guarda registro de los archivos abiertos recientemente
(use-package recentf
:config
(setq recentf-save-file
(recentf-expand-file-name (concat temp-dir "/recentf")))
(recentf-mode 1))
;; Guardar la posición del cursor en un archivo para volver allí cuando se lo vuelva a abrir.
(use-package saveplace
:config
(save-place-mode 1)
(setq save-place-file (locate-user-emacs-file (concat temp-dir "/places"))))
;; Emmet - Una ayuda para escribir HTML rápidamente (escribre doc, luego preciona C-j y lo entenderás)
(use-package emmet-mode
:config
(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
(add-hook 'html-mode-hook 'emmet-mode)
(add-hook 'css-mode-hook 'emmet-mode)
)
;; Modo markdown
(use-package markdown-mode)
;; Git Gutter - Marca a la izq. si una linea ha sido agregada, editada o eliminada desde el último commit.
(use-package git-gutter
:config
(global-git-gutter-mode +1) ; Habilitar git gutter de manera global
)
;; Mejorando el scroll
(use-package smooth-scrolling
:config
(smooth-scrolling-mode 1) ; Cambia el salto de líneas cuando el cursor llega al final.
(setq mouse-wheel-scroll-amount
'(8 ((shift) . 1) ((control) . nil))) ; Cambia el scroll a 8 líneas a la vez, 1 cuando se preciona SHIFT y saltos de página cuando presionas CTRL
(setq mouse-wheel-progressive-speed nil) ; Deshabilita la velocidad progresiva del scroll (mientras más scroll haces, mas rápido va)
)
;; Esa línea bonita de abajo del editor que dice cosas xD
(use-package telephone-line
:custom
(telephone-line-primary-left-separator 'telephone-line-cubed-left)
(telephone-line-secondary-left-separator 'telephone-line-cubed-hollow-left)
(telephone-line-primary-right-separator 'telephone-line-cubed-right)
(telephone-line-secondary-right-separator 'telephone-line-cubed-hollow-right)
(telephone-line-evil-use-short-tag t)
(setq telephone-line-lhs
'((evil . (telephone-line-evil-tag-segment))
(accent . (telephone-line-vc-segment
telephone-line-erc-modified-channels-segment
telephone-line-process-segment))
(nil . (;telephone-line-minor-mode-segment
telephone-line-buffer-segment))))
(setq telephone-line-rhs
'((nil . (telephone-line-misc-info-segment))
(accent . (telephone-line-major-mode-segment))
(evil . (telephone-line-airline-position-segment))))
(telephone-line-mode t)
)
;; Control más "natural" a la hora de hacer/deshacer.
(use-package undo-tree
:init
(setq undo-tree-auto-save-history nil)
(global-undo-tree-mode 1)
:config
(global-set-key (kbd "C-z") 'undo-tree-undo)
(global-set-key (kbd "C-y") 'undo-tree-redo)
)
;; Hacer uso de Emacs con las ventajas de vim.
(use-package evil
:init
(evil-mode 1)
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
(setq evil-want-C-u-scroll t)
(setq evil-want-C-i-jump nil)
(setq evil-respect-visual-line-mode t)
(setq evil-undo-system 'undo-tree)
(setq evil-toggle-key "C-'") ; Cambiar toggle-key cambiar entre evil states y emacs.
;; (setq evil-default-state 'emacs) ; Modo por defecto en emacs mode
:config
(define-key evil-normal-state-map (kbd "g b") 'evil-jump-backward)
;; Hacer que funcione C-v en modo insert y replace
;;(evil-global-set-key 'insert (kbd "C-v") 'cua-paste)
;;(evil-global-set-key 'replace (kbd "C-v") 'cua-paste)
;; Cortar es C-x 2 veces en modo insert y replace
;;(evil-global-set-key 'insert (kbd "C-x C-x") 'cua-cut-region)
;;(evil-global-set-key 'replace (kbd "C-x C-x") 'cua-cut-region)
;; Seleccionar todo con C-a en insert mode
(evil-global-set-key 'insert (kbd "C-a") 'mark-whole-buffer)
;; **
;; Atajos personalizados con leader key
;; **
;; Definiendo la leader key
(evil-set-leader 'normal (kbd "SPC"))
(evil-set-leader 'visual (kbd "SPC"))
;; Atajos para counsel-projectile y switch buffer con leader key
(evil-define-key 'normal 'global (kbd "<leader>b") 'ivy-switch-buffer)
(evil-define-key 'visual 'global (kbd "<leader>b") 'ivy-switch-buffer)
(evil-define-key 'normal 'global (kbd "<leader>v") 'counsel-projectile)
(evil-define-key 'normal 'global (kbd "<leader>cp") 'projectile-switch-project)
(evil-define-key 'visual 'global (kbd "<leader>v") 'counsel-projectile)
(evil-define-key 'visual 'global (kbd "<leader>cp") 'projectile-switch-project)
(evil-define-key 'normal 'global (kbd "<leader>ff") 'counsel-find-file)
(evil-define-key 'visual 'global (kbd "<leader>ff") 'counsel-find-file)
;; Atajos windmove con leader key
(evil-define-key 'normal 'global (kbd "<leader>wh") 'windmove-left)
(evil-define-key 'normal 'global (kbd "<leader>wj") 'windmove-down)
(evil-define-key 'normal 'global (kbd "<leader>wk") 'windmove-up)
(evil-define-key 'normal 'global (kbd "<leader>wl") 'windmove-right)
;; Atajos con leader key para frames
(evil-define-key 'normal 'global (kbd "<leader>0") 'delete-window)
(evil-define-key 'normal 'global (kbd "<leader>1") 'delete-other-windows)
(evil-define-key 'normal 'global (kbd "<leader>2") 'split-window-below)
(evil-define-key 'normal 'global (kbd "<leader>3") 'split-window-right)
(evil-define-key 'normal 'global (kbd "<leader>kb") 'kill-buffer)
(evil-define-key 'normal 'global (kbd "<leader>wb") 'winner-undo)
(evil-define-key 'normal 'global (kbd "<leader>nb") 'winner-redo)
;; Cambiar el cursor según el estado
(setq evil-emacs-state-cursor 'bar)
(setq evil-motion-state-cursor 'bar)
(setq evil-normal-state-cursor 'box)
(setq evil-visual-state-cursor 'box)
(setq evil-insert-state-cursor 'bar)
(setq evil-replace-state-cursor 'hollow)
(setq evil-operator-state-cursor 'hollow)
;; Establecer modos por defecto en algunos modos
(evil-set-initial-state 'shell-mode 'insert)
(evil-set-initial-state 'term-mode 'emacs)
(evil-set-initial-state 'help-mode 'emacs)
(evil-set-initial-state 'helm-grep-mode 'emacs)
(evil-set-initial-state 'grep-mode 'emacs)
(evil-set-initial-state 'dired-mode 'emacs)
(evil-set-initial-state 'Buffer-menu-mode 'emacs)
(evil-set-initial-state 'wdired-mode 'normal)
;; Por defecto usar emcas mode.
;;(setq evil-default-state 'emacs)
)
;; Edición múltiple con evil (Atajos por defecto: C-d y C-D)
(use-package evil-multiedit
:config
(evil-multiedit-default-keybinds)
)
;; Code Folding
(use-package origami
:config
(global-origami-mode))
;; Automcompletado
(use-package company
:bind (:map company-active-map
("<tab>" . company-indent-or-complete-common)) ; autocompletar con tab como se haría en bash-competition en la terminal de linux
(:map company-active-map
("<escape>" . company-abort)) ; cerrar las sugerencias de autocompletado precionando escape.
:config
(global-company-mode)
(setq company-dabbrev-downcase nil) ; autocompletado case-sensitive.
(setq company-idle-delay 0) ; mostrar autocompletado lo más rápido posible
(setq company-minimum-prefix-length 1) ; mostrar autocompletado desde que se coloca la primera letra.
(setq company-backends '((company-files :with company-yasnippet)
(company-capf :with company-yasnippet)
(company-dabbrev-code company-gtags company-etags company-keywords :with company-yasnippet)
(company-dabbrev :with company-yasnippet)))
)
;; Poner la info acerca del autocompletado del autocompletado mas rápido
(use-package company-quickhelp
:ensure t
:custom
(company-quickhelp-delay 2)
(company-quickhelp-mode))
;; Hacer que el autocompletado se vea más bonito con íconos
(use-package company-box
:hook (company-mode . company-box-mode))
;; Usar autocompletado con ctags y company
(use-package company-ctags
:config
(add-to-list 'company-backends '(company-ctags))
)
;; Snippets
(use-package yasnippet
:ensure t
:custom
(yas-prompt-functions '(yas-completing-prompt))
:config
(yas-reload-all)
:hook
((prog-mode feature-mode) . yas-minor-mode))
;; Restaurar el estado de los frames
(use-package winner
:init
(winner-mode 1))
(use-package lsp-mode
:defer t
:hook (js-mode . lsp)
:custom
(lsp-headerline-breadcrumb-enable nil))
(use-package lsp-ui)
;; Revisar sintaxis en vivo
(use-package flycheck
;; :diminish flycheck-mode
:hook (after-init . global-flycheck-mode) ; Habilitar flycheck en todos los modos
)
;; Mostrar los errores de flycheck en un pop up
(use-package flycheck-popup-tip
:hook (flycheck-mode . flycheck-popup-tip-mode))
;; Un bonito y sencillo panel de inicio
(use-package dashboard
:config
(setq dashboard-set-file-icons t)
(setq dashboard-startup-banner
(expand-file-name "duck-small.png" user-emacs-directory))
(setq dashboard-items '(
;;(recents . 5)
;;(projects . 5)
))
(dashboard-setup-startup-hook)
)
;; Autocompletado para shell scripting.
(use-package company-shell
:config
(add-to-list 'company-backends '(company-shell company-shell-env company-fish-shell))
)
;; Autocompletado para el minibuffer (counsel e ivy)
(use-package counsel
:bind
("M-x" . counsel-M-x)
("C-x C-m" . counsel-M-x)
("C-x C-f" . counsel-find-file)
("C-x c k" . counsel-yank-pop))
(use-package projectile
:diminish projectile-mode
:config
(projectile-mode)
:custom ((projectile-completion-system 'ivy))
:bind-keymap
("C-c p" . projectile-command-map)
:init
;; Rutas de archivos temporales.
(setq projectile-cache-file (expand-file-name "projectile.cache" temp-dir))
(setq projectile-known-projects-file (expand-file-name
"projectile-bookmarks.eld" temp-dir))
;; Carpetas donde tienes tus proyectos (deben tener un archivo .projectile o un repro git iniciado).
(when (file-directory-p "~/Proyectos")
(setq projectile-project-search-path '("~/Proyectos")))
(when (file-directory-p "~/Docker/Nginx")
(setq projectile-project-search-path (append
projectile-project-search-path
'("~/Docker/Nginx"))))
(when (file-directory-p "~/Docker/Nginx2")
(setq projectile-project-search-path (append
projectile-project-search-path
'("~/Docker/Nginx2"))))
(when (file-directory-p "~/Docker/NginxTwitch")
(setq projectile-project-search-path (append
projectile-project-search-path
'("~/Docker/NginxTwitch"))))
(setq projectile-switch-project-action #'projectile-dired) ; Usar dired cuando se elija un proyecto.
;; Cambiar el título de la ventana de emacs
(setq frame-title-format
'(
(:eval
(let ((project-name (projectile-project-name)))
(unless (string= "-" project-name)
(format "[%s] " project-name))))
"%b"
" - Emacs")
)
)
;; Autocompletado de proyectos en counsel (projectile)
(use-package counsel-projectile
:config
(global-set-key (kbd "C-x v") 'counsel-projectile)
(counsel-projectile-mode))
;; Mostrar info del panel inferior de otra manera
(use-package ivy
:bind
("C-x s" . swiper)
("C-x C-r" . ivy-resume)
("C-x b" . ivy-switch-buffer)
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers nil)
(define-key ivy-minibuffer-map (kbd "TAB") 'ivy-partial)
(define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
(define-key ivy-minibuffer-map (kbd "<escape>") 'minibuffer-keyboard-quit)
)
;; Iconos en Ivy (allthe icons)
(use-package all-the-icons-ivy-rich
:ensure t
:init (all-the-icons-ivy-rich-mode 1)
:config
(setq all-the-icons-ivy-rich-color-icon t))
(use-package ivy-rich
:ensure t
:init (ivy-rich-mode 1))
;; Cuando iniicias un atajo de teclas te muestra las posibilidades
(use-package which-key
:config
(which-key-mode))
;; Autocompletado de parentesis, corchetes, llaves, etc.
(use-package smartparens
:config
(smartparens-global-mode t))
(use-package terminal-here
:init
(global-set-key (kbd "C-<f5>") #'terminal-here-launch)
:config
(setq terminal-here-linux-terminal-command 'gnome-terminal) ;; Configuramos que user gnome-terminal por defecto
)
;; Org-Mode
(defun efs/org-font-setup ()
"ORG font faces setup."
;; Set faces for heading levels
(dolist (face '((org-level-1 . 1.2)
(org-level-2 . 1.1)
(org-level-3 . 1.05)
(org-level-4 . 1.0)
(org-level-5 . 1.1)
(org-level-6 . 1.1)
(org-level-7 . 1.1)
(org-level-8 . 1.1)))
(set-face-attribute (car face) nil :font "Cantarell" :weight 'regular :height (cdr face)))
;; Ensure that anything that should be fixed-pitch in Org files appears that way
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
(defun efs/org-mode-setup ()
"Set some configs on 'org-mode'."
(display-line-numbers-mode 0)
(org-indent-mode)
(variable-pitch-mode 1)
(visual-line-mode 1)
(setq evil-auto-indent nil)
)
(use-package org
:pin org
:hook (org-mode . efs/org-mode-setup)
:config
(setq org-ellipsis "")
(setq org-hide-emphasis-markers t)
(setq org-agenda-start-with-log-mode t)
(setq org-log-done 'time)
(setq org-log-into-drawer t)
;; Palabras claves del To Do de org-mode
(setq org-todo-keywords
;;'((sequence "☐" "✔" "⌛" "❌")))
'((sequence "TODO(t)" "DOING(n)" "WAITING(w)" "|" "DONE(d!)" "CANCELED(c!)")))
(setq org-todo-keyword-faces
'(("TODO" . "#ff6464")
("DOING" . "yellow")
("DONE" . "green")
("WAITING" . "orange")
("CANCELED" . "#aaa"))
)
;; Archivos a usarse en org-agenda
(setq org-agenda-files
'("~/Proyectos/ORGenda/Ideas.org"
"~/Proyectos/ORGenda/IdeasTwitch.org"
"~/Proyectos/ORGenda/Proyectos.org"
"~/Proyectos/ORGenda/Tareas.org")
)
;; Archivos entre los que se moverán las tareas
(setq org-refile-targets
'(("Archivo.org" :maxlevel . 1)
("Proyectos.org" :maxlevel . 1)
("IdeasTwitch.org" :maxlevel . 1)
("Ideas.org" :maxlevel . 1)
("Tareas.org" :maxlevel . 1)))
;; Guardar los archivos cuando se muevan tareas entre ellos
(advice-add 'org-refile :after 'org-save-all-org-buffers)
(setq org-capture-templates
`(("t" "Tareas / Projectos")
("tt" "Tareas" entry (file+olp "~/Proyectos/ORGenda/Tareas.org")
"* TODO %?\n %U\n %a\n %i" :empty-lines 1)
("tp" "Proyectos" entry (file+olp "~/Proyectos/ORGenda/Proyectos.org")
"* TODO %?\n %U\n %a\n %i" :empty-lines 1)
("i" "Ideas")
("ii" "Ideas General" entry
(file+olp "~/Proyectos/ORGenda/ideas.org")
"* TODO %?\n %a\n %i" :empty-lines 1)
("it" "Ideas Twitch" entry
(file+olp "~/Proyectos/ORGenda/IdeasTwitch.org")
"* TODO %?\n %a\n %i" :empty-lines 1)
)
)
(efs/org-font-setup))
(use-package org-superstar
:hook
(org-mode . org-superstar-mode)
:config
(setq org-superstar-special-todo-items t)
)
(defun efs/org-mode-visual-fill ()
"Visual mode fill columns."
(visual-fill-column-mode 1))
(use-package visual-fill-column
:hook (org-mode . efs/org-mode-visual-fill)
:config
;; Tamaño de la columna
(setq visual-fill-column-width 150)
;; Centrar el texto
(setq-default visual-fill-column-center-text t)
)
(provide 'base-extensions)
;;; base-extensions.el ends here

46
configs/base-functions.el Normal file
View File

@ -0,0 +1,46 @@
(provide 'base-functions)
;; Buscar el texto actualmente seleccionado
(defun kj-isearch-with-region ()
"Use region as the isearch text."
(when mark-active
(let ((region (funcall region-extract-function nil)))
(deactivate-mark)
(isearch-push-state)
(isearch-yank-string region))))
(add-hook 'isearch-mode-hook #'kj-isearch-with-region)
;; Borrar espacios, tabs y saltos de línea innecesarios al guardar
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Generar archivo TAGS
(defun create-tags (dir-name)
"Create tags file."
(interactive "DDirectory: ")
(shell-command
(format "cd '%s' && ctags -f TAGS -e -R --exclude=*.min.js"
(directory-file-name (file-truename dir-name))
)
)
(message "Archivo TAGS generado.")
)
;; Hacer emacs transparente (no funciona perfecto, pero sirve)
(defun toggle-transparency ()
(interactive)
(let ((alpha (frame-parameter nil 'alpha)))
(set-frame-parameter
nil 'alpha
(if (eql (cond ((numberp alpha) alpha)
((numberp (cdr alpha)) (cdr alpha))
;; Also handle undocumented (<active> <inactive>) form.
((numberp (cadr alpha)) (cadr alpha)))
100)
'(60 . 60) '(100 . 100)))))
(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))

29
configs/base-keys.el Normal file
View File

@ -0,0 +1,29 @@
;;; base-keys.el --- Archivo de configuración de atajos
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;; Aquí se configuran los atajos globales.
;; Es posible que haya otros, ya que muchos se configuran
;; directamente en los paquetes/extensiones y dependen de los mismos.
;;; Code:
(define-key minibuffer-local-map (kbd "<escape>")
'keyboard-escape-quit) ; Cancelar el minibuffer con un solo ESC.
(global-set-key (kbd "C-x C-z") nil) ; Unbind C-x C-z (don't minimize)
(global-set-key (kbd "C-a") 'mark-whole-buffer) ; Seleccionar todo con CTRL+A.
(global-set-key (kbd "M-c") 'comment-or-uncomment-region) ; Comentar/descomentar en lote
(global-set-key (kbd "C-<f6>") 'create-tags) ; Generar o Regeneral el archivo TAGS
(global-set-key (kbd "C-<f11>") 'toggle-frame-maximized) ; Maximizar / restaurar
(global-set-key (kbd "C-c a") 'org-agenda) ; Abrir la agenda.
(global-set-key (kbd "C-c c") 'org-capture) ; Abrir la crear una entrada.
(provide 'base-keys)
;;; base-keys.el ends here

124
configs/base.el Normal file
View File

@ -0,0 +1,124 @@
;;; base.el --- Configuración base de emacs
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;; Configuración base de Emacs, no incluye extensiones,
;; pero si el theme y los fonts.
;;; Code:
;; The default is 800 kilobytes. Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))
;; Initialize package sources
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize)
;; Actualizar repositorios si aún no esta actualizados
(unless package-archive-contents
(package-refresh-contents))
;; Instalar use-package si no está instalado
(unless (package-installed-p 'use-package)
(package-install 'use-package))
;; Theme
(use-package dracula-theme
:config
(load-theme 'dracula t)
(set-face-attribute 'default nil :font "Fira Code Retina") ; Font
)
;; Instalar use-package en caso de no tenerlo
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(defconst private-dir (expand-file-name "private" user-emacs-directory))
(defconst temp-dir (format "%s/cache" private-dir)
"Hostname-based elisp temp directories.")
;; UTF-8 please
(set-charset-priority 'unicode)
(setq locale-coding-system 'utf-8) ; pretty
(set-terminal-coding-system 'utf-8) ; pretty
(set-keyboard-coding-system 'utf-8) ; pretty
(set-selection-coding-system 'utf-8) ; please
(prefer-coding-system 'utf-8) ; with sugar on top
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
;; Emacs customizations
(menu-bar-mode 0) ; Quitar menús.
(tool-bar-mode 0) ; Quitar toolbar.
(scroll-bar-mode -1) ; Quitar scrollbar.
(tooltip-mode -1) ; Disable tooltips.
(global-display-line-numbers-mode) ; Mostar número de línea.
(show-paren-mode 1) ; Habilitar resaltado de brackets.
;;(cua-mode t) ; Usar CTRL+X, CTRL+C, CTRL+V y CTRL+Z para cortar, copiar, pegar y deshacer.
(setq-default
cursor-type 'bar ; Usar la barrita como cursor
cursor-in-non-selected-windows nil ; Desaparecer el cursor en frames no activos.
indent-tabs-mode nil ; Cambiar tabs por espacios.
)
(setq
custom-file (concat private-dir "/.custom.el") ; Cabiar la ruta del código que se genera al isntalar un theme o package
ac-ignore-case nil ; Desactivar el autocapitalizado.
ac-disable-faces nil ; Auto-complete hablitado incluso entre comillas (fuente: https://bit.ly/3a9wCB4).
global-hl-line-mode 1 ; Resaltar línea actual por defecto.
tags-revert-without-query 1 ; Recargar tags (ctags) sin pedir confirmación.
)
;; Backups enabled, use nil to disable
(setq
history-length 1000
backup-inhibited nil
make-backup-files nil
auto-save-default nil
auto-save-list-file-name (concat temp-dir "/autosave")
create-lockfiles nil
backup-directory-alist `((".*" . ,(concat temp-dir "/backup/")))
auto-save-file-name-transforms `((".*" ,(concat temp-dir "/auto-save-list/") t)))
;; Configuración cuando es un server
(defun setup-daemon ()
(message "Corriendo en modo daemon.")
(set-face-attribute 'default nil :font "Fira Code Retina")
;; Set the fixed pitch face
;;(set-face-attribute 'fixed-pitch nil :font "Fira Code Retina")
;; Set the variable pitch face
;;(set-face-attribute 'variable-pitch nil :font "Cantarell" :weight 'regular)
;; Abrir primero el dashboard
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
;; Cerrar buffers al cerrar emacsclient
(add-hook 'delete-frame-functions
(lambda (frame)
(let* ((window (frame-selected-window frame))
(buffer (and window (window-buffer window))))
(when (and buffer (buffer-file-name buffer))
(kill-buffer buffer)))))
)
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(setup-daemon))))
(message "Corriendo en modo normal."))
(load custom-file)
(provide 'base)
;;; base.el ends here

14
configs/lang-go.el Normal file
View File

@ -0,0 +1,14 @@
;;; lang-go.el --- Configuración para el lenguaje go
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;;; Code:
(use-package go-mode
:defer t)
(provide 'lang-go)
;;; lang-go.el ends here

28
configs/lang-js.el Normal file
View File

@ -0,0 +1,28 @@
;;; lang-js.el --- Configuración para el lenguaje Javascript
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;;; Code:
(use-package js
:defer t
:mode
("\\.js$" . js-mode)
:config
(setq js-indent-level 2))
;; json-mode
(use-package json-mode
:defer t
:ensure t
:mode
("\\.json$" . json-mode)
:config
(setq js-indent-level 2))
(provide 'lang-js)
;;; lang-js.el ends here

30
configs/lang-php.el Normal file
View File

@ -0,0 +1,30 @@
;;; lang-php.el --- Configuración para el lenguaje PHP
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;;; Code:
(use-package company-php :defer t)
(use-package ac-php :defer t)
(use-package php-mode
:defer t
:bind ("<C-tab>" . php-doc-block)
:config
(add-hook 'php-mode-hook #'(lambda()
(php-enable-default-coding-style)
(company-mode t) ; habilita company mode
(ac-php-core-eldoc-setup) ; habilita soporte para ELDoc
(add-to-list 'company-backends 'company-ac-php-backend) ; Agregar ac-php para a company
))
)
(use-package php-doc-block
:load-path (lambda() (concat private-dir "/packages/php-doc-block"))
)
(provide 'lang-php)
;;; lang-php.el ends here

BIN
duck-small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

21
emacs-client-runner.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# start emacs server if not is running
systemctl --user status emacs > /dev/null 2>&1 || systemctl --user start emacs > /dev/null 2>&1
# if args is -nw or -t run on terminal
if [ "$1" == "-t" ] || [ "$1" == "-nw" ]; then
emacsclient -t
exit
fi
# if no args open new frame
if [ $# -eq 0 ]; then
emacsclient -c -n
emacsclient --eval "(progn (select-frame-set-input-focus (selected-frame)))"
exit
fi
emacsclient -e "(frames-on-display-list \"$DISPLAY\")" &>/dev/null
emacsclient -c -n "$*"

24
init.el Normal file
View File

@ -0,0 +1,24 @@
;;; init.el --- Init de emacs ordenado
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;; Desde aquí se cargan todos los archivos de la carpeta config.
;;; Code:
(add-to-list 'load-path (concat user-emacs-directory "configs"))
(require 'base)
(require 'base-extensions)
(require 'base-functions)
(require 'base-keys)
(require 'lang-php)
(require 'lang-js)
(require 'lang-go)
(provide 'init)
;;; init.el ends here

View File

@ -0,0 +1,120 @@
;;; php-doc-block.el --- Php DocBlock generator
;; Copyright (C) 2016 Dmitriy Moskalyov
;; Author: Dmitriy Moskalyov <moskalyovd@gmail.com>
;; Keywords: php docblock
;; Version: 0.0.1
;; URL: https://github.com/moskalyovd/emacs-php-doc-block
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This package provides php DocBlock generator.
;; How to use:
;; Clone repository from https://github.com/moskalyovd/emacs-php-doc-block
;; and add to your .emacs(or init.el) file:
;; (add-to-list 'load-path "~/.emacs.d/emacs-php-doc-block")
;; (require 'php-doc-block)
;; Then bind command 'php-doc-block to any key you like:
;; (add-hook 'php-mode-hook
;; (lambda ()
;; (local-set-key (kbd "<C-tab>") 'php-doc-block)))
;;; Code:
(defun insert-to-prev-line-and-indent (text)
"Insert TEXT to the previous line with indentation."
(beginning-of-line)
(open-line 1)
(insert text)
(indent-according-to-mode))
(defun insert-to-next-line-and-indent (text)
"Insert TEXT to the next line with indentation."
(end-of-line)
(newline-and-indent)
(insert text)
(indent-according-to-mode))
(defun php-doc-block-var-or-attr (tag-type type name value is-nullable)
"Insert doc block for a property or an attribute"
(cond
((and value (= (string-width type) 0))
(cond
((string-match "^=\s*\\(array(.*)\\|\\[\.*\]\\)" value) (setq type "array"))
((string-match "^=\s*\[0-9\]*\\.\[0-9\]+$" value) (setq type "float"))
((string-match "^=\s*\[0-9\]+$" value) (setq type "int"))
((string-match "^=\s*\['\"]" value) (setq type "string"))
((string-match "^=\s*\\(true\\|false\\)" value) (setq type "bool"))))
((and (= (string-width type) 0) (not value))
(setq type "mixed")))
(when (equal is-nullable "?")
(setq type (concat type "|null")))
(insert-to-next-line-and-indent (concat "* @" tag-type " " type " " name)))
(defun php-doc-block-function (name arguments return-type is-return-nullable)
"Insert php docblock for function"
(insert-to-next-line-and-indent (concat "* " name))
(when (> (string-width arguments) 0)
(insert-to-next-line-and-indent "*")
(dolist (arg (split-string arguments "\s*,\s*"))
(string-match "\s*\\(\[\?\]?\\)\s*\\(\[\\\]?\[a-zA-Z0-9_\]*\\)?\s*\\($\[a-zA-Z0-9_\]+\\)\s*\\(=.*\\)?" arg)
(php-doc-block-var-or-attr "param" (match-string 2 arg) (match-string 3 arg) (match-string 4 arg) (match-string 1 arg))))
(when (> (string-width return-type) 0)
(insert-to-next-line-and-indent "*")
(when (equal is-return-nullable "?")
(setq return-type (concat return-type "|null")))
(insert-to-next-line-and-indent (concat "* @return " return-type))))
(defun php-doc-block-class (type name)
"Insert php doc block for class, interface etc."
(insert-to-next-line-and-indent (concat "* " name " " type)))
(defun php-doc-block ()
"Insert php docblock."
(interactive)
(let ((line (thing-at-point 'line)))
(insert-to-prev-line-and-indent "/**")
(cond
((string-match "function\s*" line)
(beginning-of-line)
(let ((line (thing-at-point 'line)) (func-defun "") (s-point (point)) (e-point (re-search-forward ";\\|{" nil '(nil))))
(goto-char s-point)
(if e-point
(setq func-defun (replace-regexp-in-string "{\\|\n" "" (buffer-substring s-point e-point)))
(progn
(end-of-line)
(setq func-defun (buffer-substring s-point (point))))
)
(when (string-match "function\s+\\([A-Za-z0-9_]+\\)\s*(\\(.*\\))\s*:*\s*\\(\[\?\]?\\)\s*\\(\[A-Za-z0-9_\\\]*\\)" func-defun)
(php-doc-block-function (match-string 1 func-defun) (match-string 2 func-defun) (match-string 4 func-defun) (match-string 3 func-defun)))))
((string-match "\s*\\([a-zA-Z0-9_]+\\)?\s*\\($\[a-zA-Z0-9_\]+\\)\s*\\(=\[^;\]*\\)?" line)
(php-doc-block-var-or-attr "var" "" (match-string 2 line) (match-string 3 line) ""))
((string-match "\\(class\\|interface\\|trait\\|abstract class\\)\s+\\(\[a-zA-Z0-9_\]+\\)" line)
(php-doc-block-class (match-string 1 line) (match-string 2 line))))
(insert-to-next-line-and-indent "*/")))
(provide 'php-doc-block)
;;; php-doc-block.el ends here

61
readme.md Normal file
View File

@ -0,0 +1,61 @@
# Configuración de Emacs actual
Esta configuración para emacs se podría decir que es la heredera de mi [configuración de emacs inicial](https://git.kj2.me/kj/confi-emacs-inicial), la cual ya llevaba tiempo necesitando una manita de gato para arreglar y mejorar algunas cosas que me resultan cómodas para el uso, ademas de comenzar a utilizar `evil-mode`. Esta configuración bien podría haber sido una rama de la inicial, pero he decidido hacer uno nuevo y si es neceario hacer aquí las ramas.
## Instalación
Si deseas clonar mi configuración, puedes clonar este repositorio:
`git clone --depth 1 https://git.kj2.me/kj/confi-emacs-actual.git ~/.emacs.d`
Instalación de fonts necesarios:
`sudo apt install fonts-firacode fonts-cantarell`
Al igual que la versión anterior, puede ser necesario ejecutar el siguiente comando en el minibuffer para tener bien los íconos de neotree:
`all-the-icons-install-fonts`
Y eso sería todo.
## Usar el modo daemon
El modo daemon permite a emacs cargar mucho más rápido, puesto que con ello evitas volver a cargar la configuración cada vez que abres un nuevo archivo. Si quieres aprender mas sobre esto, puedes revisarlo en la [dococumentación de emacs](https://www.emacswiki.org/emacs/EmacsAsDaemon).
Para iniciar el daemon, puedes hacerlo desde la terminal ejecutando:
`sudo systemctl --user start emacs`
Del mismo modo, igual es recomendable habilitar el autoinicio de este servicio junto con el sistema:
`sudo systemctl --user enable emacs`
Finalmente, para abrirlo, es necesaria la usar `emacsclient` en lugar de `emacs`, para hacer que eso suceda en todo el sistema se puede realizar el siguiente hack copiando el archivo `emacs-client-runner.sh` a `/usr/local/bin/` con el nombre `emacs` de la siguiente manera:
`sudo cp ~/.emacs.d/emacs-client-runner.sh /usr/local/bin/emacs`
**🔴 Advertencia:** Esto reemplazará emacs por emacsclient, si deseas usar emacs podrás hacerlo mediante: `/bin/emacs`
**Extra:** Con este hack, para abrir emacs en modo terminal puedes ejecutar: `emacsclient -t`, `emacs -t` o `emacs -nw`.
## Consideraciones
- Toda la configuración la he realizado en los archivos que están en los archivos de la carpeta config, el archivo `init.el` solo los llama y no guarda nada más aparte de eso.
- Puede tener activado `evil-mode` (A veces lo activo, pues quiero terminar usándolo siempre), por lo que si no lo quieres tener, recomiendo comentar la línea que lo activa (`(evil-mode 1)`) o directamente toda la sección en `base-extensions.el` que cofigura evil.
- Se puede activar/desactivar `cua-mode` (`configs/base.el`, línea 49) activado para poder copiar, cortar, pegar y deshacer cambios con las combinaciones típicas en lugar de las de emacs.
- Con F9 puedes abrir y cerrar neotree.
- Con C-F11 puedes maximizar/restaurar.
- Con C-F6 se generan/regenera el archivo TAGs.
- Con C-F5 se abre una terminal en la carpeta del archivo actual.
- Con M-c se puede comentar / descomentar un región.
- Por defecto he configurado que al presionar TAB se usen 2 espacios en su lugar.
- Cuando usas `C-s` (buscar), busca el texto actualmente seleccionado.
Recuerda que si alguna cosa no te gusta, puedes cambiarla a gusto. Esta configuración fue hecha para mi uso personal y puede que tenga cosas que solo a mi me parecen cómodas/útiles.
## Contacto
Si se tiene alguna pregunta o quieres comentarme alguna corrección, puesto que este git no está abierto a registro, puedes contactarme mediante:
E-mail: webmaster@outcontol.net
Telegram: [https://t.me/keyjay](https://t.me/keyjay)

6
snippets/css-mode/import Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: @import
# key: imp
# uuid: imp
# --
@import "`(doom-snippets-text nil t)`$0";

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: @import url("//fonts.googleapis...")
# key: impfont
# uuid: impfont
# --
@import url("http://fonts.googleapis.com/css?family=${1:Open+Sans}");

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: @import url(...)
# key: impurl
# uuid: impurl
# --
@import url("`(doom-snippets-text nil t)`$0");

6
snippets/css-mode/margin Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: margin: ...;
# key: mar
# uuid: mar
# --
margin: ${1:0 auto};

8
snippets/css-mode/media Normal file
View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: @media
# key: med
# uuid: med
# --
@media ${1:screen} {
`%`$0
}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: @media (orientation: ?)
# condition: (looking-back "@media " (line-beginning-position))
# --
(orientation: ${1:landscape})

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: @media print { ... }
# --
@media print {
`%`$0
}

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: padding: ...;
# key: pad
# uuid: pad
# --
padding: ${1:10px};

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: ...: ...;
# key: :
# uuid: :
# --
${1:prop}: ${2:`%`};

4
snippets/go-mode/append Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: append
# --
${1:type} = append($1, ${2:elems})

6
snippets/go-mode/coloneq Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: ... := ...
# key: :=
# uuid: :=
# --
${1:x} := ${2:`%`}

5
snippets/go-mode/const Normal file
View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# contributor: Seong Yong-ju
# name: const ... = ...
# --
const ${1:name}${2: type} = ${3:value}$0

4
snippets/go-mode/ctxc Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: ctx context.Context
# --
ctx context.Context

6
snippets/go-mode/f Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: func ...(...) ... { ... }
# --
func ${1:name}(${2:args})${3: return type} {
`%`$0
}

6
snippets/go-mode/fm Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: func (target) name(args) (results) { ... }
# --
func (${1:target}) ${2:name}(${3:args})${4: return type} {
$0
}

6
snippets/go-mode/for Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: for ... { ... }
# --
for $1 {
`%`$0
}

6
snippets/go-mode/fore Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: for key, value := range ... { ... }
# --
for ${1:key}, ${2:value} := range ${3:target} {
`%`$0
}

6
snippets/go-mode/foreach Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: for key, value := range ... { ... }
# --
for ${1:key}, ${2:value} := range ${3:target} {
`%`$0
}

6
snippets/go-mode/fori Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: for i := 0; i < n; i++ { ... }
# --
for ${1:i} := ${2:0}; $1 < ${3:10}; $1++ {
`%`$0
}

6
snippets/go-mode/forw Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: for ... { ... }
# --
for $1 {
`%`$0
}

6
snippets/go-mode/func Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: func ...(...) ... { ... }
# --
func ${1:name}(${2:args})${3: return type} {
`%`$0
}

4
snippets/go-mode/go Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: go
# --
go ${1:func}(${2:args})$0

6
snippets/go-mode/gof Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: go func
# --
go func (${1:args}) {
$0
}(${2:values})

6
snippets/go-mode/gofunc Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: go func (short)
# --
go func (${1:args}) {
$0
}(${2:values})

7
snippets/go-mode/if Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# contributor: Seong Yong-ju
# name: if ... { ... }
# --
if ${1:condition} {
`%`$0
}

9
snippets/go-mode/ife Normal file
View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# contributor: Seong Yong-ju
# name: if ... { ... } else { ... }
# --
if ${1:condition} {
`%`$2
} else {
$0
}

6
snippets/go-mode/iferr Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: if err != nil { ... }
# --
if err != nil {
`%`$0
}

4
snippets/go-mode/imp Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: import
# --
import ${1:package}$0

4
snippets/go-mode/import Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: import
# --
import ${1:package}$0

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: type ... interface { ... }
# --
type $1 interface {
`%`$0
}

6
snippets/go-mode/main Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: func main() { ... }
# --
func main() {
$0
}

4
snippets/go-mode/map Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: map
# --
map[${1:KeyType}]${2:ValueType}

6
snippets/go-mode/method Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: func (target) name(args) (results) { ... }
# --
func (${1:target}) ${2:name}(${3:args})${4: return type} {
$0
}

4
snippets/go-mode/package Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: package
# --
package ${1:`(car (last (split-string (file-name-directory buffer-file-name) "/") 2))`}

4
snippets/go-mode/pkg Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: package (short)
# --
package ${1:`(car (last (split-string (file-name-directory buffer-file-name) "/") 2))`}

4
snippets/go-mode/pr Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: printf
# --
fmt.Printf("$1\n"${2:, ${3:str}})

4
snippets/go-mode/printf Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: printf
# --
fmt.Printf("$1\n"${2:, ${3:str}})

4
snippets/go-mode/println Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: println
# --
fmt.Println("${1:msg}")$0

4
snippets/go-mode/prln Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: println (short)
# --
fmt.Println("${1:msg}")$0

7
snippets/go-mode/select Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: select
# --
select {
case ${1:cond}:
$0
}

6
snippets/go-mode/struct Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: type ... struct { ... }
# --
type $1 struct {
`%`$0
}

9
snippets/go-mode/switch Normal file
View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: switch
# key: switch
# uuid: switch
# --
switch {
case ${1:cond}:
$0
}

6
snippets/go-mode/test Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: func Test...() { ... }
# --
func Test${1:Name}(${2:t *testing.T}) {
`%`$0
}

4
snippets/go-mode/var Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: var
# --
var ${1:name} ${2:type} = ${3:value}$0

6
snippets/go-mode/while Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name : for ... { ... }
# --
for $1 {
`%`$0
}

4
snippets/go-mode/wr Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: http request writer
# --
w http.ResponseWriter, r *http.Request

6
snippets/html-mode/dd Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# contributor: Rodrigo Setti <rodrigosetti@gmail.com>
# name: <dd> ... </dd>
# group: list
# --
<dd>$1</dd>

8
snippets/html-mode/dl Normal file
View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# contributor: Rodrigo Setti <rodrigosetti@gmail.com>
# name: <dl> ... </dl>
# group: list
# --
<dl>
$0
</dl>

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Doctype HTML 5
# group: meta
# --
<!DOCTYPE html>

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: DocType XHTML 1.0 frameset
# group: meta
# --
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: DocType XHTML 1.1
# group: meta
# --
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: DocType XHTML 1.0 Strict
# group: meta
# --
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: DocType XHTML 1.0 Transitional
# group: meta
# --
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

6
snippets/html-mode/dt Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# contributor: Rodrigo Setti <rodrigosetti@gmail.com>
# name: <dt> ... </dt>
# group: list
# --
<dt>$1</dt>

7
snippets/html-mode/form Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# contributor: Jimmy Wu <frozenthrone88@gmail.com>
# name: <form method="..." id="..." action="..."></form>
# --
<form method="$1" id="$2" action="$3">
$0
</form>

7
snippets/html-mode/html Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# contributor: Jimmy Wu <frozenthrone88@gmail.com>
# name: <html>...</html>
# --
<html>
$0
</html>

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# contributor: Jimmy Wu <frozenthrone88@gmail.com>
# name: <html xmlns="...">...</html>
# --
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${1:en}" lang="${2:en}">
$0
</html>

6
snippets/html-mode/link Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: <link rel="stylesheet" ... />
# key: link
# uuid: link
# --
<link rel="${1:stylesheet}" href="${2:url}" type="${3:text/css}" media="${4:screen}" />

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: <!--[if IE]><link stylesheet="..." /><![endif]-->
# --
<!--[if IE${1: version}]>
<link rel="${2:stylesheet}" href="${3:url}" type="${4:text/css}" media="${5:screen}" />
<![endif]-->

View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: <a href="mailto:...@...">...</a>
# --
<a href="mailto:${1:john@doe.com}">`(doom-snippets-format "%n%s%n")`$0</a>

6
snippets/html-mode/meta Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# contributor : Jimmy Wu <frozenthrone88@gmail.com>
# group: meta
# name: <meta name="..." content="..." />
# --
<meta name="${1:generator}" content="${2:content}" />

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# contributor: Jimmy Wu <frozenthrone88@gmail.com>
# name: <meta http-equiv="..." content="..." />
# group: meta
# --
<meta name="${1:Content-Type}" content="${2:text/html; charset=UTF-8}" />

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: <script type="text/javascript">...</script>
# --
<script type="text/javascript">
$0
</script>

View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
# name: <script type="text/javascript" src="..."></script>
# --
<script type="text/javascript" src="$1"></script>

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# contributor: Jimmy Wu <frozenthrone88@gmail.com>
# name: <textarea ...></textarea>
# --
<textarea name="$1" id="$2" rows="$3" cols="$4" tabindex="$5"></textarea>

6
snippets/html-mode/th Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# contributor: Jimmy Wu <frozenthrone88@gmail.com>
# name: <th>...</th>
# group: table
# --
<th$1>$2</th>

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: param
# key: @param
# uuid: @param
# condition: (sp-point-in-comment)
# --
@param ${1:paramater} $0

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: return
# key: @return
# uuid: @return
# condition: (sp-point-in-comment)
# --
@return ${1:description}

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: apr_assert
# key: apr_assert
# uuid: apr_assert
# --
if (Globals.useAssertions) {
${1:assert ..};
}

8
snippets/java-mode/class Normal file
View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: class
# key: class
# uuid: class
# --
${1:public }class ${2:`(f-base buffer-file-name)`} {
$0
}

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: constructor
# key: __init__
# uuid: __init__
# --
public ${1:`(f-base buffer-file-name)`}($2) {
$0
}

9
snippets/java-mode/doc Normal file
View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: doc
# key: /*
# uuid: /*
# condition: (not (use-region-p))
# --
/**
* $0
*/

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: equals
# key: eq
# uuid: eq
# --
public boolean equals(${1:Class} other) {
$0
}

View File

@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: file_class
# key: file
# uuid: file
# --
public class ${1:`(file-name-base
(or (buffer-file-name)
(buffer-name)))`} {
$0
}

8
snippets/java-mode/for Normal file
View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: for
# key: for
# uuid: for
# --
for (${1:int i = 0}; ${2:i < N}; ${3:i++}) {
`%`$0
}

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: foreach
# key: fore
# uuid: fore
# --
for (${1:Object} ${2:var} : ${3:iterator}) {
$0
}

9
snippets/java-mode/if Normal file
View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: if
# key: if
# uuid: if
# condition: (not (sp-point-in-string-or-comment))
# --
if (${1:true}) {
$0
}

10
snippets/java-mode/ife Normal file
View File

@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: ife
# key: ife
# uuid: ife
# --
if (${1:true}) {
`%`$2
} else {
$0
}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: import
# --
import ${1:System.};
$0

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: interface
# key: interface
# uuid: interface
# --
interface ${1:`(f-base buffer-file-name)`} {
$0
}

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: iterator
# key: iterator
# uuid: iterator
# --
public Iterator<${1:type}> iterator() {
$0
}

View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: javadoc
# key: doc
# uuid: doc
# --
/**
* $0
*
*/

8
snippets/java-mode/main Normal file
View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: main
# key: main
# uuid: main
# --
public static void main(String[] args) {
$0
}

View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: method
# key: method
# uuid: method
# condition: (not (sp-point-in-string-or-comment))
# --
${1:void} ${2:name}($3) {
$0
}

View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: @Override method
# key: method@
# uuid: method@
# condition: (not (sp-point-in-string-or-comment))
# --
@Override ${1:public} ${2:void} ${3:methodName}($4) {
$0
}

6
snippets/java-mode/new Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: new
# key: new
# uuid: new
# --
${1:Type} ${2:obj} = new ${3:$1}($4);$0

View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: paintComponent (Swing)
# key: paintComponent
# uuid: paintComponent
# condition: (not (sp-point-in-string-or-comment))
# --
@Override public void paintComponent(Graphics g) {
`%`$0
}

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: printf
# key: printf
# uuid: printf
# --
System.out.printf("`%`$0%n");

Some files were not shown because too many files have changed in this diff Show More