Skip to content

Instantly share code, notes, and snippets.

@onimenotsuki
Last active September 28, 2022 04:42
Show Gist options
  • Save onimenotsuki/adb1725ceddaeac026fc47bed30f64f6 to your computer and use it in GitHub Desktop.
Save onimenotsuki/adb1725ceddaeac026fc47bed30f64f6 to your computer and use it in GitHub Desktop.
My personal configuration of emacs with spacemacs https://github.com/syl20bnr/spacemacs/
;; -*- mode: emacs-lisp -*-
;; This file is loaded by SmTnpacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
;; or `spacemacs'. (default 'spacemacs)
dotspacemacs-distribution 'spacemacs
;; Lazy installation of layers (i.e. layers are installed only when a file
;; with a supported type is opened). Possible values are `all', `unused'
;; and `nil'. `unused' will lazy install only unused layers (i.e. layers
;; not listed in variable `dotspacemacs-configuration-layers'), `all' will
;; lazy install any layer that support lazy installation even the layers
;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy
;; installation feature and you have to explicitly list a layer in the
;; variable `dotspacemacs-configuration-layers' to install it.
;; (default 'unused)
dotspacemacs-enable-lazy-installation 'unused
;; If non-nil then Spacemacs will ask for confirmation before installing
;; a layer lazily. (default t)
dotspacemacs-ask-for-lazy-installation t
;; If non-nil layers with lazy install support are lazy installed.
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()
;; List of configuration layers to load.
dotspacemacs-configuration-layers
'(
(rust :variables
rust-backend 'lsp)
php
sql
;; ----------------------------------------------------------------
;; Example of useful layers you may want to use right away.
;; Uncomment some layer names and press <SPC f e R> (Vim style) or
;; <M-m f e R> (Emacs style) to install them.
;; ----------------------------------------------------------------
;; helm
ivy
(auto-completion :variables
auto-completion-return-key-behavior 'complete
auto-completion-enable-help-tooltip t
auto-completion-tab-key-behavior 'cycle
auto-completion-with-key-sequence nil)
better-defaults
(multiple-cursors :variables
multiple-cursors-backend 'mc)
clojure
colors
csv
docker
parinfer
(conda :variables
conda-anaconda-home "~/anaconda3")
(dart :variables
dart-enable-analysis-server t
dart-server-sdk-path "~/flutter/bin/cache/dart-sdk/"
dart-server-format-on-save t)
emacs-lisp
;; extra-langs
;; arduino
git
github
groovy
kotlin
html
(ess :variables ess-r-backend 'lsp)
(javascript :variables
javascript-disable-tern-port-files nil
javascript-lsp-linter 'javascript-eslint
javascript-backend 'lsp
javascript-fmt-tool 'prettier
javascript-import-tool 'importd-js
javascript-fmt-on-save t)
(lsp :variables
lsp-navigation 'peek
lsp-ui-doc-enable nil
lsp-ui-sideline-enable t)
json
latex
ipython-notebook
org
prettier
(python :variables
python-backend 'anaconda
python-formatter 'black
python-format-on-save t)
(spotify :variables
counsel-spotify-client-id "b2f08bb33feb4729ac6821294d9c4c42"
counsel-spotify-client-secret "662c9da916b1474da5debf9a8282600e")
react
restclient
ruby
;; ISSUE with tramp and projectile
;; FIX in version > 0.200.9
ruby-on-rails
search-engine
nginx
(markdown :variables markdown-live-preview-engine 'vmd)
org
(shell :variables
shell-default-height 30
shell-default-position 'bottom)
shell-scripts
themes-megapack
systemd
(syntax-checking :variables
syntax-checking-enable-by-default t
syntax-checking-use-original-bitmaps t
syntax-checking-enable-tooltips nil)
(typescript :variables
typescript-backend 'lsp
typescript-fmt-on-save t
typescript-fmt-tool 'prettier
typescript-lsp-linter nil
)
version-control
vimscript
yaml
)
;; List of additional packages that will be installed without being
;; wrapped in a layer. If you need some configuration for these
;; packages, then consider creating a layer. You can also put the
;; configuration in `dotspacemacs/user-config'.
dotspacemacs-additional-packages '(
graphql-mode
android-mode
ng2-mode
eslint-fix
all-the-icons
;; highlight-indent-guides
add-node-modules-path
all-the-icons-dired
vue-mode
flutter
flutter-l10n-flycheck
vue-html-mode
yasnippet-snippets
flow-minor-mode
region-bindings-mode
humanoid-themes
)
;; A list of packages that cannot be updated.
dotspacemacs-frozen-packages '()
;; A list of packages that will not be installed and loaded.
dotspacemacs-excluded-packages '(fill-column-indicator)
;; Defines the behaviour of Spacemacs when installing packages.
;; Possible values are `used-only', `used-but-keep-unused' and `all'.
;; `used-only' installs only explicitly used packages and uninstall any
;; unused packages as well as their unused dependencies.
;; `used-but-keep-unused' installs only the used packages but won't uninstall
;; them if they become unused. `all' installs *all* packages supported by
;; Spacemacs and never uninstall them. (default is `used-only')
dotspacemacs-install-packages 'used-only))
(defun dotspacemacs/init ()
"Initialization function.
This function is called at the very startup of Spacemacs initialization
before layers configuration.
You should not put any user code in there besides modifying the variable
values."
;; This setq-default sexp is an exhaustive list of all the supported
;; spacemacs settings.
(setq-default
;; If non nil ELPA repositories are contacted via HTTPS whenever it's
;; possible. Set it to nil if you have no way to use HTTPS in your
;; environment, otherwise it is strongly recommended to let it set to t.
;; This variable has no effect if Emacs is launched with the parameter
;; `--insecure' which forces the value of this variable to nil.
;; (default t)
dotspacemacs-elpa-https t
;; Maximum allowed time in seconds to contact an ELPA repository.
dotspacemacs-elpa-timeout 5
;; If non nil then spacemacs will check for updates at startup
;; when the current branch is not `develop'. Note that checking for
;; new versions works via git commands, thus it calls GitHub services
;; whenever you start Emacs. (default nil)
dotspacemacs-check-for-update nil
;; If non-nil, a form that evaluates to a package directory. For example, to
;; use different package directories for different Emacs versions, set this
;; to `emacs-version'.
dotspacemacs-elpa-subdirectory nil
;; One of `vim', `emacs' or `hybrid'.
;; `hybrid' is like `vim' except that `insert state' is replaced by the
;; `hybrid state' with `emacs' key bindings. The value can also be a list
;; with `:variables' keyword (similar to layers). Check the editing styles
;; section of the documentation for details on available variables.
;; (default 'vim)
dotspacemacs-editing-style 'emacs
;; If non nil output loading progress in `*Messages*' buffer. (default nil)
dotspacemacs-verbose-loading nil
;; Specify the startup banner. Default value is `official', it displays
;; the official spacemacs logo. An integer value is the index of text
;; banner, `random' chooses a random text banner in `core/banners'
;; directory. A string value must be a path to an image format supported
;; by your Emacs build.
;; If the value is nil then no banner is displayed. (default 'official)
dotspacemacs-startup-banner '000
;; List of items to show in startup buffer or an association list of
;; the form `(list-type . list-size)`. If nil then it is disabled.
;; Possible values for list-type are:
;; `recents' `bookmarks' `projects' `agenda' `todos'."
;; Example for 5 recent files and 7 projects: '((recents . 5) (projects . 7))
;; List sizes may be nil, in which case
;; `spacemacs-buffer-startup-lists-length' takes effect.
;; (default nil)
dotspacemacs-startup-lists '((projects . 5)
(recents . 5))
;; True if the home buffer should respond to resize events.
dotspacemacs-startup-buffer-responsive t
;; Default major mode of the scratch buffer (default `text-mode')
dotspacemacs-scratch-mode 'text-mode
;; List of themes, the first of the list is loaded when spacemacs starts.
;; Press <SPC> T n to cycle to the next theme in the list (works great
;; with 2 themes variants, one dark and one light)
dotspacemacs-themes '(
dracula
kaolin-valley-light
material-light
kaolin-bubblegum
kaolin-galaxy
)
;; If non nil the cursor color matches the state color in GUI Emacs.
dotspacemacs-colorize-cursor-according-to-state t
;; Default font, or prioritized list of fonts. `powerline-scale' allows to
;; quickly tweak the mode-line size to make separators look not too crappy.
;; dotspacemacs-default-font '("Droid Sans Mono"
;; :size 14
;; :weight normal
;; :width normal
;; :powerline-scale 1.2)
;; dotspacemacs-default-font '("Inconsolata"
;; :size 20
;; :weight normal
;; :width normal
;; :powerline-scale 1.2)
dotspacemacs-default-font '("Fira Mono"
:size 15
:weight normal
:width normal
:powerline-scale 1)
;; dotspacemacs-default-font '("UbuntuMono"
;; :size 14
;; :weight normal
;; :width normal
;; :powerline-scale 1.2)
;; dotspacemacs-default-font '("Source Code Pro"
;; :size 15
;; :weight normal
;; :width normal
;; :powerline-scale 1.2)
;; The leader key
dotspacemacs-leader-key "SPC"
;; The key used for Emacs commands (M-x) (after pressing on the leader key).
;; (default "SPC")
dotspacemacs-emacs-command-key "SPC"
;; The key used for Vim Ex commands (default ":")
dotspacemacs-ex-command-key ":"
;; The leader key accessible in `emacs state' and `insert state'
;; (default "M-m")
dotspacemacs-emacs-leader-key "M-m"
;; Major mode leader key is a shortcut key which is the equivalent of
;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
dotspacemacs-major-mode-leader-key ","
;; Major mode leader key accessible in `emacs state' and `insert state'.
;; (default "C-M-m)
dotspacemacs-major-mode-emacs-leader-key "C-M-m"
;; These variables control whether separate commands are bound in the GUI to
;; the key pairs C-i, TAB and C-m, RET.
;; Setting it to a non-nil value, allows for separate commands under <C-i>
;; and TAB or <C-m> and RET.
;; In the terminal, these pairs are generally indistinguishable, so this only
;; works in the GUI. (default nil)
dotspacemacs-distinguish-gui-tab nil
;; If non nil `Y' is remapped to `y$' in Evil states. (default nil)
dotspacemacs-remap-Y-to-y$ nil
;; If non-nil, the shift mappings `<' and `>' retain visual state if used
;; there. (default t)
dotspacemacs-retain-visual-state-on-shift t
;; If non-nil, J and K move lines up and down when in visual mode.
;; (default nil)
dotspacemacs-visual-line-move-text nil
;; If non nil, inverse the meaning of `g' in `:substitute' Evil ex-command.
;; (default nil)
dotspacemacs-ex-substitute-global nil
;; Name of the default layout (default "Default")
dotspacemacs-default-layout-name "Default"
;; If non nil the default layout name is displayed in the mode-line.
;; (default nil)
dotspacemacs-display-default-layout nil
;; If non nil then the last auto saved layouts are resume automatically upon
;; start. (default nil)
dotspacemacs-auto-resume-layouts nil
;; Size (in MB) above which spacemacs will prompt to open the large file
;; literally to avoid performance issues. Opening a file literally means that
;; no major mode or minor modes are active. (default is 1)
dotspacemacs-large-file-size 1
;; Location where to auto-save files. Possible values are `original' to
;; auto-save the file in-place, `cache' to auto-save the file to another
;; file stored in the cache directory and `nil' to disable auto-saving.
;; (default 'cache)
dotspacemacs-auto-save-file-location nil
;; Maximum number of rollback slots to keep in the cache. (default 5)
dotspacemacs-max-rollback-slots 5
;; If non nil, `helm' will try to minimize the space it uses. (default nil)
dotspacemacs-helm-resize nil
;; if non nil, the helm header is hidden when there is only one source.
;; (default nil)
dotspacemacs-helm-no-header nil
;; define the position to display `helm', options are `bottom', `top',
;; `left', or `right'. (default 'bottom)
dotspacemacs-helm-position 'bottom
;; Controls fuzzy matching in helm. If set to `always', force fuzzy matching
;; in all non-asynchronous sources. If set to `source', preserve individual
;; source settings. Else, disable fuzzy matching in all sources.
;; (default 'always)
dotspacemacs-helm-use-fuzzy 'source
;; If non nil the paste micro-state is enabled. When enabled pressing `p`
;; several times cycle between the kill ring content. (default nil)
dotspacemacs-enable-paste-transient-state nil
;; Which-key delay in seconds. The which-key buffer is the popup listing
;; the commands bound to the current keystroke sequence. (default 0.4)
dotspacemacs-which-key-delay 0.4
;; Which-key frame position. Possible values are `right', `bottom' and
;; `right-then-bottom'. right-then-bottom tries to display the frame to the
;; right; if there is insufficient space it displays it at the bottom.
;; (default 'bottom)
dotspacemacs-which-key-position 'bottom
;; If non nil a progress bar is displayed when spacemacs is loading. This
;; may increase the boot time on some systems and emacs builds, set it to
;; nil to boost the loading time. (default t)
dotspacemacs-loading-progress-bar t
;; If non nil the frame is fullscreen when Emacs starts up. (default nil)
;; (Emacs 24.4+ only)
dotspacemacs-fullscreen-at-startup nil
;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
;; Use to disable fullscreen animations in OSX. (default nil)
dotspacemacs-fullscreen-use-non-native nil
;; If non nil the frame is maximized when Emacs starts up.
;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
;; (default nil) (Emacs 24.4+ only)
dotspacemacs-maximized-at-startup t
;; A value from the range (0..100), in increasing opacity, which describes
;; the transparency level of a frame when it's active or selected.
;; Transparency can be toggled through `toggle-transparency'. (default 90)
dotspacemacs-active-transparency 90
;; A value from the range (0..100), in increasing opacity, which describes
;; the transparency level of a frame when it's inactive or deselected.
;; Transparency can be toggled through `toggle-transparency'. (default 90)
dotspacemacs-inactive-transparency 90
;; If non nil show the titles of transient states. (default t)
dotspacemacs-show-transient-state-title t
;; If non nil show the color guide hint for transient state keys. (default t)
dotspacemacs-show-transient-state-color-guide t
;; If non nil unicode symbols are displayed in the mode line. (default t)
dotspacemacs-mode-line-unicode-symbols t
;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth
;; scrolling overrides the default behavior of Emacs which recenters point
;; when it reaches the top or bottom of the screen. (default t)
dotspacemacs-smooth-scrolling t
;; If non nil line numbers are turned on in all `prog-mode' and `text-mode'
;; derivatives. If set to `relative', also turns on relative line numbers.
;; (default nil)
dotspacemacs-line-numbers t
;; Code folding method. Possible values are `evil' and `origami'.
;; (default 'evil)
dotspacemacs-folding-method 'evil
;; If non-nil smartparens-strict-mode will be enabled in programming modes.
;; (default nil)
dotspacemacs-smartparens-strict-mode nil
;; If non-nil pressing the closing parenthesis `)' key in insert mode passes
;; over any automatically added closing parenthesis, bracket, quote, etc…
;; This can be temporary disabled by pressing `C-q' before `)'. (default nil)
dotspacemacs-smart-closing-parenthesis t
;; Select a scope to highlight delimiters. Possible values are `any',
;; `current', `all' or `nil'. Default is `all' (highlight any scope and
;; emphasis the current one). (default 'all)
dotspacemacs-highlight-delimiters 'all
;; If non nil, advise quit functions to keep server open when quitting.
;; (default nil)
dotspacemacs-persistent-server nil
;; List of search tool executable names. Spacemacs uses the first installed
;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.
;; (default '("ag" "pt" "ack" "grep"))
dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
;; The default package repository used if no explicit repository has been
;; specified with an installed package.
;; Not used for now. (default nil)
dotspacemacs-default-package-repository nil
;; Delete whitespace while saving buffer. Possible values are `all'
;; to aggressively delete empty line and long sequences of whitespace,
;; `trailing' to delete only the whitespace at end of lines, `changed'to
;; delete only whitespace for changed lines or `nil' to disable cleanup.
;; (default nil)
dotspacemacs-whitespace-cleanup 'trailing
))
(defun dotspacemacs/user-init ()
"Initialization function for user code.
It is called immediately after `dotspacemacs/init', before layer configuration
executes.
This function is mostly useful for variables that need to be set
before packages are loaded. If you are unsure, you should try in setting them in
`dotspacemacs/user-config' first."
)
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
(setq vue-mode-packages
'(vue-mode))
(setq vue-mode-excluded-packages '())
(defun vue-mode/init-vue-mode ()
"Initialize my package"
(use-package vue-mode))
;; VUE Config
(add-hook 'mmm-mode-hook
(lambda ()
(set-face-background 'mmm-default-submode-face nil)))
;; Enable flow in js2-mode and rjsx-mode
(add-hook 'js2-mode-hook 'flow-minor-enable-automatically)
(add-hook 'rjsx-mode-hook 'flow-minor-enable-automatically)
;; My custom configurations
(setq inhibit-compacting-font-caches t)
(setq browse-url-browser-function 'browse-url-generic
engine/browser-function 'browse-url-generic
browse-url-generic-program "firefox")
(setq dart-server-enable-analysis-server t)
(with-eval-after-load "projectile"
(add-to-list 'projectile-project-root-files-bottom-up "pubspec.yaml")
(add-to-list 'projectile-project-root-files-bottom-up "BUILD"))
(setq lsp-auto-guess-root t)
;; Duplicate line or region
;; Is not my own version
;; Thanks to
;; http://stackoverflow.com/questions/88399/how-do-i-duplicate-a-whole-line-in-emacs#answer-4717026
(defun duplicate-line-or-region (&optional n)
"Duplicate current line, or region if active.
With argument N, make N copies.
With negative N, comment out original line and use the absolute value."
(interactive "*p")
(let ((use-region (use-region-p)))
(save-excursion
(let ((text (if use-region ;Get region if active, otherwise line
(buffer-substring (region-beginning) (region-end))
(prog1 (thing-at-point 'line)
(end-of-line)
(if (< 0 (forward-line 1)) ;Go to beginning of next line, or make a new one
(newline))))))
(dotimes (i (abs (or n 1))) ;Insert N times, or once if not specified
(insert text))))
(if use-region nil ;Only if we're working with a line (not a region)
(let ((pos (- (point) (line-beginning-position)))) ;Save column
(if (> 0 n) ;Comment out original with negative arg
(comment-region (line-beginning-position) (line-end-position)))
(forward-line 1)
(forward-char pos)))))
;; My custom functions
(defun my/select-current-line ()
"Select the current line to beggining of the text
identation"
(interactive)
(back-to-indentation) ; move to the end of line
(set-mark (line-end-position))
)
(defun my/insert-line-before (times)
"Inserts a newline(s) above the line containing the cursor."
(interactive "p") ; Called from M-x
(save-excursion ; Store position
(move-beginning-of-line 1)
(newline times))) ; Insert new line
(defun my/insert-line-after (times)
"Inserts a newline(s) down the line containing the cursor."
(interactive "p") ; Called from M-x
(save-excursion ; Store position
(move-end-of-line 1)
(open-line times))) ; Insert new line after
(defun my/insert-line-before-and-move-cursor (times)
"Insert line before and move curosr to the begining of line"
(interactive "p")
(beginning-of-visual-line)
(open-line times))
(defun my/new-line-and-indent ()
"Inserts a newline and openline"
(interactive)
(save-excursion
(newline-and-indent))
(newline-and-indent))
(defun my/new-line-and-indent-in-the-next ()
"End of visual line and add a newline"
(interactive)
(end-of-visual-line)
(newline-and-indent))
(defun flutter/set-widget-comment ()
"Select current widget and add comment to end"
(interactive)
(save-excursion
(call-interactively 'er/expand-region)
(if (region-active-p) (kill-ring-save (region-beginning) (region-end)))
(sp-forward-sexp 2)
(comment-indent)
(insert " ")
(yank)
(lsp-format-buffer)))
(eval-after-load 'js-mode
'(add-hook 'js-mode-hook #'add-node-modules-path))
(global-unset-key (kbd "C-o"))
(global-set-key (kbd "C-o") 'my/insert-line-before-and-move-cursor)
(global-set-key (kbd "C-S-o") 'my/insert-line-before)
(global-set-key (kbd "C-M-o") 'my/insert-line-after)
(global-unset-key (kbd "C-S-l"))
(global-set-key (kbd "C-S-l") 'my/select-current-line)
(global-set-key (kbd "S-<return>") 'my/new-line-and-indent)
(global-set-key (kbd "C-M-<return>") 'my/new-line-and-indent-in-the-next)
(global-set-key (kbd "M-m c w") 'flutter/set-widget-comment)
;; Disable emacs's automatic backup
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq create-lockfiles nil)
;; Shorcut for expand abbrev
(global-set-key (kbd "C-M-ñ") 'dabbrev-expand)
;; Keybingind for hippie-expand
(global-set-key (kbd "C-<tab>") 'hippie-expand)
;; Smartparens configuration and global mode enable
(smartparens-global-mode)
;; Paredit bindings for smartparens
(sp-use-paredit-bindings)
;; Add web-mode for svg files
(add-to-list 'auto-mode-alist '("\\.svg\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.xml\\'" . web-mode))
;; Web mode customization
(setq-default
standard-indent 2
js2-basic-offset 2
tab-width 2
web-mode-css-indent-offset 2
web-mode-markup-indent-offset 2
web-mode-code-indent-offset 2
web-mode-indent-style 2
web-mode-enable-css-colorization 1
css-indent-offset 2
scss-compile-at-save nil)
;; Typescript files indentation level
(setq typescript-indent-level 2)
;; Remove localpairs of webmode for correct integration with smartparens-global-mode
(eval-after-load 'web-mode
'(progn
;; (sp-local-pair 'web-mode "{ " nil :actions :rem)
(sp-local-pair 'web-mode "{{ " nil :actions :rem)))
(eval-after-load 'js2-mode
'(progn
(sp-local-pair 'js2-mode "{ " " }")))
(with-eval-after-load 'web-mode
(add-to-list 'web-mode-indentation-params '("lineup-args" . nil))
(add-to-list 'web-mode-indentation-params '("lineup-concats" . nil))
(add-to-list 'web-mode-indentation-params '("lineup-calls" . nil)))
;; Hooks for web-mode
;; (add-hook 'js2-mode-hook 'prettier-js-mode)
;; (add-hook 'web-mode-hook 'prettier-js-mode)
;; (add-hook 'react-mode-hook 'prettier-js-mode)
(add-hook 'scss-mode-hook 'prettier-js-mode)
;; Expand region command for emacs style
(global-set-key (kbd "C-=") 'er/expand-region)
(use-package android-mode
:config
(setq android-mode-sdk-dir "/opt/android-sdk"))
;; Optional
(use-package flutter-l10n-flycheck
:after flutter
:config
(flutter-l10n-flycheck-setup))
(defun project-try-dart (dir)
(let ((project (or (locate-dominating-file dir "pubspec.yaml")
(locate-dominating-file dir "BUILD"))))
(if project
(cons 'dart project)
(cons 'transient dir))))
(add-hook 'project-find-functions #'project-try-dart)
(cl-defmethod project-roots ((project (head dart)))
(list (cdr project)))
;; Add gradle mode
(use-package region-bindings-mode
:config
(progn
(setq region-bindings-mode-disabled-modes
'(dired-mode ibuffer-mode))
(region-bindings-mode-enable)
;; Key bindings for region-bindings-mode
(define-key region-bindings-mode-map "d" 'mc/mark-all-dwim)
(define-key region-bindings-mode-map "a" 'mc/mark-all-like-this)
(define-key region-bindings-mode-map "p" 'mc/mark-previous-like-this)
(define-key region-bindings-mode-map "n" 'mc/mark-next-like-this)
(define-key region-bindings-mode-map "m" 'mc/mark-more-like-this-extended)
(define-key region-bindings-mode-map "s" 'mc/skip-to-next-like-this)
(define-key region-bindings-mode-map "S" 'mc/skip-to-previous-like-this)
(define-key region-bindings-mode-map "i" 'er/mark-inside-quotes)
(define-key region-bindings-mode-map "o" 'er/mark-outside-quotes)
(define-key region-bindings-mode-map "I" 'er/mark-inside-pairs)
(define-key region-bindings-mode-map "O" 'er/mark-outside-pairs)
(define-key region-bindings-mode-map "ñ" 'er/mark-symbol)
(define-key region-bindings-mode-map "Ñ" 'er/mark-symbol-with-prefix)
(define-key region-bindings-mode-map "w" 'er/mark-word)
(define-key region-bindings-mode-map "u" 'er/mark-url)
(define-key region-bindings-mode-map "t" 'er/mark-text-sentence)))
(defun my/use-eslint-from-node-modules ()
(let* ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
"node_modules"))
(eslint
(and root
(expand-file-name "node_modules/.bin/eslint"
root))))
(when (and eslint (file-executable-p eslint))
(setq-local flycheck-javascript-eslint-executable eslint))))
(add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)
;; for better jsx syntax-highlighting in web-mode
;; - courtesy of Patrick @halbtuerke
(defadvice web-mode-highlight-part (around tweak-jsx activate)
(if (equal web-mode-content-type "jsx")
(let ((web-mode-enable-part-face nil))
ad-do-it)
ad-do-it))
;; (add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)
;; Separator of powerline
(setq powerline-default-separator 'slant)
(spaceline-compile)
;; Eval RSpec Snippets after init rspec-mode
(eval-after-load 'rspec-mode
'(rspec-install-snippets))
;; Custom configurations for js2-mode
(eval-after-load 'js2-mode
'(progn
(setq js2-missing-semi-one-line-override t)
(setq-default js2-basic-offset 2)))
;; Shows colors in css-mode
;; CSS color values colored by themselves
;; http://news.ycombinator.com/item?id=873541
(defvar hexcolor-keywords
'(("#[abcdef[:digit:]]+"
(0 (put-text-property
(match-beginning 0)
(match-end 0)
'face (list :background
(match-string-no-properties 0)))))))
(defun hexcolor-add-to-font-lock ()
(font-lock-add-keywords nil hexcolor-keywords))
(add-hook 'css-mode-hook 'hexcolor-add-to-font-lock)
;; Fixed jshint syntax cheking
(setq-default js2-global-externs '("module" "require" "buster" "sinon" "assert" "refute" "setTimeout" "clearTimeout" "setInterval" "clearInterval" "location" "__dirname" "console" "JSON" "angular" "process" "describe" "should" "expect" "it" "be" "exports" "$"))
(setq js-indent-level 2)
(setq json-reformat:indent-width 2)
(setq-default js2-strict-inconsistent-return-warning nil)
;; General emacs
(global-set-key (kbd "C-M-{") 'shrink-window-horizontally)
(global-set-key (kbd "C-M-}") 'enlarge-window-horizontally)
(setq frame-title-format "emacs -> %f") ; Always include the buffer name
;; Username for emacs session
(setq user-full-name "Edgar Talledos")
(setq user-mail-address "edgar.talledos@gmail.com")
;; Change cursor options
(blink-cursor-mode t)
;; Define key for browser-url with chromium
(global-set-key (kbd "C-x M-s") 'browse-url)
;; Disabled expand snippets in projectile
;; (setq projectile-rails-expand-snippet nil)
;; (setq projectile-mode-line nil)
;; Direct binding for evil-scape
(global-set-key (kbd "C-ñ") 'evil-escape)
;; Highlight
;; (add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
;; (setq highlight-indent-guides-method 'character)
;; Default languages for translate with google translate
(setq google-translate-default-source-language "en")
(setq google-translate-default-target-language "es")
;; add file names to json-mode
(add-to-list 'auto-mode-alist '("\\.jshintrc\\'" . json-mode))
;; (add-to-list 'auto-mode-alist '("\\.jsbeautifyrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.bowerrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.slack-term\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.postcssrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.posthtmlrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.babelrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.stylelintrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.eslintrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.prettierrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.lintstagedrc\\'" . json-mode))
(add-to-list 'auto-mode-alist '("\\.huskyrc\\'" . json-mode))
;; Java
(add-to-list 'auto-mode-alist '("\.groovy$" . groovy-mode))
(add-to-list 'auto-mode-alist '("\.gradle$" . groovy-mode))
(add-to-list 'interpreter-mode-alist '("groovy" . groovy-mode))
(add-to-list 'interpreter-mode-alist '("gradle" . groovy-mode))
(setq ns-use-srgb-colorspace nil)
;; Add my own binding for duplicate-line-or-region
(spacemacs/set-leader-keys
"xld" 'duplicate-line-or-region)
;; Add icon support for neotree
(setq neo-theme (if (display-graphic-p) 'icons 'arrow)
neo-banner-message "")
;; Add all-the-icons to dired-mode
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
;; Disabling js2 mode errors & warnings
(setq js2-mode-show-parse-errors nil)
(setq js2-mode-show-strict-warnings nil)
;; Add js2-mode to node files with bang
(add-to-list 'magic-mode-alist '("#!/usr/bin/env node" . js2-mode))
;; Setup eslint and lsp
;; (setq lsp-eslint-server-command
;; `("node" ,
;; (expand-file-name
;; (car
;; (last
;; (file-expand-wildcards "~/.vscode/extensions/dbaeumer.vscode-eslint-*/server/out/eslintServer.js"))))
;; "--stdio"))
)
;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(TeX-view-program-selection (quote ((output-pdf "Evince"))))
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(defun dotspacemacs/emacs-custom-settings ()
"Emacs custom settings.
This is an auto-generated function, do not modify its content directly, use
Emacs customize menu instead.
This function is called at the very end of Spacemacs initialization."
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(TeX-view-program-selection (quote ((output-pdf "Evince"))))
'(ansi-color-names-vector
["#eee8d5" "#dc322f" "#859900" "#b58900" "#268bd2" "#d33682" "#2aa198" "#839496"])
'(compilation-message-face (quote default))
'(cua-global-mark-cursor-color "#2aa198")
'(cua-normal-cursor-color "#657b83")
'(cua-overwrite-cursor-color "#b58900")
'(cua-read-only-cursor-color "#859900")
'(evil-want-Y-yank-to-eol nil)
'(fci-rule-color "#eee8d5")
'(highlight-changes-colors (quote ("#d33682" "#6c71c4")))
'(highlight-symbol-colors
(quote
("#eef6d970af00" "#cef5e0cccfbb" "#fd55c91cb29c" "#dadbd2efdc17" "#e0a3de02afa1" "#f84bcba1ad99" "#d28bd9ebdf8a")))
'(highlight-symbol-foreground-color "#586e75")
'(highlight-tail-colors
(quote
(("#eee8d5" . 0)
("#b3c34d" . 20)
("#6ccec0" . 30)
("#74adf5" . 50)
("#e1af4b" . 60)
("#fb7640" . 70)
("#ff699e" . 85)
("#eee8d5" . 100))))
'(hl-bg-colors
(quote
("#e1af4b" "#fb7640" "#ff6849" "#ff699e" "#8d85e7" "#74adf5" "#6ccec0" "#b3c34d")))
'(hl-fg-colors
(quote
("#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3")))
'(lsp-ui-doc-border "#586e75")
'(nrepl-message-colors
(quote
("#dc322f" "#cb4b16" "#b58900" "#5b7300" "#b3c34d" "#0061a8" "#2aa198" "#d33682" "#6c71c4")))
'(package-archives
(quote
(("org" . "https://orgmode.org/elpa/")
("gnu" . "https://elpa.gnu.org/packages/"))))
'(package-selected-packages
(quote
(humanoid-themes toml-mode flycheck-rust rust-mode phpunit phpcbf php-extras php-auto-yasnippets helm-gtags helm helm-core ggtags geben drupal-mode dap-mode bui counsel-gtags company-phpactor phpactor composer php-runtime company-php ac-php-core xcscope php-mode zenburn-theme zen-and-art-theme yasnippet-snippets yapfify yaml-mode xterm-color ws-butler writeroom-mode winum white-sand-theme which-key wgrep web-mode web-beautify vue-mode vterm volatile-highlights vmd-mode vimrc-mode vi-tilde-fringe uuidgen use-package unfill underwater-theme ujelly-theme twilight-theme twilight-bright-theme twilight-anti-bright-theme treemacs-projectile treemacs-persp treemacs-magit treemacs-icons-dired toxi-theme toc-org tide tern terminal-here tao-theme tangotango-theme tango-plus-theme tango-2-theme tagedit systemd symon symbol-overlay sunny-day-theme sublime-themes subatomic256-theme subatomic-theme string-inflection sql-indent spaceline-all-the-icons spacegray-theme soothe-theme solarized-theme soft-stone-theme soft-morning-theme soft-charcoal-theme smyx-theme smex smeargle slim-mode shell-pop seti-theme seeing-is-believing scss-mode sass-mode rvm ruby-tools ruby-test-mode ruby-refactor ruby-hash-syntax rubocopfmt rubocop rspec-mode robe rjsx-mode reverse-theme restart-emacs region-bindings-mode rebecca-theme rbenv rainbow-mode rainbow-identifiers rainbow-delimiters railscasts-theme pytest pyenv-mode py-isort purple-haze-theme pug-mode projectile-rails professional-theme prettier-js popwin planet-theme pippel pipenv pip-requirements phoenix-dark-pink-theme phoenix-dark-mono-theme password-generator paradox overseer orgit organic-green-theme org-projectile org-present org-pomodoro org-mime org-download org-cliplink org-bullets org-brain open-junk-file omtose-phellack-theme oldlace-theme occidental-theme obsidian-theme ob-restclient ob-http nodejs-repl noctilux-theme nginx-mode ng2-mode naquadah-theme nameless mwim mustang-theme multi-term move-text monokai-theme monochrome-theme molokai-theme moe-theme modus-vivendi-theme modus-operandi-theme minitest minimal-theme material-theme markdown-toc majapahit-theme magit-svn magit-section magit-gitflow madhat2r-theme macrostep lush-theme lsp-ui lsp-treemacs lsp-python-ms lsp-ivy lorem-ipsum livid-mode live-py-mode link-hint light-soap-theme kotlin-mode kaolin-themes json-navigator js2-refactor js-doc jbeans-theme jazz-theme ivy-yasnippet ivy-xref ivy-purpose ivy-hydra ir-black-theme insert-shebang inkpot-theme indent-guide importmagic impatient-mode hybrid-mode hungry-delete hl-todo highlight-parentheses highlight-numbers highlight-indentation heroku-theme hemisu-theme helm-make hc-zenburn-theme gruvbox-theme gruber-darker-theme groovy-mode groovy-imports graphql-mode grandshell-theme gotham-theme google-translate golden-ratio gnuplot gitignore-templates gitignore-mode github-search github-clone gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link git-gutter-fringe+ gist gh-md gandalf-theme fuzzy forge font-lock+ flycheck-pos-tip flycheck-package flycheck-kotlin flycheck-elsa flycheck-bashate flx-ido flutter-l10n-flycheck flow-minor-mode flatui-theme flatland-theme fish-mode feature-mode farmhouse-theme fancy-battery eziam-theme eyebrowse expand-region exotica-theme evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-textobj-line evil-surround evil-org evil-numbers evil-nerd-commenter evil-matchit evil-magit evil-lisp-state evil-lion evil-indent-plus evil-iedit-state evil-goggles evil-exchange evil-escape evil-ediff evil-cleverparens evil-args evil-anzu ess-R-data-view espresso-theme eslint-fix eshell-z eshell-prompt-extras esh-help engine-mode emr emmet-mode elisp-slime-nav ein editorconfig dumb-jump dracula-theme dotenv-mode doom-themes dockerfile-mode docker django-theme diminish devdocs define-word dart-mode darktooth-theme darkokai-theme darkmine-theme darkburn-theme dakrone-theme dactyl-mode cython-mode cyberpunk-theme csv-mode counsel-projectile counsel-css company-web company-shell company-restclient company-reftex company-auctex company-anaconda column-enforce-mode color-theme-sanityinc-tomorrow color-theme-sanityinc-solarized color-identifiers-mode clues-theme clojure-snippets clean-aindent-mode cider-eval-sexp-fu cider chruby chocolate-theme cherry-blossom-theme centered-cursor-mode busybee-theme bundler bubbleberry-theme browse-at-remote blacken birds-of-paradise-plus-theme badwolf-theme auto-yasnippet auto-highlight-symbol auto-compile apropospriate-theme anti-zenburn-theme android-mode ample-zen-theme ample-theme all-the-icons-dired alect-themes aggressive-indent afternoon-theme ace-link ac-ispell)))
'(pos-tip-background-color "#eee8d5")
'(pos-tip-foreground-color "#586e75")
'(send-mail-function (quote smtpmail-send-it))
'(smartrep-mode-line-active-bg (solarized-color-blend "#859900" "#eee8d5" 0.2))
'(smtpmail-smtp-server "smtp.gmail.com")
'(smtpmail-smtp-service 25)
'(term-default-bg-color "#fdf6e3")
'(term-default-fg-color "#657b83")
'(vc-annotate-background nil)
'(vc-annotate-background-mode nil)
'(vc-annotate-color-map
(quote
((20 . "#dc322f")
(40 . "#ca7966832090")
(60 . "#c05578c91534")
(80 . "#b58900")
(100 . "#a6088eed0000")
(120 . "#9e3a91a60000")
(140 . "#9628943b0000")
(160 . "#8dc596ad0000")
(180 . "#859900")
(200 . "#76ef9b6045e8")
(220 . "#6cd69ca95b9d")
(240 . "#5f5f9e06701f")
(260 . "#4c1a9f778424")
(280 . "#2aa198")
(300 . "#3002984eaf4d")
(320 . "#2f6f93e8bae0")
(340 . "#2c598f79c66f")
(360 . "#268bd2"))))
'(vc-annotate-very-old-color nil)
'(weechat-color-list
(quote
(unspecified "#fdf6e3" "#eee8d5" "#a7020a" "#dc322f" "#5b7300" "#859900" "#866300" "#b58900" "#0061a8" "#268bd2" "#a00559" "#d33682" "#007d76" "#2aa198" "#657b83" "#839496")))
'(xterm-color-names
["#eee8d5" "#dc322f" "#859900" "#b58900" "#268bd2" "#d33682" "#2aa198" "#073642"])
'(xterm-color-names-bright
["#fdf6e3" "#cb4b16" "#93a1a1" "#839496" "#657b83" "#6c71c4" "#586e75" "#002b36"]))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment