From c3a7f845ee13f84fbcb22472804a4239d176245c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 21 Dec 2025 19:24:49 +0000 Subject: [PATCH 01/11] Bump org.apache.logging.log4j:log4j-core from 2.22.1 to 2.25.3 Bumps org.apache.logging.log4j:log4j-core from 2.22.1 to 2.25.3. --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-core dependency-version: 2.25.3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 22f66c67..91c62bb6 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ org.apache.logging.log4j log4j-core - 2.22.1 + 2.25.3 org.eclipse.lsp4j From 2d4ec9c0687d0071df981d8695d06061018ee6eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Sun, 21 Dec 2025 20:47:17 +0100 Subject: [PATCH 02/11] Create README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..30fba937 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +Strange Variety Vi Improved, or **swim**, is the ultimate text editor, written in Java. +Keybindings are similar to vi based editors. But this one is written in Java and runs in a JVM. + +For the best experience, run with -XX:+UseZGC, as ZGC is the best garbage collector. From a0db607ff1b609107d8a5572f179358ee28444b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Sun, 21 Dec 2025 20:49:47 +0100 Subject: [PATCH 03/11] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 30fba937..b2c2528a 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,12 @@ Strange Variety Vi Improved, or **swim**, is the ultimate text editor, written i Keybindings are similar to vi based editors. But this one is written in Java and runs in a JVM. For the best experience, run with -XX:+UseZGC, as ZGC is the best garbage collector. + +# Building # + +Swim is using JDK 25, so make sure you have that installed. +In order to build swim, run the following command: + +``` +mvn clean package +``` From 01f1d9ea8b1911bcd5f4ac578cc8fcd934279b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Sun, 21 Dec 2025 20:52:04 +0100 Subject: [PATCH 04/11] Update README.md --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2c2528a..4e23f360 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Strange Variety Vi Improved, or **swim**, is the ultimate text editor, written in Java. Keybindings are similar to vi based editors. But this one is written in Java and runs in a JVM. -For the best experience, run with -XX:+UseZGC, as ZGC is the best garbage collector. - # Building # Swim is using JDK 25, so make sure you have that installed. @@ -11,3 +9,11 @@ In order to build swim, run the following command: ``` mvn clean package ``` + +# Running # + +In order to edit a file with swim, use the following command: + +``` +java -XX:+UseZGC -cp "target/swim-0.0.1-SNAPSHOT.jar:target/libs/*" +``` \ No newline at end of file From 1d4f9095731626c4a3fb413f9c181f5d074c5bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Sun, 21 Dec 2025 21:11:23 +0100 Subject: [PATCH 05/11] Update README.md --- README.md | 14 +++++++++++++- src/main/java/{.fisked => .swim} | 0 2 files changed, 13 insertions(+), 1 deletion(-) rename src/main/java/{.fisked => .swim} (100%) diff --git a/README.md b/README.md index 4e23f360..b3f31f71 100644 --- a/README.md +++ b/README.md @@ -15,5 +15,17 @@ mvn clean package In order to edit a file with swim, use the following command: ``` -java -XX:+UseZGC -cp "target/swim-0.0.1-SNAPSHOT.jar:target/libs/*" +java -XX:+UseZGC -cp "target/swim-0.0.1-SNAPSHOT.jar:target/libs/*" org.fisk.swim.Swim +``` + +For the best experience, create an alias, like this: + +``` +alias swim="java -XX:+UseZGC -cp "/target/swim-0.0.1-SNAPSHOT.jar:target/libs/*" org.fisk.swim.Swim " +``` + +where `` is the path where swim was cloned. With this alias, you can open files like a pro: + +``` +swim ``` \ No newline at end of file diff --git a/src/main/java/.fisked b/src/main/java/.swim similarity index 100% rename from src/main/java/.fisked rename to src/main/java/.swim From 34723ad0c1ffe181040dfd20be29bf940e985ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Sun, 21 Dec 2025 21:13:08 +0100 Subject: [PATCH 06/11] remove resources --- src/main/resources/main.jpm | 15 --------------- src/main/resources/simplelogger.properties | 2 -- 2 files changed, 17 deletions(-) delete mode 100644 src/main/resources/main.jpm delete mode 100644 src/main/resources/simplelogger.properties diff --git a/src/main/resources/main.jpm b/src/main/resources/main.jpm deleted file mode 100644 index 2954e939..00000000 --- a/src/main/resources/main.jpm +++ /dev/null @@ -1,15 +0,0 @@ -{ - module: "org.fisk.fisked-1.0.0" - dependencies: [ - "gson-2.8.2", - "java.sql-11.0.6", - "java.management-11.0.8", - "lanterna-3.0.1", - "lucene.core-8.4.1", - "org.eclipse.jgit-5.8.0", - "org.eclipse.lsp4j-0.8.1", - "org.eclipse.lsp4j.jsonrpc-0.8.1", - "slf4j.api-1.7.2", - "slf4j.simple-1.7.2" - ] -} diff --git a/src/main/resources/simplelogger.properties b/src/main/resources/simplelogger.properties deleted file mode 100644 index 5df3896b..00000000 --- a/src/main/resources/simplelogger.properties +++ /dev/null @@ -1,2 +0,0 @@ -org.slf4j.simpleLogger.logFile=/tmp/fisked.log - From 51f558e72c6e31af7a7a3b0e5b0932b5b7a97e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Sun, 21 Dec 2025 22:14:49 +0100 Subject: [PATCH 07/11] Fix logging --- src/main/java/org/fisk/swim/Swim.java | 53 ++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/fisk/swim/Swim.java b/src/main/java/org/fisk/swim/Swim.java index 8a043a95..f0947c7e 100644 --- a/src/main/java/org/fisk/swim/Swim.java +++ b/src/main/java/org/fisk/swim/Swim.java @@ -5,21 +5,62 @@ import java.io.PrintStream; import java.nio.file.Path; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.config.Configuration; +import org.apache.logging.log4j.core.appender.FileAppender; +import org.apache.logging.log4j.core.layout.PatternLayout; +import org.apache.logging.log4j.core.config.LoggerConfig; + import org.fisk.swim.event.IOThread; import org.fisk.swim.terminal.TerminalContext; import org.fisk.swim.ui.Window; import org.fisk.swim.utils.LogFactory; -import org.slf4j.Logger; public class Swim { - private static final Logger _log = LogFactory.createLog(); + private static Logger _log; private static void setupLogging() { try { - File file = new File("/tmp/swim.log"); - FileOutputStream fos = new FileOutputStream(file); - PrintStream ps = new PrintStream(fos); - System.setErr(ps); + // Get the current PID + String pid = java.lang.management.ManagementFactory.getRuntimeMXBean().getName().split("@")[0]; + String fileName = "/tmp/swim-" + pid + ".log"; + + // Programmatically add or update the File Appender + LoggerContext context = (LoggerContext) LogManager.getContext(false); + Configuration config = context.getConfiguration(); + + PatternLayout layout = PatternLayout.newBuilder() + .withPattern("%d [%t] %-5p %c - %m%n") + .build(); + + FileAppender appender = FileAppender.newBuilder() + .setName("FileAppender") + .withFileName(fileName) + .setLayout(layout) + .setConfiguration(config) + .build(); + appender.start(); + config.addAppender(appender); + + // Attach to root logger so ALL loggers write here + LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME); + + // Remove all existing appenders + for (String appenderName : loggerConfig.getAppenders().keySet()) { + loggerConfig.removeAppender(appenderName); + } + + loggerConfig.addAppender(appender, Level.DEBUG, null); + + // Ensure desired log level + loggerConfig.setLevel(Level.DEBUG); + + context.updateLoggers(); + + _log = LogManager.getLogger(Swim.class); } catch (Throwable e) { } } From b55080ca12683b8fc36ae6f2ec336ca12028dadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Tue, 30 Dec 2025 18:26:05 +0100 Subject: [PATCH 08/11] AI generated keybinding tutorial --- README.md | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b3f31f71..ff8c0952 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,91 @@ In order to build swim, run the following command: mvn clean package ``` -# Running # +# Keybindings + +The SWIM editor provides a Vim‑style modal interface with a set of key‑bindings that cover navigation, editing, and Java LSP integration. Below is a consolidated reference for the current behaviour. + +## Navigation & movement + +| Key sequence | Action | +|--------------|--------| +| `-y` | Scroll buffer view up | +| `-e` | Scroll buffer view down | +| `$` | Go to end of line | +| `^` | Go to start of line | +| `h` | Move cursor left | +| `l` | Move cursor right | +| `j` | Move cursor down | +| `k` | Move cursor up | +| `` | Move cursor left | +| `` | Move cursor right | +| `` | Move cursor down | +| `` | Move cursor up | +| `g g` | Go to start of buffer | +| `G` | Go to end of buffer | +| `f` (followed by a character) | Find next occurrence of character | +| `F` (followed by a character) | Find previous occurrence of character | + +## Normal‑mode bindings + +| Key sequence | Action | +|--------------|--------| +| ` e i` | `JavaLSPClient.organizeImports()` | +| ` e f` | `JavaLSPClient.makeFinal()` | +| ` e a` | `JavaLSPClient.generateAccessors()` | +| ` e s` | `JavaLSPClient.generateToString()` | +| ` e l` | `JavaLSPClient.codeLens()` | +| `i` | Switch to **Insert** mode | +| `v` | Switch to **Visual** mode | +| `V` | Switch to **Visual Line** mode | +| `-v` | Switch to **Visual Block** mode | +| `u` | Undo last change | +| `-r` | Redo last undone change | +| `d i w` | Delete inner word | +| `d w` | Delete next word | +| `d d` | Delete current line | +| `x` | Delete character under cursor | +| `c i w` | Change inner word (delete + switch to insert) | +| `c w` | Change next word (delete + switch to insert) | +| `a` | Switch to insert mode and move cursor right (append) | +| `A` | Switch to insert mode and move cursor to end of line (append) | +| `o` | Insert new line below current line, switch to insert mode | +| `O` | Insert new line above current line, switch to insert mode | +| `p` | Paste after cursor (handles line vs. character copy) | +| `P` | Paste before cursor (handles line vs. character copy) | +| `y y` | Yank (copy) current line | +| `m` | Toggle display of the file list panel (Project Files) | +| `:` | Activate command line (prefix `:`) | +| `*` | Search for inner word under cursor and activate search | +| `#` | Search for inner word under cursor backwards and activate search | +| `/` | Activate forward search prompt | +| `?` | Activate backward search prompt | +| `n` | Go to next search match | +| `N` | Go to previous search match | + +## Visual‑mode bindings + +The visual modes share the same navigation bindings as normal mode. They add the following actions: + +| Key sequence | Action | +|--------------|--------| +| `d i w` | Delete the selected inner word | +| `d w` | Delete the selected word | +| `d d` | Delete the selected line(s) | +| `x` | Delete the selection | +| `y y` | Yank the selection | + +**Note**: Switching out of visual mode back to normal mode is typically done by pressing ``. + +## Quick reference cheatsheet + +``` +Movement | Action +--------------|-------- +... +``` + +--- In order to edit a file with swim, use the following command: From b575abdba62ea3d69464ec46b04659be746400c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Wed, 31 Dec 2025 13:49:50 +0100 Subject: [PATCH 09/11] Further AI editing the readme --- README.md | 181 ++++++++++++++++++++++++------------------------------ 1 file changed, 79 insertions(+), 102 deletions(-) diff --git a/README.md b/README.md index ff8c0952..a4a6b810 100644 --- a/README.md +++ b/README.md @@ -1,115 +1,92 @@ -Strange Variety Vi Improved, or **swim**, is the ultimate text editor, written in Java. -Keybindings are similar to vi based editors. But this one is written in Java and runs in a JVM. +# SWIM – The Java‑powered Vim‑style Editor -# Building # +> **SWIM** stands for *Strange Variety Vi Improved* – the ultimate modal text editor built on the Java platform. It delivers the power and speed of Vim, the flexibility of Java, and the extensibility of a full language‑server ecosystem—all in a single, lightweight JAR. -Swim is using JDK 25, so make sure you have that installed. -In order to build swim, run the following command: +| Feature | What it gives you | +|---------|-------------------| +| **Vim‑style modal editing** | Classic keystrokes, visual and block selections, powerful motions. +| **Pure Java implementation** | Runs on any JVM, no native dependencies, simple `mvn` build. +| **Native Java LSP integration** | Auto‑completion, go‑to‑definition, refactoring for Java (and LaTeX, etc.) right out of the box. +| **Extensible** | Add custom modes or plugins in Java – treat the editor as a platform, not a product. +| **Zero‑configuration** | One command to launch, alias support for quick launching. +| **Lightweight** | Less than 50 MB, no external libraries besides the standard JDK. -``` -mvn clean package -``` +## Quick Start -# Keybindings - -The SWIM editor provides a Vim‑style modal interface with a set of key‑bindings that cover navigation, editing, and Java LSP integration. Below is a consolidated reference for the current behaviour. - -## Navigation & movement - -| Key sequence | Action | -|--------------|--------| -| `-y` | Scroll buffer view up | -| `-e` | Scroll buffer view down | -| `$` | Go to end of line | -| `^` | Go to start of line | -| `h` | Move cursor left | -| `l` | Move cursor right | -| `j` | Move cursor down | -| `k` | Move cursor up | -| `` | Move cursor left | -| `` | Move cursor right | -| `` | Move cursor down | -| `` | Move cursor up | -| `g g` | Go to start of buffer | -| `G` | Go to end of buffer | -| `f` (followed by a character) | Find next occurrence of character | -| `F` (followed by a character) | Find previous occurrence of character | - -## Normal‑mode bindings - -| Key sequence | Action | -|--------------|--------| -| ` e i` | `JavaLSPClient.organizeImports()` | -| ` e f` | `JavaLSPClient.makeFinal()` | -| ` e a` | `JavaLSPClient.generateAccessors()` | -| ` e s` | `JavaLSPClient.generateToString()` | -| ` e l` | `JavaLSPClient.codeLens()` | -| `i` | Switch to **Insert** mode | -| `v` | Switch to **Visual** mode | -| `V` | Switch to **Visual Line** mode | -| `-v` | Switch to **Visual Block** mode | -| `u` | Undo last change | -| `-r` | Redo last undone change | -| `d i w` | Delete inner word | -| `d w` | Delete next word | -| `d d` | Delete current line | -| `x` | Delete character under cursor | -| `c i w` | Change inner word (delete + switch to insert) | -| `c w` | Change next word (delete + switch to insert) | -| `a` | Switch to insert mode and move cursor right (append) | -| `A` | Switch to insert mode and move cursor to end of line (append) | -| `o` | Insert new line below current line, switch to insert mode | -| `O` | Insert new line above current line, switch to insert mode | -| `p` | Paste after cursor (handles line vs. character copy) | -| `P` | Paste before cursor (handles line vs. character copy) | -| `y y` | Yank (copy) current line | -| `m` | Toggle display of the file list panel (Project Files) | -| `:` | Activate command line (prefix `:`) | -| `*` | Search for inner word under cursor and activate search | -| `#` | Search for inner word under cursor backwards and activate search | -| `/` | Activate forward search prompt | -| `?` | Activate backward search prompt | -| `n` | Go to next search match | -| `N` | Go to previous search match | - -## Visual‑mode bindings - -The visual modes share the same navigation bindings as normal mode. They add the following actions: - -| Key sequence | Action | -|--------------|--------| -| `d i w` | Delete the selected inner word | -| `d w` | Delete the selected word | -| `d d` | Delete the selected line(s) | -| `x` | Delete the selection | -| `y y` | Yank the selection | - -**Note**: Switching out of visual mode back to normal mode is typically done by pressing ``. - -## Quick reference cheatsheet +```bash +# 1. Make sure you have JDK 25+ installed. +# 2. Build the project: +$ mvn clean package -``` -Movement | Action ---------------|-------- -... +# 3. Run SWIM with a file: +$ java -XX:+UseZGC -cp "target/swim-0.0.1-SNAPSHOT.jar:target/libs/*" org.fisk.swim.Swim + +# 4. For convenience, create an alias: +$ alias swim='java -XX:+UseZGC -cp "/target/swim-0.0.1-SNAPSHOT.jar:/target/libs/*" org.fisk.swim.Swim' +# Then simply: +$ swim ``` ---- +## Modal Editing – The Essentials -In order to edit a file with swim, use the following command: +SWIM uses the same keybindings that make Vim legendary. Below are the core motions and commands you’ll use every day. -``` -java -XX:+UseZGC -cp "target/swim-0.0.1-SNAPSHOT.jar:target/libs/*" org.fisk.swim.Swim -``` +### Normal Mode -For the best experience, create an alias, like this: +| Key | Action | +|-----|--------| +| `h/j/k/l` | Move cursor left/down/up/right | +| `0/$` | Move to start/end of line | +| `gg/G` | Go to first/last line | +| `f/F` | Find next/previous character | +| `w/b/e` | Move by words | +| `d{motion}` | Delete | +| `y{motion}` | Yank | +| `p/P` | Paste | +| `u` | Undo | +| `Ctrl‑r` | Redo | +| `i` | Enter **Insert** mode | +| `v/V` | Enter **Visual** / **Visual Line** mode | +| `Ctrl‑v` | Visual Block mode | +| `:` | Command‑line prompt | +| `/` or `?` | Search | -``` -alias swim="java -XX:+UseZGC -cp "/target/swim-0.0.1-SNAPSHOT.jar:target/libs/*" org.fisk.swim.Swim " -``` +### Insert Mode + +All the usual text entry – just type! Escape (`Esc`) returns you to Normal mode. + +### Visual Mode + +Same motion keys as Normal, plus: + +| Key | Action | +|-----|--------| +| `d` | Delete selection | +| `y` | Yank selection | +| `c` | Change selection (delete + Insert) | + +## Java‑LSP Power‑Ups + +SWIM’s `:JavaLSP` namespace exposes powerful refactorings. In Normal mode, prefix commands with `e`: + +| Shortcut | Description | +|----------|-------------| +| `e i` | Organize imports | +| `e f` | Make field `final` | +| `e a` | Generate accessors | +| `e s` | Generate `toString()` | +| `e l` | Show code lens | + +Feel free to create your own custom commands by wiring up a Java handler. + +## Extending SWIM + +The entire codebase is open source. To add a new language‑server or mode, simply: + +1. Implement a new `LanguageMode`. +2. Register it via `LanguageModeProvider`. +3. Build and test. + +Because the editor is written in Java, you can drop in existing libraries or even build a UI plug‑in. -where `` is the path where swim was cloned. With this alias, you can open files like a pro: -``` -swim -``` \ No newline at end of file From dae5965aa7a88caf2c323a9c714129ed071eeb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Wed, 31 Dec 2025 14:06:22 +0100 Subject: [PATCH 10/11] Vibe coding readme --- README.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a4a6b810..4ed849e9 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,15 @@ -# SWIM – The Java‑powered Vim‑style Editor - -> **SWIM** stands for *Strange Variety Vi Improved* – the ultimate modal text editor built on the Java platform. It delivers the power and speed of Vim, the flexibility of Java, and the extensibility of a full language‑server ecosystem—all in a single, lightweight JAR. - -| Feature | What it gives you | -|---------|-------------------| -| **Vim‑style modal editing** | Classic keystrokes, visual and block selections, powerful motions. -| **Pure Java implementation** | Runs on any JVM, no native dependencies, simple `mvn` build. -| **Native Java LSP integration** | Auto‑completion, go‑to‑definition, refactoring for Java (and LaTeX, etc.) right out of the box. -| **Extensible** | Add custom modes or plugins in Java – treat the editor as a platform, not a product. -| **Zero‑configuration** | One command to launch, alias support for quick launching. -| **Lightweight** | Less than 50 MB, no external libraries besides the standard JDK. - +# 🚀 SWIM – The Java‑powered Vim‑style Editor + +🚀 **SWIM** stands for *Strange Variety Vi Improved* – the ultimate modal text editor built on the Java platform. 🌐 It delivers the power and speed of Vim, the flexibility of Java, and the extensibility of a full language‑server ecosystem—all in a single, lightweight JAR. 💡 + +🛠️ Feature | 💡 What it gives you | +|----------------|--------------------------| +| 📌 **Vim‑style modal editing** | Classic keystrokes, visual and block selections, powerful motions. | +| ⚙️ **Pure Java implementation** | Runs on any JVM, no native dependencies, simple `mvn` build. | +| 🌐 **Native Java LSP integration** | Auto‑completion, go‑to‑definition, refactoring for Java (and LaTeX, etc.) right out of the box. | +| 🚀 **Extensible** | Add custom modes or plugins in Java – treat the editor as a platform, not a product. | +| 🔧 **Zero‑configuration** | One command to launch, alias support for quick launching. | +| 🧪 **Lightweight** | Less than 50 MB, no external libraries besides the standard JDK. | ## Quick Start ```bash From 8ffb7747cadb1efc31245cd898680a175d692996 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:46:52 +0000 Subject: [PATCH 11/11] Bump org.apache.logging.log4j:log4j-core from 2.25.3 to 2.25.4 Bumps org.apache.logging.log4j:log4j-core from 2.25.3 to 2.25.4. --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-core dependency-version: 2.25.4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 91c62bb6..800987fe 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ org.apache.logging.log4j log4j-core - 2.25.3 + 2.25.4 org.eclipse.lsp4j