# Lunar Code

A lightweight, VSCode-inspired desktop code editor built with Tauri 2, React, TypeScript, CodeMirror 6, and shadcn/ui.

## Install

### Arch Linux (recommended)

Download `lunar-code-0.1.0-1-x86_64.pkg.tar.zst` from the [latest release](https://github.com/Lunxaaa/Lunar-code/releases/tag/v1), then:

```bash
sudo pacman -U lunar-code-0.1.0-1-x86_64.pkg.tar.zst
```

This installs the binary to `/usr/bin/lunar-code` and adds a `.desktop` entry so it shows up in your app launcher.

### Debian/Ubuntu

Download `Lunar.Code_0.1.0_amd64.deb` from the [latest release](https://github.com/Lunxaaa/Lunar-code/releases/tag/v1), then:

```bash
sudo dpkg -i Lunar.Code_0.1.0_amd64.deb
```

### Fedora/RHEL

Download `Lunar.Code-0.1.0-1.x86_64.rpm` from the [latest release](https://github.com/Lunxaaa/Lunar-code/releases/tag/v1), then:

```bash
sudo rpm -i Lunar.Code-0.1.0-1.x86_64.rpm
```

### Portable binary

Download the `lunar-code` binary from the release, make it executable, and run:

```bash
chmod +x lunar-code
./lunar-code
```

## Build from Source

### Prerequisites

#### Arch Linux

```bash
sudo pacman -S --needed \
  webkit2gtk-4.1 \
  base-devel \
  curl wget file openssl \
  appmenu-gtk-module \
  libappindicator-gtk3 \
  librsvg \
  rust
```

Also requires:
- Node.js >= 18
- pnpm (`npm install -g pnpm`)
- Rust stable toolchain (`rustup default stable`)

#### Other platforms

See [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/).

### Development

```bash
pnpm install
pnpm tauri dev
```

### Build

```bash
pnpm tauri build
```

### Build Arch package

```bash
makepkg -f
sudo pacman -U lunar-code-0.1.0-1-x86_64.pkg.tar.zst
```

## Features

- Integrated terminal (Ctrl+`)
- File explorer with context menu and search filter
- Editor tabs with drag reorder, dirty indicators, and unsaved changes confirmation
- Split editor (Ctrl+\)
- Find & replace across files (Ctrl+Shift+F)
- Go to line (Ctrl+G)
- CodeMirror 6 editor with syntax highlighting for 18+ languages
- Command palette (Ctrl+Shift+P)
- Quick file open (Ctrl+P)
- Find in file (Ctrl+F)
- Dark and light themes
- Custom CSS theme support
- Auto-save
- Recent workspaces
- Welcome tab with shortcuts reference
- Resizable sidebar and terminal panels
- Status bar with language selector, cursor position, encoding
- Settings: font size, tab size, word wrap, theme, auto-save, custom CSS

## Supported Languages

JavaScript/JSX, TypeScript/TSX, Python, Rust, C/C++, Java, Go, PHP, SQL, HTML, CSS, JSON, XML, Markdown, YAML, Shell/Bash, TOML, Dockerfile

## Keyboard Shortcuts

| Shortcut | Action |
|---|---|
| Ctrl+S | Save |
| Ctrl+Shift+S | Save All |
| Ctrl+W | Close Tab |
| Ctrl+P | Quick Open |
| Ctrl+Shift+P | Command Palette |
| Ctrl+B | Toggle Sidebar |
| Ctrl+F | Find in File |
| Ctrl+G | Go to Line |
| Ctrl+Shift+F | Search in Files |
| Ctrl+` | Toggle Terminal |
| Ctrl+\ | Split Editor |
| Ctrl+Z | Undo |
| Ctrl+Shift+Z | Redo |

## Tech Stack

- **Tauri 2** - Rust desktop shell
- **React 18** + TypeScript + Vite
- **shadcn/ui** - UI components (Radix + Tailwind)
- **CodeMirror 6** - Code editor core
- **xterm.js** - Integrated terminal
- **Lucide React** - Icons
