Skip to content

☀️ Vim in Emacs ☀️ My Personal Emacs Configuration

Notifications You must be signed in to change notification settings

Peter-Chou/petmacs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Petmacs

before you use Petmacs, make sure your emacs version >= 29.1 and tree-sitter is enabled.


1. Prerequisites

1.1 Fonts

if you want use nerd icons in terminal, make sure nerd fonts is used in your terminal.

1.2 ripgrep

install ripgrep and put it into your PATH

1.3 fd

install fd and put it into your PATH

1.4 nodejs

put nodejs binaries into your PATH

1.5 rime

install rime

# use terra-pinyin for chinese input
sudo apt-get install librime-dev fcitx-rime
# install build tools
sudo apt-get install cmake libtool-bin make

if your cmake is too old, download the suitable version from cmake.org

1.6 emacs-lsp-booster (speed up lsp service)

please install emacs-lsp-booster installed and in you PATH


2. Install

2.1 clone repository

git clone https://github.com/Peter-Chou/petmacs.git ~/.emacs.d

if you are facing some certification verification problems while cloning repository by git, try use the following command and rerun emacs:

export GIT_SSL_NO_VERIFY=1

2.2 install dynamic libs for tree-sitter

run the following command in emacs.

M-x treesit-auto-install-all

2.3 update builtin eglot to latest version

M-x eglot-upgrade-eglot

3. install LSP servers

3.1 basedpyright (Python)

# in your python environment
pip install basedpyright

3.2 eclipse jdtls (Java)

Please make sure java 17 is installed in /opt/jdk17 folder and run following commands in emacs.

M-x: eglot-java-upgrade-lsp-server
M-x: eglot-java-upgrade-junit-jar

3.3 clangd (C/C++)

use clangd in LLVM project. soft link llvm project to /opt/llvm.

or you can build it from source

sudo apt-get install build-essential lld

llvm_version=llvmorg-18.1.1
git clone -b $llvm_version --depth=1 https://gitee.com/mirrors/LLVM.git
cd LLVM
cmake -S llvm -B build -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=lld \
    -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lldb" \
    -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
    -DCMAKE_INSTALL_PREFIX=/opt/llvm
cmake --build build -j $(nproc)
sudo $(which cmake) --install build

4. install DAP servers

4.1 debugpy (Python)

pip install debugpy

4.2 java-debug (Java)

java-debug already been carried in ./data/lsp-java-jars/com.microsoft.java.debug.plugin-0.52.0.jar

4.3 lldb-dap (C/C++)

lldb-dap (formerly lldb-vscode) is built and installed in section 3.3

lldb-vscode adapter in dape actually calls lldb-dap


5. install formatter

petmacs use apheleia to format the buffer.

5.1 ruff (Python)

install ruff in your environment.

# for python linter and formatter
pip install ruff

5.2 google-java-format (Java)

# for java >= 11
npm install -g google-java-format
# for java 8
npm install -g google-java-format@1.7

5.3 clang-format (C/C++)

clang-format is already in LLVM project.

5.4 cmake-format (cmake)

pip install cmakelang

5.5 pg_format (SQL)

sudo apt-get install pgformatter

5.6 dprint (dockerfile, toml)

npm install -g dprint

5.7 prettier

npm install -g prettier

formatter for json, javascript, typescript, css, scss, html, graphql, markdown, yaml

5.8 xmllint (xml)

sudo apt-get install xmllint

6. Screenshots

dashboard


elisp