A comprehensive Emacs configuration focused on Python, C++, and Go development with modern IDE-like features.
git clone https://github.com/slgao/emacs.d.git ~/.emacs.dStart Emacs and the configuration will automatically install required packages on first run.
Then complete the one-time manual setup steps described below for each language/tool you use.
- Auto-completion: Company mode with intelligent backends
- Syntax checking: Flycheck with language-specific linters
- Project navigation: Ivy/Counsel/Swiper for fuzzy searching
- Version control: Magit integration for Git
- Window management: Ace-window for quick window switching
- File management: Enhanced Dired with dired+
- Multiple cursors: Edit multiple locations simultaneously
- LSP mode: Full IDE experience via
pylsp(goto-definition, completion, diagnostics) - Virtual environment support: pyvenv for environment switching
- Code formatting: py-autopep8 with customizable line length (100 chars)
- Documentation: Sphinx-doc mode for docstring generation
- Linting: Flake8 integration via Flycheck
- Irony mode: Clang-based completion and syntax checking
- Company-irony: Intelligent auto-completion
- CMake support: CMake mode for build configuration
- Code formatting: Clang-format integration
- Flycheck-irony: Real-time syntax checking
- Helm-gtags: Code navigation and symbol lookup
- GitHub Copilot: Inline completions in Python, C/C++, shell, YAML, and Terraform
- Accept completion:
C-M-<return> - Next/previous suggestion:
C-M-<next>/C-M-<prior> - Accept by word:
C-M-<right> - Accept by line:
C-M-<down> - Clear overlay:
C-c C-c
- Accept completion:
- Themes: Multiple themes available (Gruvbox default, Monokai, Zenburn, etc.)
- Smart defaults: Sensible configuration out of the box
- Custom keybindings: Optimized workflow shortcuts
- Visual indicators: Line highlighting, parentheses matching
- Time display: Date and time in mode line
- Recent files: Quick access to recently opened files
- Org mode: Enhanced with org-bullets and agenda integration
- Terraform: terraform-mode with LSP support
- Web development: Web-mode and Emmet for HTML/CSS
- Git integration: Magit for version control
- Snippet expansion: YASnippet support
- Kill ring browser: Enhanced clipboard management
- Undo tree: Visual undo/redo system
- Neotree: File tree sidebar with icons
~/.emacs.d/
├── early-init.el # Prevents package.el auto-init (loaded before init.el)
├── init.el # Entry point, loads org-babel config
├── shulins_emacs_config.org # Main configuration in org-babel format
├── lisp/ # Modular configuration files
│ ├── init-packages.el # Package management and setup
│ ├── init-ui.el # UI and theme configuration
│ ├── init-better-defaults.el # Sensible defaults
│ ├── init-keybindings.el # Custom key bindings
│ ├── init-org.el # Org mode configuration
│ ├── init-utils.org # Utility functions
│ └── custom.el # Emacs custom variables
├── site-lisp/ # Third-party packages
│ ├── nadvice_.el # Extended advice system
│ ├── org-bullets.el # Org mode visual enhancements
│ ├── dired+.el # Enhanced directory editor
│ └── move-lines.el # Line manipulation utilities
└── snippets/ # YASnippet templates
F2- Open init fileC-x C-r- Recent filesC-s- Swiper searchM-x- Counsel M-x (enhanced command palette)C-x C-f- Counsel find fileC-x o- Ace window (quick window switching)C-c a- Org agendaM-/- Hippie expand (smart completion)C-c f- Open current directory in OS file managerC-c r- Revert (reload) current buffer
M-.- Go to definition (via lsp-mode / xref)M-,- Go back after jumpM-s i- Browse symbols in current file (counsel-imenu, LSP-enriched)M-s I- Search symbols across entire project (lsp-ivy workspace)C-h C-f- Find function definitionC-h C-v- Find variable definitionC-h C-k- Find function on keyC-M-\- Indent region or bufferC-:- Avy goto word (quick navigation)
These steps must be completed once per machine after cloning.
pip3 install python-lsp-serverpip install python-lsp-serverNo further Emacs configuration needed — lsp-mode auto-starts when you open a Python file and M-. navigates to definitions.
To switch virtual environments at runtime use M-x pyvenv-activate.
| Platform | Command |
|---|---|
| Linux (Debian/Ubuntu) | sudo apt-get install nodejs npm |
| macOS | brew install node |
| Windows | Download from https://nodejs.org |
Inside Emacs:
M-x copilot-install-server
Inside Emacs:
M-x copilot-login
Follow the device-auth prompt: copy the code shown in the minibuffer, open the URL in a browser, and paste the code. Copilot will activate automatically after login.
# Linux
sudo apt-get install clang cmake
# macOS
brew install llvm cmakeInside Emacs, run once per project:
M-x irony-install-server
Install the Terraform LSP server:
# Download terraform-ls from https://github.com/hashicorp/terraform-ls/releases
# and place the binary somewhere on your PATH- Install Go from https://go.dev/dl/
- Install the Go language server:
go install golang.org/x/tools/gopls@latest
No further Emacs configuration needed — lsp-mode auto-starts, gofmt/goimports runs on save, and Copilot is active in go-mode buffers.
Packages are managed via MELPA/ELPA (package.el). On first Emacs startup, all packages listed in shulin/packages in lisp/init-packages.el are installed automatically.
- Add the package name to
shulin/packagesinlisp/init-packages.el - Add configuration in the same file or create a new module
- Restart Emacs
Edit lisp/init-ui.el and change the load-theme line:
(load-theme 'your-preferred-theme t)Add new bindings in lisp/init-keybindings.el.
LSP mode failed to start. Check:
pylspis installed and on PATH:which pylsp- Emacs can see it:
M-x eval-expression→(executable-find "pylsp") - View LSP status:
M-x lsp-describe-session
Run M-x copilot-login and complete the GitHub device-auth flow.
Run M-x copilot-install-server (requires npm).
- Switch virtual environment:
M-x pyvenv-activate - Check LSP server status:
M-x lsp-describe-session
- Ensure clang is installed and accessible
- Provide
compile_commands.json(via CMake withCMAKE_EXPORT_COMPILE_COMMANDS=ON)
- Emacs 26+
- Git
- Python 3.6+ with pip
- Node.js 18+ and npm (for Copilot)
- Clang (for C++ development)
- CMake (for C++ project management)
- Go 1.18+ with
gopls(for Go development)
This configuration is provided as-is for educational and personal use.