Compare commits

..

No commits in common. "master" and "1.0.1" have entirely different histories.

35 changed files with 364 additions and 546 deletions

View File

@ -1,13 +0,0 @@
# General configuration
EMACS_USER="LibreUser."
EMACS_EMAIL="user@example.org"
# Web browser
WEB_BROWSER_APP="iceweasel-uxp"
# Angular configuration
ANGULAR_SERVER_DIR="/usr/local/lib/node_modules/@angular/language-server"
NODEJS_MODULE_DIR="/usr/local/lib/node_modules"
REVEAL_JS_DIR="/path/to/reveal.js"
REVEAL_CSS_FILE="/path/to/highlight/night-owl.css"

View File

@ -1,39 +0,0 @@
name: git-sync-with-mirror
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
git-sync:
runs-on: ubuntu-latest
steps:
- name: git-sync
env:
git_sync_source_repo: git@git.fridu.us:heckyel/emacs-personal.git
git_sync_destination_repo: ssh://git@c.fridu.us/software/emacs-personal.git
if: env.git_sync_source_repo && env.git_sync_destination_repo
uses: astounds/git-sync@v1
with:
source_repo: git@git.fridu.us:heckyel/emacs-personal.git
source_branch: "master"
destination_repo: ssh://git@c.fridu.us/software/emacs-personal.git
destination_branch: "master"
source_ssh_private_key: ${{ secrets.GIT_SYNC_SOURCE_SSH_PRIVATE_KEY }}
destination_ssh_private_key: ${{ secrets.GIT_SYNC_DESTINATION_SSH_PRIVATE_KEY }}
- name: git-sync-sourcehut
env:
git_sync_source_repo: git@git.fridu.us:heckyel/emacs-personal.git
git_sync_destination_repo: git@git.sr.ht:~heckyel/emacs-personal
if: env.git_sync_source_repo && env.git_sync_destination_repo
uses: astounds/git-sync@v1
with:
source_repo: git@git.fridu.us:heckyel/emacs-personal.git
source_branch: "master"
destination_repo: git@git.sr.ht:~heckyel/emacs-personal
destination_branch: "master"
source_ssh_private_key: ${{ secrets.GIT_SYNC_SOURCE_SSH_PRIVATE_KEY }}
destination_ssh_private_key: ${{ secrets.GIT_SYNC_DESTINATION_SSH_PRIVATE_KEY }}

5
.gitignore vendored
View File

@ -5,12 +5,9 @@
.cache/
.litable-lists.el
.org-id-locations
.lsp-session-v1
.dap-breakpoints
.session
.smex-items
*.eld
.env
*~
/.mc-lists.el
\#*\#
@ -27,7 +24,6 @@ projectile*
recentf
session*
smex-items
snippets/
srecode-map.el
tramp
transient/
@ -37,4 +33,3 @@ vendor/
### Python Virtual ###
.python-environments/
elpy/

View File

@ -1,7 +1,7 @@
<h1 align="center">emacs-personal</h1>
Lightweight configuration of emacs with basic utilities plus personal configuration
![emacs-personal](https://archive.org/download/libreweb/emacs-personal-1.1.png?raw=true "emacs-personal")
![emacs-personal](https://archive.org/download/libreweb/emacs-personal-1.0.png?raw=true "emacs-personal")
### Installation
@ -11,64 +11,39 @@ First step:
#### Main mirror
1. `git clone https://c.fridu.us/software/emacs-personal.git ~/.emacs.d/`
2. `cp -v ~/.emacs.d/.env.example ~/.emacs.d/.env`
3. `emacs --batch --eval='(load-file "~/.emacs.d/init.el")'`
1. `git clone https://libregit.org/heckyel/emacs-personal.git ~/.emacs.d/`
2. `emacs --batch --eval='(load-file "~/.emacs.d/init.el")'`
#### Secundary mirror
1. `git clone https://git.sr.ht/~heckyel/emacs-personal ~/.emacs.d/`
2. `cp -v ~/.emacs.d/.env.example ~/.emacs.d/.env`
3. `emacs --batch --eval='(load-file "~/.emacs.d/init.el")'`
1. `git clone https://notabug.org/heckyel/emacs-personal.git ~/.emacs.d/`
### Requirements
* [x] ttf-hack
* [x] ttf-anonymous-pro
* [x] hyphen
* [x] hyphen-es
* [x] markdown
* [x] shellcheck
* [x] python-virtualenv
* [x] python-pylint
2. `emacs --batch --eval='(load-file "~/.emacs.d/init.el")'`
### Fonts
change the typography in the [init-gui.el](modules/init-gui.el#L54) file
`pacman -S ttf-hack` (for default)
`pacman -S ttf-anonymous-pro`
> change the typography in the [init-gui.el](modules/init-gui.el#L54) file
### Icons
```console
$ emacs --batch --eval="(progn (package-initialize)(package-install 'all-the-icons))"
```
emacs --batch --eval="(progn (package-initialize)(package-install 'all-the-icons))"
### Markdown Mode
- Require installed markdown in distro GNU+Linux, example:
Require installed markdown in distro GNU+Linux, example:
```console
$ apt install markdown
```
or
```console
$ pacman -S markdown
```
`apt install markdown` or `pacman -S markdown`
### Flycheck Mode
- Require installed the languages checking, example:
#### bash, sh
`pacman -S shellcheck` # bash, sh
```console
$ pacman -S shellcheck
```
#### python
```console
$ pacman -S python-pylint
```
`pacman -S python-pylint` # python
### Neotree
@ -81,17 +56,17 @@ So pressing `[f6]` will display
### Mode Python
- Require installed virtualenv:
$ pacman -S python-virtualenv
pacman -S python-virtualenv
- Enable or disable pyvenv-mode: <kdb>M-x</kdb> pyvenv-mode
- To create virtualenv from emacs:
$ pyvenv-create
pyvenv-create
- To activate virtualenv from emacs:
$ pyvenv-activate
pyvenv-activate
## Troubleshooting
@ -106,28 +81,16 @@ gpg: Imposible comprobar la firma: No public key
### Method 0
```console
$ gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40
```
gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40
### Method 1
Disable temp signature key
```console
$ sed -i "s|(setq package-check-signature 'allow-unsigned)|(setq package-check-signature nil)|g" "$HOME/.emacs.d/init.el"
```
```console
M-x package-install RET gnu-elpa-keyring-update RET
```
and enable signature key
```console
$ sed -i "s|(setq package-check-signature nil)|(setq package-check-signature 'allow-unsigned)|g" "$HOME/.emacs.d/init.el"
```
## Evaluate in buffer
<kbd>C-x</kbd> + <kbd>C-e</kbd>

View File

@ -3,8 +3,14 @@
;; 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.
'(anzu-deactivate-region t)
'(anzu-input-idle-delay 0.1)
'(anzu-replace-threshold 1000)
'(anzu-replace-to-string-separator " => ")
'(anzu-search-threshold 1000)
'(package-selected-packages
'(ox-reveal terraform-mode restclient load-env-vars dap-mode lsp-ui lsp-treemacs graphviz-dot-mode dokuwiki-mode dockerfile-mode dotenv-mode web-mode rainbow-mode yaml-mode vue-mode typescript-mode tide sass-mode smartparens lua-mode pkgbuild-mode py-autopep8 pip-requirements elpy projectile company-php php-mode php-refactor-mode go-mode markdown-mode eslintd-fix prettier-js json-mode js2-refactor js2-mode crystal-mode editorconfig nginx-mode emmet-mode whitespace-cleanup-mode log4j-mode ivy-hydra hydra ivy-rich counsel flycheck company-quickhelp company apache-mode dashboard neotree all-the-icons highlight-indent-guides doom-modeline diminish which-key undo-tree vscode-dark-plus-theme)))
(quote
(gnu-elpa-keyring-update git-gutter-fringe yaml-mode whitespace-cleanup-mode which-key web-mode vue-mode use-package undo-tree smartparens sass-mode rjsx-mode rainbow-mode py-autopep8 projectile pkgbuild-mode pip-requirements php-refactor-mode nlinum nginx-mode neotree markdown-mode log4j-mode less-css-mode json-mode js2-refactor ivy-rich ivy-hydra highlight-indent-guides gitignore-mode gitconfig-mode gitattributes-mode git-timemachine flycheck eslintd-fix emmet-mode elpy dotenv-mode doom-themes doom-modeline dokuwiki-mode diminish crystal-mode counsel company-quickhelp company-php apache-mode anzu))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.

59
init.el
View File

@ -13,43 +13,12 @@
(setq package-check-signature 'allow-unsigned)
;;; Fix TLS emacs 26.x
(if (version<= emacs-version "26.2")
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;;; Welcome message
(setq-default initial-scratch-message
(concat ";; Happy hacking, " user-login-name " - Emacs loves you!\n\n"))
(defvar before-user-init-time (current-time)
"Value of `current-time' when Emacs begins loading `user-init-file'.")
;;; Garbage Collector
(progn
;; Set this to true to find GC issues.
(setq garbage-collection-messages nil)
;; Increase the gc-cons-threshold to a very high number to decrease
;; the load and compile time. The value will be decreased
;; significantly after initialization to avoid long GC pauses during
;; normal usage.
(setq gc-cons-threshold 402653184
gc-cons-percentage 0.6)
(setq read-process-output-max (* 1024 1024)) ;; 1mb
;; Reset GC to normal values.
(add-hook 'emacs-startup-hook
(lambda ()
(message
"[STARTUP] Loading %s...done (%.3fs)" user-init-file
(float-time (time-subtract (current-time)
before-user-init-time)))
(when init-file-debug
(message "Rolling back GC settings to sane values."))
(setq gc-cons-threshold 16777216
gc-cons-percentage 0.1))))
;;; Modules directory
(push (concat user-emacs-directory "modules") load-path)
@ -70,11 +39,11 @@
(require 'init-security)
(require 'init-elpa)
;; theme
;; (require 'init-doom-theme)
(require 'init-vscode-theme)
(require 'init-theme)
;; Utils
(require 'init-utils)
;; GUI
(require 'init-linum)
(require 'init-gui)
(require 'init-editing-utils)
(require 'init-diminish)
@ -82,7 +51,6 @@
(require 'init-indent-guides)
(require 'init-icons)
(require 'init-neotree)
(require 'init-dashboard)
;; Tools
(require 'init-apache)
(require 'init-company)
@ -92,38 +60,29 @@
(require 'init-whitespace)
(require 'init-emmet-mode)
(require 'init-nginx)
(require 'init-editorconfig)
(require 'init-git)
;;(require 'init-editorconfig nil 'noerror)
;; Languages
(require 'init-ccc)
(require 'init-crystal)
(require 'init-html)
(require 'init-js-two)
(require 'init-markdown)
(require 'init-go)
(require 'init-php)
(require 'init-projectile)
(require 'init-python)
(require 'init-pkgbuild)
(require 'init-less)
(require 'init-lua)
(require 'init-smartparens)
(require 'init-sass)
(require 'init-scss)
(require 'init-typescript)
(require 'init-vue)
(require 'init-yaml)
;; Plus
(require 'init-rainbow)
(require 'init-web-mode)
(require 'init-dotenv)
(require 'init-dockerfile)
(require 'init-dokuwiki)
(require 'init-graphviz)
(require 'init-linter)
(require 'init-load-env-vars)
(require 'init-restclient)
(require 'init-terraform)
(require 'init-ox-reveal))
(require 'init-dokuwiki))
;;; Custom variables
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
@ -137,6 +96,12 @@
(when (file-exists-p custom-file)
(load settings-file))
;; Time Output
(when window-system
(let ((elapsed (float-time (time-subtract (current-time)
emacs-load-start-time))))
(message "[STARTUP] Loading %s ... done (%.3fs)" load-file-name elapsed)))
;; enable erase-buffer command
(put 'erase-buffer 'disabled nil)

View File

@ -2,18 +2,14 @@
;;; Commentary:
;; Company es un famework de Emacs para el completado de texto.
;;; code:
;;; CODE:
(use-package company
:defer 5
:diminish
:bind
(:map company-mode-map
("<backtab>" . company-complete))
:ensure t
:config
;; Global
(setq company-idle-delay 1
company-minimum-prefix-length 1
company-show-numbers nil
company-show-numbers t
company-tooltip-limit 20)
;; Facing
@ -25,6 +21,9 @@
(set-face-attribute 'company-scrollbar-bg nil :inherit 'company-tooltip :background "gray20")
(set-face-attribute 'company-scrollbar-fg nil :background "gray40"))
;; Default backends
(setq company-backends '((company-files)))
;; Activating globally
(global-company-mode t))

View File

@ -1,39 +0,0 @@
;;; init-dashboard.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
(use-package dashboard
:pin "MELPA"
:ensure t
:config
;; Dashboard configuration
(dashboard-setup-startup-hook)
(setq dashboard-banner-logo-title "Emacs personal")
(setq dashboard-startup-banner 'logo)
(setq dashboard-center-content t)
(setq dashboard-show-shortcuts t)
(setq dashboard-set-heading-icons t)
(setq dashboard-set-file-icons t)
(setq dashboard-set-footer nil)
;; Configuration of dashboard sections
(setq num-recents 5)
(setq num-bookmarks 5)
(setq num-projects 5)
(setq num-agenda 5)
(setq num-registers 5)
;; Note:
;; grave accent (`) is used to access Emacs commands known like "execute commands".
;; syntax ,variable is used in context of backquote (`) macro to evaluate
;; the variable and replace it with its value time of evaluation.
;; This is known as "unquote" and is useful for constructing complex forms or lists.
(setq dashboard-items `((recents . ,num-recents)
(bookmarks . ,num-bookmarks)
(projects . ,num-projects)
(agenda . ,num-agenda)
(registers . ,num-registers))))
(provide 'init-dashboard)
;;; init-dashboard.el ends here

View File

@ -1,11 +0,0 @@
;;; init-dockerfile.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;; dockerfile-mode
(use-package dockerfile-mode
:mode ("Dockerfile\\'" . dockerfile-mode))
(provide 'init-dockerfile)
;;; init-dockerfile.el ends here

View File

@ -7,7 +7,6 @@
;; EditorConfig
;;----------------------------------------------------------------------------
(use-package editorconfig
:ensure t
:config
(when (and (require 'editorconfig nil t)
(fboundp 'editorconfig-mode))

View File

@ -20,19 +20,16 @@
'(("MELPA Stable" . 10)
("GNU ELPA" . 5)
("ORG" . 3)
("MELPA" . 0))
package-enable-at-startup nil)
;; =================
("MELPA" . 0)))
(setq package-native-compile t)
;; =================
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)
;; =====================================================
;; End use-package

View File

@ -17,10 +17,6 @@
:modes (php-mode php+-mode web-mode))
(add-to-list 'flycheck-checkers 'mix-php)
;; enable typescript-tslint checker
(with-eval-after-load 'tide
(flycheck-add-mode 'typescript-tslint 'typescript-mode)
(flycheck-add-mode 'typescript-tide 'typescript-mode))
;; Enable for only languages
:hook
(c++-mode . flycheck-mode)

112
modules/init-git.el Normal file
View File

@ -0,0 +1,112 @@
;;; init-git.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
(setq vc-follows-symlinks t
find-file-visit-truename t
vc-handled-backends nil)
(if (display-graphic-p)
(use-package git-gutter-fringe
:ensure t
:config
(global-git-gutter-mode t)
(setq-default fringes-outside-margins nil)
(setq-default left-fringe-width 10)
(set-face-foreground 'git-gutter-fr:modified "purple")
(set-face-foreground 'git-gutter-fr:added "green")
(set-face-foreground 'git-gutter-fr:deleted "red")
(defun my-reshape-git-gutter (gutter)
"Re-shape gutter for `ivy-read'."
(let* ((linenum-start (aref gutter 3))
(linenum-end (aref gutter 4))
(target-line "")
(target-linenum 1)
(tmp-line "")
(max-line-length 0))
(save-excursion
(while (<= linenum-start linenum-end)
(with-no-warnings
(goto-line linenum-start))
(setq tmp-line (replace-regexp-in-string "^[ \t]*" ""
(buffer-substring (line-beginning-position)
(line-end-position))))
(when (> (length tmp-line) max-line-length)
(setq target-linenum linenum-start)
(setq target-line tmp-line)
(setq max-line-length (length tmp-line)))
(setq linenum-start (1+ linenum-start))))
;; build (key . linenum-start)
(cons (format "%s %d: %s"
(if (eq 'deleted (aref gutter 1)) "-" "+")
target-linenum target-line)
target-linenum)))
(defun my-goto-git-gutter ()
(interactive)
(eval-when-compile (require 'git-gutter-fringe nil t))
(when (and (require 'git-gutter-fringe nil t)
(fboundp 'ivy-read))
(if git-gutter-fr:diffinfos
(ivy-read "git-gutters-fr:"
(mapcar 'my-reshape-git-gutter git-gutter-fr:diffinfos)
:action (lambda (e)
;; ivy9+ keep `(car e)'
;; ivy8- strip the `(car e)'
;; we handle both data structure
(unless (numberp e) (setq e (cdr e)))
(with-no-warnings
(goto-line e))))
(message "NO git-gutters-fringe!"))
))))
(use-package gitconfig-mode
:ensure t
:mode ("/\\.?git/?config$"
"/\\.gitmodules$")
:hook
(gitconfig-mode . flyspell-mode))
(use-package gitignore-mode
:ensure t
:mode ("/\\.gitignore$"
"/\\.git/info/exclude$"
"/git/ignore$"))
(use-package gitattributes-mode
:ensure t
:defer t)
(use-package git-timemachine
:ensure t
:commands git-timemachine
:bind (:map git-timemachine-mode
("c" . git-timemachine-show-current-revision)
("b" . git-timemachine-switch-branch)))
;;; smerge-mode video explain https://emacsgifs.github.io/public/videos/758861381898637313.mp4
(use-package smerge-mode
:ensure t
:config
(defun enable-smerge-maybe ()
(when (and buffer-file-name (vc-backend buffer-file-name))
(save-excursion
(goto-char (point-min))
(when (re-search-forward "^<<<<<<< " nil t)
(smerge-mode +1)))))
(eval-when-compile (require 'smerge-mode nil t))
(when (and (require 'smerge-mode nil t)
(fboundp 'enable-smerge-maybe))
(add-hook 'buffer-list-update-hook #'enable-smerge-maybe)))
(provide 'init-git)
;; Local Variables:
;; byte-compile-warnings: (not free-vars)
;; End:
;;; init-git.el ends here

View File

@ -1,11 +0,0 @@
;;; init-go.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;; go-mode
(use-package go-mode
:mode ("\\.go\\'" . go-mode))
(provide 'init-go)
;;; init-go.el ends here

View File

@ -1,20 +0,0 @@
;;; init-graphviz.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;;----------------------------------------------------------------------------
;; Graphviz Mode
;;----------------------------------------------------------------------------
(use-package graphviz-dot-mode
:pin "MELPA"
:ensure t
:config
(setq graphviz-dot-indent-width 4))
(provide 'init-graphviz)
;; End:
;;; init-graphviz.el ends here

View File

@ -15,25 +15,18 @@
(menu-bar-mode 0)
(setq make-backup-files nil) ; stop creating backup~ files
(setq auto-save-default nil) ; stop creating #autosave# files
(setq create-lockfiles nil) ; stop creating #create-lockfiles
;; Suppressing ad-handle-definition Warnings in Emacs
(setq ad-redefinition-action 'accept)
;;------------------------------
;; Core settings | UTF-8 please
;;------------------------------
;; Set Unicode character priority
(set-charset-priority 'unicode)
;; Set language environment to UTF-8
(set-language-environment "UTF-8")
;; Set terminal coding system to UTF-8
(set-terminal-coding-system 'utf-8)
;; Set keyboard coding system to UTF-8
(set-keyboard-coding-system 'utf-8)
;; Set selection coding system to UTF-8
(set-selection-coding-system 'utf-8)
;; Prefer UTF-8 coding system
(prefer-coding-system 'utf-8)
(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
;;----------------------------------------------------------------------------
;; Editor configuration
@ -54,10 +47,13 @@
(lambda ()
(setq line-spacing 0)))
;; Font theme (DejaVu Sans Mono if Hack isn't present)
(if (member "Hack" (font-family-list))
;; Font theme (Monospace, or DejaVu Sans Mono if Monospace is not
;; present)
(condition-case nil
(set-frame-font "Hack-9")
(set-frame-font "DejaVu Sans Mono-10"))
;; (set-frame-font "Monospace-9")
;; (set-frame-font "Anonymous Pro-10")
(error (set-frame-font "DejaVu Sans Mono-10")))
;;----------------------------------------------------------------------------
;; Configure keys
@ -68,12 +64,6 @@
(global-set-key (kbd "s-C--") 'sacha/decrease-font-size) ; C-- decrease font size
(global-set-key (kbd "<f12>") 'revert-buffer-no-confirm)
(global-set-key (kbd "s-h") 'global-hl-line-mode) ; Highlight current line
(global-set-key (kbd "M-c") nil) ; disable capitalize-word
(global-set-key (kbd "<f6>") 'display-line-numbers-mode)
;; muti-curses
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;;---------------------------------------------------------------------------
;; FullScreen
@ -89,15 +79,15 @@
;; Define custom browser
;;----------------------------------------------------------------------------
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program (getenv "WEB_BROWSER_APP"))
browse-url-generic-program "iceweasel-uxp")
;;----------------------------------------------------------------------------
;; doas open file option
;; sudo open file option
;;----------------------------------------------------------------------------
(defun doas-find-file (file-name)
(defun sudo-find-file (file-name)
"Like find file, but opens the file as root."
(interactive "FDoas Find File: ")
(let ((tramp-file-name (concat "/doas::" (expand-file-name file-name))))
(interactive "FSudo Find File: ")
(let ((tramp-file-name (concat "/sudo::" (expand-file-name file-name))))
(find-file tramp-file-name)))
;;----------------------------------------------------------------------------

View File

@ -7,25 +7,10 @@
;; This minor mode highlights indentation levels via font-lock
(use-package highlight-indent-guides
:ensure t
:config
(setq highlight-indent-guides-method 'character)
(setq highlight-indent-guides-responsive 'top)
(setq highlight-indent-guides-delay 0.3)
(setq highlight-indent-guides-character ?\|)
(setq highlight-indent-guides-auto-odd-face-perc 15)
(setq highlight-indent-guides-auto-even-face-perc 20)
(setq highlight-indent-guides-auto-character-face-perc 30)
(set-face-attribute 'highlight-indent-guides-character-face nil
:background "rgba(136, 136, 136, 0.1)"))
(defun general-toggle-highlight-indent-guides ()
(interactive)
(if (bound-and-true-p highlight-indent-guides-mode)
(highlight-indent-guides-mode -1)
(highlight-indent-guides-mode 1)))
(global-set-key (kbd "<f7>") 'general-toggle-highlight-indent-guides)
;; Indent character samples: fill, column or character
(setq highlight-indent-guides-method 'character))
(provide 'init-indent-guides)

View File

@ -29,14 +29,6 @@
(ivy-set-display-transformer 'ivy-switch-buffer
'ivy-rich-switch-buffer-transformer))
;; hydra
(use-package hydra
:pin "MELPA"
:config (hydra-add-font-lock))
(use-package ivy-hydra
:pin "MELPA")
(use-package swiper
:after ivy
:bind (("C-s" . swiper)

View File

@ -7,36 +7,46 @@
;; js2-mode: enhanced JavaScript editing mode
;; https://github.com/mooz/js2-mode
(use-package js2-mode
:ensure t
:pin "MELPA"
:mode ("\\.js\\'" . js2-mode)
:hook (js2-mode . company-mode)
:custom
(js2-include-node-externs t)
(js2-global-externs '("customElements"))
(js2-highlight-level 3)
(js2r-prefer-let-over-var t)
(js2r-preferred-quote-type 2)
(js-indent-align-list-continuation t)
:mode (("\\.js$" . js2-mode))
:hook ((js2-mode . (lambda ()
(flycheck-mode)
(company-mode))))
:config
(setq-default flycheck-javascript-eslint-executable "eslint_d")
(setq js-indent-level 2)
(advice-add #'js2-identifier-start-p
:after-until
(lambda (c) (eq c ?#))))
;; have 4 space indentation by default
(setq js-indent-level 4
js2-basic-offset 4
js-chain-indent t)
;; use eslint_d insetad of eslint for faster linting
(setq flycheck-javascript-eslint-executable "eslint_d")
;; Try to highlight most ECMA built-ins
(setq js2-highlight-level 3)
;; turn off all warnings in js2-mode
(setq js2-mode-show-parse-errors t)
(setq js2-mode-show-strict-warnings nil)
(setq js2-strict-missing-semi-warning nil))
;; hydra
(use-package hydra
:pin "MELPA"
:config (hydra-add-font-lock))
(use-package ivy-hydra
:pin "MELPA")
;; js2-refactor: refactoring options for emacs
;; https://github.com/magnars/js2-refactor.el
(use-package js2-refactor
:pin "MELPA"
:after js2-mode
:hook (js2-mode . js2-refactor-mode)
:config
;; Add keybindings for js2-refactor with prefix "C-c C-r".
(js2r-add-keybindings-with-prefix "C-c C-r")
;; Assign keybindings to kill an element in js2 and to open the js2-refactor's hydra menu.
(bind-key "C-k" 'js2r-kill js2-mode-map)
(bind-key "C-c h r" 'js2-refactor-hydra/body js2-mode-map)
:bind
(:map js2-mode-map
("C-k" . js2r-kill)
("C-c h r" . js2-refactor-hydra/body))
:hook ((js2-mode . js2-refactor-mode))
:config (js2r-add-keybindings-with-prefix "C-c C-r")
(defhydra js2-refactor-hydra (:color blue :hint nil)
"
@ -77,33 +87,54 @@
("k" js2r-kill)
("q" nil)))
;; json-snatcher: get the path of any JSON element easily
;; https://github.com/Sterlingg/json-snatcher
(use-package json-snatcher
:hook ((json-mode . js-mode-bindings))
:config
(defun js-mode-bindings ()
"Sets a hotkey for using the json-snatcher plugin"
(when (string-match "\\.json$" (buffer-name))
(local-set-key (kbd "C-c C-g") 'jsons-print-path))))
;; json-mode: Major mode for editing JSON files with emacs
;; https://github.com/joshwnj/json-mode
(use-package json-mode
:ensure t
:pin "MELPA"
:mode ("\\.json\\'" "\\.jsonld\\'")
:custom
(json-reformat:indent-width 2)
(json-reformat:pretty-string? t)
(js-indent-level 2)
:hook
(json-mode . (lambda ()
(add-hook 'before-save-hook 'json-mode-before-save nil t)
(prettier-js-mode)))
:bind
(:map json-mode-map
("C-c <tab>" . json-mode-beautify)))
(use-package prettier-js
:pin "MELPA"
:hook
((js-mode typescript-mode css-mode scss-mode less-mode web-mode json-mode) . prettier-js-mode))
:mode "\\.js\\(?:on\\|[hl]int\\(rc\\)?\\)\\'"
:config
(add-hook 'json-mode-hook #'prettier-js-mode)
(setq json-reformat:indent-width 2)
(setq json-reformat:pretty-string? t)
(setq js-indent-level 2))
;; eslintd-fix: Emacs minor-mode to automatically fix javascript with eslint_d.
;; https://github.com/aaronjensen/eslintd-fix/tree/master
(use-package eslintd-fix)
;; rjsx-mode: A React JSX major mode for Emacs
;; https://github.com/felipeochoa/rjsx-mode
(use-package rjsx-mode
:after js2-mode
:mode (("\\.jsx$" . rjsx-mode)
("components/.+\\.js$" . rjsx-mode))
:hook (rjsx-mode . (lambda ()
(flycheck-mode)
(company-mode)
(js2-refactor-mode -1)))
:init
(defun +javascript-jsx-file-p ()
"Detect React or preact imports early in the file."
(and buffer-file-name
(string= (file-name-extension buffer-file-name) "js")
(re-search-forward "\\(^\\s-*import +React\\|\\( from \\|require(\\)[\"']p?react\\)"
magic-mode-regexp-match-limit t)
(progn (goto-char (match-beginning 1))
(not (when (and (require 'smartparens nil t)
(fboundp sp-point-in-string-or-comment))
)))))
(add-to-list 'magic-mode-alist '(+javascript-jsx-file-p . rjsx-mode))
:config (unbind-key "C-c C-l" rjsx-mode-map))
(provide 'init-js-two)
;; Local Variables:
;; byte-compile-warnings: (not free-vars)

View File

@ -1,36 +0,0 @@
;;; init-linter.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;;---------------------------
;; Lsp Mode
;;---------------------------
(use-package lsp-treemacs
:config
(lsp-treemacs-sync-mode 1))
(use-package lsp-ui)
(use-package lsp-mode
:pin "MELPA"
:hook ((lsp-mode . lsp-enable-which-key-integration))
:custom
(lsp-clients-angular-language-server-command
'("node"
(getenv "ANGULAR_SERVER_DIR")
"--ngProbeLocations"
(getenv "NODEJS_MODULE_DIR")
"--tsProbeLocations"
(getenv "NODEJS_MODULE_DIR")
"--stdio"))
(lsp-diagnostics-provider :none)
:commands (lsp lsp-deferred))
;; require install language server for Angular
;; npm install -g @angular/language-service@next typescript @angular/language-server
;; require install eslint for ReactJS
;; npm install -g eslint
(use-package dap-mode)
(provide 'init-linter)
;; End:
;;; init-linter.el ends here

52
modules/init-linum.el Normal file
View File

@ -0,0 +1,52 @@
;;; init-nlinum.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;;----------------------------------------------------------------------------
;; Line numbers
;;----------------------------------------------------------------------------
;; Linum snippets from: https://www.emacswiki.org/emacs/LineNumbers
(use-package linum
:config
(defun my-linum-get-format ()
"Defines LINUM-GET-FORMAT"
(let* ((width (1+ (length (number-to-string
(count-lines (point-min) (point-max))))))
(format (concat "%" (number-to-string width) "d \u2502")))
(setq my-linum-format-string format)))
(add-hook 'linum-before-numbering-hook 'my-linum-get-format)
(defun my-linum-format (line-number)
"Defines LINE-FORMAT"
(propertize (format my-linum-format-string line-number) 'face
(if (eq line-number my-current-line)
'my-linum-hl
'linum)))
(setq linum-format 'my-linum-format)
(defadvice linum-update (around my-linum-update)
"Defines LINUM-UPDATE for update lines"
(let ((my-current-line (line-number-at-pos)))
ad-do-it))
(ad-activate 'linum-update)
;; Colors line active
;; set in file init-theme.el
;; for example:
;; (defface my-linum-hl
;; '((t :background "gray20" :foreground "gold"))
;; "Face for the currently active Line number"
;; :group 'linum)
;; )
:bind
(([f6] . linum-mode)))
(provide 'init-linum)
;; Local Variables:
;; byte-compile-warnings: (not free-vars)
;; End:
;;; init-linum.el ends here

View File

@ -1,12 +0,0 @@
;;; init-load-env-vars.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;; load-env-vars
(use-package load-env-vars
:config
(load-env-vars "~/.emacs.d/.env"))
(provide 'init-load-env-vars)
;;; init-load-env-vars.el ends here

View File

@ -1,11 +0,0 @@
;;; init-lua.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;; lua-mode
(use-package lua-mode
:mode ("\\.lual\\'" . lua-mode))
(provide 'init-lua)
;;; init-lua.el ends here

View File

@ -10,9 +10,29 @@
:pin "MELPA"
:ensure t
:hook (after-init . doom-modeline-mode)
:config (setq column-number-mode t)
)
(use-package anzu
:config
(custom-set-variables
'(anzu-search-threshold 1000)
'(anzu-replace-threshold 1000)
'(anzu-deactivate-region t)
'(anzu-input-idle-delay 0.1)
'(anzu-replace-to-string-separator " => "))
(global-anzu-mode +1)
(set-face-attribute 'anzu-mode-line nil
:foreground "yellow" :weight 'bold)
(define-key isearch-mode-map [remap isearch-query-replace] #'anzu-isearch-query-replace)
(define-key isearch-mode-map [remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp)
;;----------------------------------------------------------------------------
;; Keyboard shortcuts in Anzu Mode
;;----------------------------------------------------------------------------
(global-set-key (kbd "M-%") 'anzu-query-replace)
(global-set-key (kbd "s-<SPC>") 'anzu-query-replace))
(provide 'init-modeline)
;; End:

View File

@ -1,14 +0,0 @@
;;; init-ox-reveal.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;; ox-reveal
(use-package ox-reveal
:ensure ox-reveal
:config
(setq org-reveal-root (concat "file://" (getenv "REVEAL_JS_DIR")))
(setq org-reveal-highlight-css (getenv "REVEAL_CSS_FILE"))
(setq org-reveal-ignore-speaker-notes t))
(provide 'init-ox-reveal)
;;; init-ox-reveal.el ends here

View File

@ -4,18 +4,15 @@
;;; Code:
(use-package php-refactor-mode
:pin "MELPA"
:after (php-mode)
:mode ("\\.php\\'" . php-mode)
:hook
(php-mode . php-refactor-mode))
(use-package php-mode
:pin "MELPA"
:ensure t)
(use-package company-php
:pin "MELPA"
:ensure t
:config
(defun cfg:php-mode-hook ()

View File

@ -5,7 +5,6 @@
;;; Code:
;; rainbow-mode
(use-package rainbow-mode
:pin "GNU ELPA"
:hook
(css-mode . rainbow-mode)
(sass-mode . rainbow-mode)

View File

@ -1,15 +0,0 @@
;;; init-restclient.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;;----------------------------------------------------------------------------
;; Restclient, similar to postman but in emacs
;;----------------------------------------------------------------------------
(use-package restclient
:mode ("\\.http\\'" . restclient-mode))
(provide 'init-restclient)
;; End:
;;; init-restclient.el ends here

View File

@ -1,12 +0,0 @@
;;; init-terraform.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;; yaml-mode
(use-package terraform-mode
:pin "MELPA"
:mode ("\\.tf\\'" . terraform-mode))
(provide 'init-terraform)
;;; init-terraform.el ends here

View File

@ -1,4 +1,4 @@
;;; init-doom-theme.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; init-theme.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
@ -7,16 +7,17 @@
:pin "MELPA"
:ensure t
:bind
(("C-x t d" . dark-theme)
("C-x t d" . dark-theme)
("C-x t s" . semi-dark-theme)
("C-x t l" . light-theme))
("C-x t l" . light-theme)
:init
(defun light-theme ()
"Activate light colortheme"
(interactive)
(load-theme 'doom-one-light)
(delete-selection-mode 1))
(delete-selection-mode 1)
)
(defun dark-theme ()
"Activate dark colortheme"
@ -24,7 +25,8 @@
(load-theme 'doom-molokai)
(delete-selection-mode 1)
;; Invoke customcolors
(darkcolor))
(darkcolor)
)
(defun semi-dark-theme ()
"Activate semi-dark colortheme"
@ -32,10 +34,11 @@
(load-theme 'doom-molokai)
(delete-selection-mode 1)
;; Invoke customcolors
(semidarkcolor))
(semidarkcolor)
)
;; Invoke theme
(load-theme 'doom-molokai t)
(load-theme 'doom-molokai t) ;; global
:config
(defun darkcolor ()
@ -46,14 +49,15 @@
;; Modeline
(set-face-background 'mode-line "#0C0E10")
(set-face-background 'mode-line-inactive "#333333")
(set-face-background 'modeline-inactive "#333333")
;; (set-face-foreground 'mode-line "#FFFFFF")
;; Fix linum current-line highlight
(defface my-linum-hl
'((t :background "#0C0E10" :foreground "gold"))
"Face for the currently active Line number"
:group 'linum))
:group 'linum)
)
(defun semidarkcolor ()
"Simple semidarkcolor for theme."
@ -70,11 +74,13 @@
(defface my-linum-hl
'((t :background "gray20" :foreground "gold"))
"Face for the currently active Line number"
:group 'linum))
:group 'linum)
)
;; Invoke color
(semidarkcolor))
(semidarkcolor) ;; default
)
(provide 'init-doom-theme)
(provide 'init-theme)
;;; init-doom-theme.el ends here
;;; init-theme.el ends here

View File

@ -1,12 +0,0 @@
;;; init-typescript.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;; typescript-mode
(use-package tide :ensure t)
(use-package typescript-mode
:mode ("\\.ts\\'" . typescript-mode))
(provide 'init-typescript)
;;; init-typescript.el ends here

View File

@ -3,6 +3,15 @@
;;
;;; Code:
;; Loads functions from libs
(defun load-directory (dir)
"Load functions from the libs DIR.
read the .el files"
(let ((load-it (lambda (f)
(load-file (concat (file-name-as-directory dir) f)))
))
(mapc load-it (directory-files dir nil "\\.el$"))))
;;------------------------------------------------------------------------------
;; Sachachua
;;------------------------------------------------------------------------------

View File

@ -1,50 +0,0 @@
;;; init-vscode-theme.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
(use-package vscode-dark-plus-theme
:pin "MELPA"
:ensure t
:config
(load-theme 'vscode-dark-plus t)
(defun current-dark-color ()
"Simple current-dark-color for theme."
(set-cursor-color "#2979FF")
(set-background-color "#1C1E1F")
;; highlight
(set-face-foreground 'highlight "#F4F4F4")
(set-face-background 'highlight "#004575")
;; Modeline
(set-face-foreground 'mode-line "#FFFFFF")
(set-face-foreground 'mode-line-inactive "#f4f4f4")
(set-face-foreground 'mode-line-highlight "#f4f4f4")
(set-face-background 'mode-line "#6a157e")
(set-face-background 'mode-line-inactive "#7B1FA2")
(set-face-background 'fringe nil)
;; Define a face for the current line number
(defface my-line-number-current-line
'((t :background "#007ACC" :foreground "#FFFFFF"))
"Face for the currently active line number"
:group 'display-line-numbers)
;; Set the face for the current line number
(set-face-attribute 'line-number-current-line nil
:background "#007ACC"
:foreground "#FFFFFF")
)
;; Invoke color
(current-dark-color))
(provide 'init-vscode-theme)
;; End:
;;; init-vscode-theme.el ends here

View File

@ -13,7 +13,6 @@
("\\.jsp\\'" . web-mode)
("\\.gsp\\'" . web-mode)
("\\.scss\\'" . web-mode)
("\\.tsx\\'" . web-mode)
("\\.ctp\\'" . web-mode))
:config
;; web-modeの設定

View File

@ -3,8 +3,9 @@
;; custom settings!!!
;;; Code:
(setq user-full-name (getenv "EMACS_USER"))
(setq user-mail-address (getenv "EMACS_EMAIL"))
(setq user-full-name "LibreUser.")
(setq user-mail-address "name@domain.com")
;; Local Variables:
;; byte-compile-warnings: (not free-vars)
;; End: