Skip to content

Instantly share code, notes, and snippets.

@anabastos
Last active August 14, 2026 18:19
Show Gist options
  • Select an option

  • Save anabastos/58f58de0ef2bada05d2746ee80742f27 to your computer and use it in GitHub Desktop.

Select an option

Save anabastos/58f58de0ef2bada05d2746ee80742f27 to your computer and use it in GitHub Desktop.
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
;; Fixar evil-want-keybinding ANTES que evil carregue.
;; Precisa estar ANTES de qualquer outra coisa, no scope global.
(setq evil-want-keybinding nil)
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
dotspacemacs-distribution 'spacemacs
dotspacemacs-enable-lazy-installation 'unused
dotspacemacs-ask-for-lazy-installation t
dotspacemacs-configuration-layer-path '()
;; List of configuration layers to load.
dotspacemacs-configuration-layers
'(;; ==================================================================
;; BASE / EDITOR
;; Layers fundamentais do dia a dia: navegacao, busca e edicao.
;; ==================================================================
emacs-lisp
helm ; framework de busca/navegacao (SPC SPC, SPC f f...)
multiple-cursors ; edicao com varios cursores
treemacs ; arvore de arquivos lateral (SPC f t)
;; auto-completion: necessario para o company mostrar as sugestoes
;; do LSP (JS/TS/Python/etc). Sem essa layer, lsp-mode roda mas
;; sem popup de completion.
auto-completion
;; ==================================================================
;; LINGUAGENS
;; Cada layer traz syntax highlight, indentacao e integracao com
;; LSP/REPL da linguagem correspondente.
;; ==================================================================
markdown
typescript
elixir
(dart :variables
lsp-dart-sdk-dir "/Users/ana.luiza/sdk-flutter/bin/cache/dart-sdk/")
(javascript :variables
javascript-backend 'lsp
javascript-import-tool 'import-js
javascript-fmt-tool 'prettier
javascript-fmt-on-save t
node-add-modules-path t
javascript-repl 'nodejs
javascript-lsp-linter t)
common-lisp
(python :variables
python-backend 'lsp
python-lsp-server 'pyright)
(yaml :variables yaml-enable-lsp t)
haskell
(clojure :variables clojure-enable-linters 'clj-kondo)
react
elm
;; rust: usa rust-analyzer via LSP (instalar com `rustup component
;; add rust-analyzer`); formata com rustfmt ao salvar
(rust :variables
rust-backend 'lsp
rustic-format-on-save t)
html
ocaml
(reasonml :variables reason-auto-refmt t)
vimscript
;; ==================================================================
;; DEVOPS / INFRA
;; ==================================================================
(docker :variables docker-dockerfile-backend 'lsp)
kubernetes
;; ==================================================================
;; FERRAMENTAS
;; ==================================================================
;; shell-default-shell fixado em eshell para nao puxar vterm
;; (foi removido intencionalmente, ver pacotes excluidos abaixo)
(shell :variables shell-default-shell 'eshell)
org ; organizacao, notas e agenda (org-mode)
git ; integracao com git via magit (SPC g s)
parinfer ; balanceamento automatico de parenteses (lisps)
;; ==================================================================
;; SOCIAL / DIVERSAO
;; ==================================================================
emoji
;; ==================================================================
;; TEMAS
;; ==================================================================
themes-megapack)
;; ------------------------------------------------------------------
;; Pacotes avulsos (fora de layers):
;; agent-shell -> Claude Code / Cursor dentro do Emacs (ver
;; `dotspacemacs/user-config')
;; elcord -> Discord Rich Presence: mostra no seu perfil do
;; Discord o que voce esta editando no Emacs
;; ------------------------------------------------------------------
dotspacemacs-additional-packages '(agent-shell
elcord)
;; A list of packages that cannot be updated.
dotspacemacs-frozen-packages '()
;; Pacotes de IA removidos explicitamente (substituidos por agent-shell)
dotspacemacs-excluded-packages '(copilot
gptel
aidermacs
aider
ellama
vterm
forge)
dotspacemacs-install-packages 'used-only))
(defun dotspacemacs/init ()
"Initialization:
This function is called at the very beginning of Spacemacs startup,
before layer configuration."
(setq-default
dotspacemacs-elpa-timeout 5
dotspacemacs-gc-cons '(100000000 0.1)
dotspacemacs-read-process-output-max (* 1024 1024)
dotspacemacs-use-spacelpa nil
dotspacemacs-verify-spacelpa-archives t
dotspacemacs-check-for-update nil
dotspacemacs-elpa-subdirectory 'emacs-version
dotspacemacs-editing-style 'vim
dotspacemacs-startup-buffer-show-version t
dotspacemacs-startup-banner 'official
dotspacemacs-startup-banner-scale 'auto
dotspacemacs-startup-lists '((recents . 5)
(projects . 7))
dotspacemacs-startup-buffer-responsive t
dotspacemacs-show-startup-list-numbers t
dotspacemacs-startup-buffer-multi-digit-delay 0.4
dotspacemacs-startup-buffer-show-icons nil
dotspacemacs-new-empty-buffer-major-mode 'text-mode
dotspacemacs-scratch-mode 'text-mode
dotspacemacs-scratch-buffer-persistent nil
dotspacemacs-scratch-buffer-unkillable nil
dotspacemacs-initial-scratch-message nil
dotspacemacs-themes '(spacemacs-dark
spacemacs-light)
;; mode-line com icones (all-the-icons)
dotspacemacs-mode-line-theme 'all-the-icons
dotspacemacs-colorize-cursor-according-to-state t
;; Victor Mono como fonte principal, com Fira Code como fallback
;; caso Victor Mono nao esteja instalada. Ambas tem suporte a
;; ligatures (ver `dotspacemacs/user-config').
dotspacemacs-default-font '(("Victor Mono"
:size 16
:weight normal
:width normal)
("Fira Code"
:size 16
:weight normal
:width normal))
dotspacemacs-default-icons-font 'all-the-icons
dotspacemacs-leader-key "SPC"
dotspacemacs-emacs-command-key "SPC"
dotspacemacs-ex-command-key ":"
dotspacemacs-emacs-leader-key "M-m"
dotspacemacs-major-mode-leader-key ","
dotspacemacs-major-mode-emacs-leader-key (if window-system "M-<return>" "C-M-m")
dotspacemacs-distinguish-gui-tab nil
dotspacemacs-default-layout-name "Default"
dotspacemacs-display-default-layout nil
dotspacemacs-auto-resume-layouts nil
dotspacemacs-auto-generate-layout-names nil
dotspacemacs-large-file-size 1
dotspacemacs-auto-save-file-location 'cache
dotspacemacs-max-rollback-slots 5
dotspacemacs-enable-paste-transient-state nil
dotspacemacs-which-key-delay 0.4
dotspacemacs-which-key-position 'bottom
dotspacemacs-switch-to-buffer-prefers-purpose nil
dotspacemacs-maximize-window-keep-side-windows t
dotspacemacs-enable-load-hints nil
dotspacemacs-enable-package-quickstart nil
dotspacemacs-loading-progress-bar t
dotspacemacs-fullscreen-at-startup nil
dotspacemacs-fullscreen-use-non-native nil
dotspacemacs-maximized-at-startup t
dotspacemacs-undecorated-at-startup nil
dotspacemacs-active-transparency 90
dotspacemacs-inactive-transparency 90
dotspacemacs-background-transparency 90
dotspacemacs-show-transient-state-title t
dotspacemacs-show-transient-state-color-guide t
dotspacemacs-mode-line-unicode-symbols t
dotspacemacs-smooth-scrolling t
dotspacemacs-scroll-bar-while-scrolling t
;; mantendo igual a primeira config (sem numeros de linha globais)
dotspacemacs-line-numbers nil
dotspacemacs-folding-method 'evil
dotspacemacs-smartparens-strict-mode nil
dotspacemacs-activate-smartparens-mode t
dotspacemacs-smart-closing-parenthesis nil
dotspacemacs-highlight-delimiters 'all
dotspacemacs-enable-server nil
dotspacemacs-server-socket-dir nil
dotspacemacs-persistent-server nil
dotspacemacs-search-tools '("rg" "ag" "ack" "grep")
dotspacemacs-undo-system 'undo-fu
dotspacemacs-frame-title-format "%I@%S"
dotspacemacs-icon-title-format nil
dotspacemacs-show-trailing-whitespace t
dotspacemacs-whitespace-cleanup nil
dotspacemacs-use-clean-aindent-mode t
dotspacemacs-use-SPC-as-y nil
dotspacemacs-swap-number-row nil
dotspacemacs-zone-out-when-idle nil
dotspacemacs-pretty-docs nil
dotspacemacs-home-shorten-agenda-source nil
dotspacemacs-byte-compile nil))
(defun dotspacemacs/user-env ()
"Environment variables setup."
(spacemacs/load-spacemacs-env))
(defun dotspacemacs/user-init ()
"Initialization for user code, before layer configuration."
)
(defun dotspacemacs/user-config ()
"Configuration for user code, after layer configuration."
;; ====================================================================
;; LSP -- configuracao geral
;; Vale para todas as linguagens que usam lsp-mode (JS/TS/Python...).
;; ====================================================================
(setq lsp-enable-snippet t ; expande snippets vindos do servidor
lsp-idle-delay 0.5 ; espera 0.5s parado antes de consultar
lsp-log-io nil ; sem log de I/O (mais performance)
lsp-prefer-flymake nil) ; usa flycheck em vez de flymake
;; Arquivos .cljc e .edn abrem em clojure-mode
(add-to-list 'auto-mode-alist '("\\.cljc\\'" . clojure-mode))
(add-to-list 'auto-mode-alist '("\\.edn\\'" . clojure-mode))
;; ====================================================================
;; JAVASCRIPT / TYPESCRIPT
;; Indentacao de 2 espacos + LSP ligado automaticamente.
;; ====================================================================
(setq js-indent-level 2
js2-basic-offset 2
typescript-indent-level 2)
(add-hook 'typescript-mode-hook #'lsp)
(add-hook 'js-mode-hook #'lsp)
;; ====================================================================
;; PYTHON
;; Interprete python3 + LSP (pyright, ver layers).
;; ====================================================================
(setq python-shell-interpreter "python3")
(add-hook 'python-mode-hook #'lsp)
;; ====================================================================
;; CLOJURE / CIDER
;; ====================================================================
(setq clojure-enable-linters t
cider-repl-display-help-banner nil ; sem banner no REPL
cider-save-file-on-load t ; salva ao dar load
cider-font-lock-dynamically '(macro core function var))
(add-hook 'cider-repl-mode-hook #'rainbow-delimiters-mode)
;; ====================================================================
;; EDICAO / QUALIDADE DE VIDA
;; ====================================================================
;; Recarrega buffers automaticamente quando o arquivo muda no disco
(global-auto-revert-mode t)
;; Mode-line mostra o caminho abreviado do arquivo, nao so o nome
(spaceline-define-segment buffer-id
(if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
(powerline-buffer-id)))
;; Fecha o minibuffer ao clicar fora dele (evita ficar "preso")
(defun stop-using-minibuffer ()
"Kill the minibuffer when clicking outside of it."
(when (and (>= (recursion-depth) 1) (active-minibuffer-window))
(abort-recursive-edit)))
(add-hook 'mouse-leave-buffer-hook 'stop-using-minibuffer)
;; Espacos em vez de tabs, largura 4, em todos os modos
(add-hook 'after-change-major-mode-hook
(lambda ()
(setq-default indent-tabs-mode nil)
(setq c-basic-indent 4)
(setq tab-width 4)))
;; ====================================================================
;; FONTE + LIGATURES
;; Victor Mono como principal, Fira Code como fallback. A tabela
;; abaixo habilita as ligatures (=>, ->, === viram simbolos unicos).
;; ====================================================================
(when (window-system)
(cond
((member "Victor Mono" (font-family-list))
(set-frame-font "Victor Mono-16" nil t))
((member "Fira Code" (font-family-list))
(set-frame-font "Fira Code-16" nil t))))
(let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
(35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
(36 . ".\\(?:>\\)")
(37 . ".\\(?:\\(?:%%\\)\\|%\\)")
(38 . ".\\(?:\\(?:&&\\)\\|&\\)")
(42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
(43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
(45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
(46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)")
(47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
(48 . ".\\(?:x[a-zA-Z]\\)")
(58 . ".\\(?:::\\|[:=]\\)")
(59 . ".\\(?:;;\\|;\\)")
(60 . ".\\(?:\\(?:!--\\)\\|\\(?:~~\\|->\\|\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[*$+~/<=>|-]\\)")
(61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
(62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
(63 . ".\\(?:\\(\\?\\?\\)\\|[:=?]\\)")
(91 . ".\\(?:]\\)")
(92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
(94 . ".\\(?:=\\)")
(119 . ".\\(?:ww\\)")
(123 . ".\\(?:-\\)")
(124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
(126 . ".\\(?:~>\\|~~\\|[>=@~-]\\)")
)))
(dolist (char-regexp alist)
(set-char-table-range composition-function-table (car char-regexp)
`([,(cdr char-regexp) 0 font-shape-gstring]))))
;; ====================================================================
;; AGENT SHELL (Claude Code + Cursor, via ACP)
;; https://github.com/xenodium/agent-shell
;; ====================================================================
;; Dependencias externas (rodar uma vez fora do Emacs):
;; npm install -g @agentclientprotocol/claude-agent-acp ; Claude Agent
;; npm install -g @blowmage/cursor-agent-acp ; Cursor (empresa)
;; Depois, logar uma vez em cada CLI fora do Emacs (claude / cursor-agent
;; login) para autenticar a assinatura.
(setq agent-shell-anthropic-authentication
(agent-shell-anthropic-make-authentication :login t))
(setq agent-shell-preferred-agent-config
(agent-shell-anthropic-make-claude-code-config))
;; M-x agent-shell-anthropic-start-claude-code -> sessao com Claude
;; M-x agent-shell-cursor-start-agent -> sessao com Cursor
;; ====================================================================
;; DISCORD (elcord -- Rich Presence)
;; https://github.com/Mstrodl/elcord
;; Mostra no seu perfil do Discord o arquivo/linguagem que voce esta
;; editando. O Discord precisa estar aberto na mesma maquina.
;; ====================================================================
(setq elcord-editor-icon "emacs_icon" ; icone do Emacs no presence
elcord-quiet t ; sem mensagens de conexao no echo
elcord-idle-message "Fazendo outra coisa...")
;; Desliga o presence quando o Emacs fica ocioso (privacidade + economia)
(setq elcord-idle-timer 300)
(elcord-mode)
;; Para desligar na sessao atual: M-x elcord-mode
;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
)
;; Este bloco eh gerado automaticamente pelo Emacs (Customize).
;; Deixe vazio num arquivo novo -- sera preenchido sozinho na primeira
;; vez que voce rodar o Spacemacs e ele instalar as layers.
(custom-set-variables
;; custom-set-variables was added by Custom.
)
(custom-set-faces
;; custom-set-faces was added by Custom.
)
@anabastos

Copy link
Copy Markdown
Author

Requisitos:

  • Victor mono

@anabastos

anabastos commented Mar 9, 2020

Copy link
Copy Markdown
Author

NODEJS

npm i -g yaml-language-server
npm install -g eslint tern babel-eslint eslint-plugin-react js-beautify prettier

all settings are customizable (whitespace, formatting style, etc..) by .jsbeautifyrc configuration file.

@anabastos

anabastos commented Mar 9, 2020

Copy link
Copy Markdown
Author

M-x package-install hover
M-x package-install [RET] lsp-mode
M-x package-install cider

@anabastos

Copy link
Copy Markdown
Author

@anabastos

Copy link
Copy Markdown
Author

PYTHON

pip install flake8
pip install autoflake
pip install importmagic epc

@anabastos

Copy link
Copy Markdown
Author

Emoji
apt-get install ttf-ancient-fonts

@anabastos

Copy link
Copy Markdown
Author

@anabastos

Copy link
Copy Markdown
Author

Create a file ~/.lein/profiles.clj with the following content:

{:repl
 {:plugins [;; When running an older version of CIDER (pre 0.18), use the
            ;; version that best matches M-x cider-version. For versions since
            ;; 0.18.0 use whatever version is the most recent.
            [cider/cider-nrepl "0.21.1"]

            ;; Only necessary when using clj-refactor
            [refactor-nrepl "2.4.0"]

            ;; Only necessary when using sayid
            [com.billpiel/sayid "0.0.17"]]

  :dependencies [[nrepl "0.4.5"]]

  :repl-options
  {:nrepl-middleware [refactor-nrepl.middleware/wrap-refactor ;; clj-refactor
                      com.billpiel.sayid.nrepl-middleware/wrap-sayid ;; sayid
                      ]}}}

@anabastos

Copy link
Copy Markdown
Author

HTML

gem install specific_install
gem specific_install https://github.com/brigade/scss-lint.git
gem specific_install https://github.com/Sweetchuck/scss_lint_reporter_checkstyle.git

Enable by
css-enable-lsp
less-enable-lsp
scss-enable-lsp
html-enable-lsp

@anabastos

Copy link
Copy Markdown
Author

Be sure to have the e4x option set to true on your .jsbeautifyrc here it is my configuration as an example:

{
  "indent_size": 2,
  "indent_char": " ",
  "eol": "\n",
  "indent_level": 0,
  "indent_with_tabs": false,
  "preserve_newlines": true,
  "max_preserve_newlines": 2,
  "jslint_happy": false,
  "space_after_anon_function": false,
  "brace_style": "collapse",
  "keep_array_indentation": false,
  "keep_function_indentation": false,
  "space_before_conditional": true,
  "break_chained_methods": true,
  "eval_code": false,
  "unescape_strings": false,
  "wrap_line_length": 80,
  "wrap_attributes": "auto",
  "wrap_attributes_indent_size": 2,
  "e4x": true,
  "end_with_newline": true,
  "brace_style": "collapse-preserve-inline"
}

@anabastos

Copy link
Copy Markdown
Author

To install them, use the following command:

opam install merlin utop ocp-indent
Make sure opam is initialized and configured.

opam init
opam config setup -a

@anabastos

Copy link
Copy Markdown
Author

npm install -g intelephense

@anabastos

Copy link
Copy Markdown
Author

opam install merlin reason

@anabastos

Copy link
Copy Markdown
Author

cargo install rustfmt

@anabastos

Copy link
Copy Markdown
Author

npm install -g import-js
npm i -g typescript typescript-language-server
npm i -g flow-bin

cabal install apply-refact hlint stylish-haskell hasktags hoogle

https://develop.spacemacs.org/layers/+source-control/github/README.html

https://develop.spacemacs.org/layers/+themes/colors/README.html

stack install hadolint
npm i -g dockerfile-language-server-nodejs

brew install cmake
brew install libvterm
sudo apt install libtool-bin

https://develop.spacemacs.org/layers/+web-services/wakatime/README.html
pip install wakatime

@anabastos

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment