Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Peter-Chou/petmacs

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

sudo apt-get install librime-dev fcitx-rime # use terra-pinyin for chinese input

1.6 snap (ubuntu)

sudo apt-get update
sudo apt-get install snapd

add /snap/bin to PATH

1.7 libvterm (ubuntu)

sudo apt-get install libvterm-dev

1.8 sqlite3 (ubuntu)

# for magit
sudo apt-get install libsqlite3-dev

1.9 build tools

# install build tools
sudo apt-get install build-essential ninja-build
sudo apt-get install cmake libtool-bin make

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

1.10 ctags

sudo apt-get install -y universal-ctags

1.11 jq

sudo apt-get install -y jq

1.12 readability

npm install -g readability-cli

1.13 go-grip

install go-grip and put it into your PATH for markdown preview.


2. Install

2.1 clone repository

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

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)

pip install basedpyright # install basedpyright in python environment

3.2 eclipse jdtls (Java)

Please make sure java 21 is installed in /opt/jdk21 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

llvm_version=llvmorg-22.1.0 # set version
# download llvm project
git clone -b $llvm_version --depth=1 https://github.com/llvm/llvm-project.git $llvm_version
# cmake setup
cd $llvm_version && cmake -S llvm -G Ninja -B build -DCMAKE_BUILD_TYPE=Release \
    -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;lldb" \
    -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
    -DCMAKE_INSTALL_PREFIX=/opt/softwares/$llvm_version
# build targets
cmake --build build -j $(nproc)
# install 
sudo $(which cmake) --install build
# add soft link
sudo ln -sf /opt/softwares/$llvm_version /opt/llvm

3.4 neocmakelsp (cmake)

download neocmakelsp (musl version) and put it into your PATH.

3.5 docker-langserver (dockerfile)

npm install -g dockerfile-language-server-nodejs

3.6 bash-language-server (bash/sh)

npm install -g bash-language-server

4. Install DAP Servers

4.1 debugpy (Python)

pip install debugpy

4.2 junit-platform-console-standalone (Java)

junit-platform-console-standalone is already installed in M-x: eglot-java-upgrade-junit-jar command

4.3 lldb-dap (C/C++)

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


5. Install Formatter

petmacs use apheleia to format the buffer.

5.1 ruff (Python)

install ruff in your environment.

pip install ruff
pip install autoflake isort # Optional

5.2 google-java-format (Java)

# for java >= 11
npm install -g google-java-format
# for java 8
npm install -g [email protected]

5.3 clang-format (C/C++)

clang-format is already in LLVM project.

5.4 shfmt (bash/sh)

install shfmt and put it into your PATH

5.5 prettier

npm install -g prettier

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

5.6 cmake-format (cmake)

sudo apt-get install cmake-format

5.7 pg_format (SQL)

sudo apt-get install pgformatter

5.8 dprint (dockerfile)

npm install -g dprint

5.9 taplo (toml)

install taplo and put it into your PATH

5.10 xmllint (xml)

sudo apt-get install libxml2-utils

6. Debug

You can add your test config to init-mini.el and use the following command to ease your debug process.

emacs -Q -l ~/.emacs.d/init-mini.el

7. Screenshots

dashboard


vcs


elisp

About

☀️ Vim in Emacs ☀️ My Personal Emacs Configuration

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors