
Lightweight, fast code editor offering syntax highlighting for 19+ languages, smart autocomplete, real-time error detection, auto-formatting, multi-tab file management, 19 themes, and keyboard shortcuts.
A Compose Multiplatform code-editor component for Kotlin. Embed a fast, configurable editor in your Android, iOS, desktop, JavaScript, or WebAssembly app.
Use Nemo Code Editor wherever your Compose app needs to display or edit source code:
Add Nemo Code Editor to commonMain in your Kotlin Multiplatform project:
commonMain.dependencies {
implementation("io.github.ma7moud3ly:nemo-editor:x.x.x")
}Replace x.x.x with the latest version on Maven Central. You can also find the published package on Klibs.
The editor is the only required module. Two more are optional, and all modules share the same version:
| Module | What it adds |
|---|---|
nemo-editor |
The NemoCodeEditor component, with its state, settings and themes |
nemo-search |
A find and replace bar and dialog |
nemo-tabs |
A tabs manager and a tab strip |
commonMain.dependencies {
implementation("io.github.ma7moud3ly:nemo-editor:x.x.x")
}import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import io.ma7moud3ly.nemo.NemoCodeEditor
import io.ma7moud3ly.nemo.model.Language
import io.ma7moud3ly.nemo.model.rememberCodeState
@Composable
fun KotlinEditor() {
val state = rememberCodeState(
code = """
fun main() {
println("Hello from Nemo")
}
""".trimIndent(),
language = Language.KOTLIN,
)
NemoCodeEditor(
state = state,
modifier = Modifier.fillMaxSize(),
)
}val settings = remember {
EditorSettings(
theme = EditorThemes.NEMO_DARK,
tabSize = 4,
showLineNumbers = true,
showIndentGuides = true,
enableAutocomplete = true,
)
}
NemoCodeEditor(
state = state,
settings = settings,
modifier = Modifier.fillMaxSize(),
)EditorSettings is reactive, so its theme, font, indentation, and read-only state can be changed while the editor is on screen.
nemo-search works on the same CodeState as the editor. Show the bar above the editor, or use FindReplaceDialog for a floating window.
implementation("io.github.ma7moud3ly:nemo-search:x.x.x")import io.ma7moud3ly.nemo.search.FindReplaceBar
var showSearch by remember { mutableStateOf(false) }
Column {
if (showSearch) {
FindReplaceBar(
state = state,
showReplace = true,
onDismiss = { showSearch = false },
)
}
NemoCodeEditor(
state = state,
modifier = Modifier.weight(1f),
)
}nemo-tabs keeps a list of open documents, each with its own CodeState. Implement TabFile on your file class, open files through a TabsManager, and show them with NemoTabs.
implementation("io.github.ma7moud3ly:nemo-tabs:x.x.x")import io.ma7moud3ly.nemo.tabs.NemoTabs
import io.ma7moud3ly.nemo.tabs.TabFile
import io.ma7moud3ly.nemo.tabs.TabsManager
data class MyFile(
override val name: String,
override val path: String,
) : TabFile
val tabsManager = remember { TabsManager() }
val activeTab by tabsManager.activeTabFlow.collectAsState(null)
// Open a file in a tab, for example from a file picker callback
tabsManager.openTab(
document = MyFile(name = "Main.kt", path = "/project/Main.kt"),
content = "fun main() {}",
language = Language.KOTLIN,
)
Column {
NemoTabs(
tabs = tabsManager.tabs,
activeTabId = activeTab?.id,
onSelect = { tabsManager.switchTab(it.id) },
onClose = { tabsManager.closeTab(it.id) },
)
activeTab?.let { tab ->
NemoCodeEditor(
state = tab.codeState,
modifier = Modifier.weight(1f),
)
}
}See the NemoCodeEditor API documentation for the full API and additional examples.
This repository also contains Nemo Editor, a complete cross-platform code-editor application built with this library. It is a practical reference for integrating the editor, nemo-search and nemo-tabs with file browsing and platform file operations.
git clone https://github.com/Ma7moud3ly/nemo-editor.git
cd nemo-editor
# Desktop app
./gradlew :desktopApp:run
# Android app
./gradlew :androidApp:installGmsDebug
# Web app
./gradlew :webApp:wasmJsBrowserDevelopmentRunTo publish the library modules to your local Maven repository:
./gradlew publishToMavenLocalContributions are welcome. Please follow Kotlin coding conventions, include tests where appropriate, and update documentation for user-facing changes. Open an issue or pull request to get started.
Nemo Code Editor is available under the MIT License.
A Compose Multiplatform code-editor component for Kotlin. Embed a fast, configurable editor in your Android, iOS, desktop, JavaScript, or WebAssembly app.
Use Nemo Code Editor wherever your Compose app needs to display or edit source code:
Add Nemo Code Editor to commonMain in your Kotlin Multiplatform project:
commonMain.dependencies {
implementation("io.github.ma7moud3ly:nemo-editor:x.x.x")
}Replace x.x.x with the latest version on Maven Central. You can also find the published package on Klibs.
The editor is the only required module. Two more are optional, and all modules share the same version:
| Module | What it adds |
|---|---|
nemo-editor |
The NemoCodeEditor component, with its state, settings and themes |
nemo-search |
A find and replace bar and dialog |
nemo-tabs |
A tabs manager and a tab strip |
commonMain.dependencies {
implementation("io.github.ma7moud3ly:nemo-editor:x.x.x")
}import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import io.ma7moud3ly.nemo.NemoCodeEditor
import io.ma7moud3ly.nemo.model.Language
import io.ma7moud3ly.nemo.model.rememberCodeState
@Composable
fun KotlinEditor() {
val state = rememberCodeState(
code = """
fun main() {
println("Hello from Nemo")
}
""".trimIndent(),
language = Language.KOTLIN,
)
NemoCodeEditor(
state = state,
modifier = Modifier.fillMaxSize(),
)
}val settings = remember {
EditorSettings(
theme = EditorThemes.NEMO_DARK,
tabSize = 4,
showLineNumbers = true,
showIndentGuides = true,
enableAutocomplete = true,
)
}
NemoCodeEditor(
state = state,
settings = settings,
modifier = Modifier.fillMaxSize(),
)EditorSettings is reactive, so its theme, font, indentation, and read-only state can be changed while the editor is on screen.
nemo-search works on the same CodeState as the editor. Show the bar above the editor, or use FindReplaceDialog for a floating window.
implementation("io.github.ma7moud3ly:nemo-search:x.x.x")import io.ma7moud3ly.nemo.search.FindReplaceBar
var showSearch by remember { mutableStateOf(false) }
Column {
if (showSearch) {
FindReplaceBar(
state = state,
showReplace = true,
onDismiss = { showSearch = false },
)
}
NemoCodeEditor(
state = state,
modifier = Modifier.weight(1f),
)
}nemo-tabs keeps a list of open documents, each with its own CodeState. Implement TabFile on your file class, open files through a TabsManager, and show them with NemoTabs.
implementation("io.github.ma7moud3ly:nemo-tabs:x.x.x")import io.ma7moud3ly.nemo.tabs.NemoTabs
import io.ma7moud3ly.nemo.tabs.TabFile
import io.ma7moud3ly.nemo.tabs.TabsManager
data class MyFile(
override val name: String,
override val path: String,
) : TabFile
val tabsManager = remember { TabsManager() }
val activeTab by tabsManager.activeTabFlow.collectAsState(null)
// Open a file in a tab, for example from a file picker callback
tabsManager.openTab(
document = MyFile(name = "Main.kt", path = "/project/Main.kt"),
content = "fun main() {}",
language = Language.KOTLIN,
)
Column {
NemoTabs(
tabs = tabsManager.tabs,
activeTabId = activeTab?.id,
onSelect = { tabsManager.switchTab(it.id) },
onClose = { tabsManager.closeTab(it.id) },
)
activeTab?.let { tab ->
NemoCodeEditor(
state = tab.codeState,
modifier = Modifier.weight(1f),
)
}
}See the NemoCodeEditor API documentation for the full API and additional examples.
This repository also contains Nemo Editor, a complete cross-platform code-editor application built with this library. It is a practical reference for integrating the editor, nemo-search and nemo-tabs with file browsing and platform file operations.
git clone https://github.com/Ma7moud3ly/nemo-editor.git
cd nemo-editor
# Desktop app
./gradlew :desktopApp:run
# Android app
./gradlew :androidApp:installGmsDebug
# Web app
./gradlew :webApp:wasmJsBrowserDevelopmentRunTo publish the library modules to your local Maven repository:
./gradlew publishToMavenLocalContributions are welcome. Please follow Kotlin coding conventions, include tests where appropriate, and update documentation for user-facing changes. Open an issue or pull request to get started.
Nemo Code Editor is available under the MIT License.