Skip to content

Commit

Permalink
added basic getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimaoth committed Jan 5, 2024
1 parent 8822a9e commit ba520d9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 367 deletions.
7 changes: 0 additions & 7 deletions config/absytree_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ proc handleAction*(action: string, args: JsonNode): bool {.wasmexport.} =
setOption("ast.max-loop-iterations", args[0].getInt)
return true

of "command-line":
let str = if args.len > 0: args[0].getStr else: ""
commandLine(str)
if getActiveEditor().isTextEditor(editor):
editor.setMode "insert"
return true

of "set-search-query":
if getActiveEditor().isTextEditor(editor):
editor.setSearchQuery args[0].getStr
Expand Down
Binary file modified config/absytree_config_wasm.wasm
Binary file not shown.
31 changes: 31 additions & 0 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Getting Started

For a list of all keybindings look at `default_config.nim` and `keybindings_normal.nim`/`keybindings_vim.nim`
To open this document at any time run the command `help`

# Useful keybindings (C: Control, A: Alt, S: Shift)
- For `<LEADER>` you can either press `<SPACE>` or `<C-b>`
- `<ESCAPE>`: cancel or close e.g. popups
- `<C-x><C-x>`: quit
- `<LEADER><LEADER>`: enter the command line to run commands by name. (Aftwards press `<C-SPACE>` to see the list of builtin commands)
- `<LEADER>gf`: open the file chooser
- `<LEADER>ge`: open the file chooser (only shows files open in background)
- `<CA-x>`: close the current view
- `<CA-n>` and `<CA-t>`: switch between views
- `<C-s>`: save file

## Text Editor
- `<C-SPACE>`: show completion window
- with vim keybindings:
- `gd`: go to definition
- `gs`: go to symbol in current file

## Popups
- `<ENTER>` or `<TAB>`: select the currently selected item
- `<ESCAPE>`: close the popup
- `<UP>` or `<DOWN>`: select the next/previous item

# Useful commands
- `load-normal-keybindings`: load "normal" keybindings (like vs code)
- `load-vim-keybindings`: load vim like keybindings (WIP)
- `logs`: show the log file
9 changes: 0 additions & 9 deletions docs/introduction.md

This file was deleted.

7 changes: 4 additions & 3 deletions src/app.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,8 @@ proc quit*(self: App) {.expose("editor").} =
self.closeRequested = true

proc help*(self: App, about: string = "") {.expose("editor").} =
const introductionMd = staticRead"../docs/introduction.md"
let docsPath = "docs/introduction.md"
const introductionMd = staticRead"../docs/getting_started.md"
let docsPath = "docs/getting_started.md"
let textDocument = newTextDocument(self.asConfigProvider, docsPath, introductionMd, app=true, load=true)
textDocument.load()
discard self.createAndAddView(textDocument)
Expand Down Expand Up @@ -1131,6 +1131,7 @@ proc setLayout*(self: App, layout: string) {.expose("editor").} =
proc commandLine*(self: App, initialValue: string = "") {.expose("editor").} =
self.getCommandLineTextEditor.document.content = @[initialValue]
self.commandLineMode = true
self.commandLineTextEditor.TextDocumentEditor.setMode("insert")
self.platform.requestRender()

proc exitCommandLine*(self: App) {.expose("editor").} =
Expand Down Expand Up @@ -1938,7 +1939,7 @@ proc handleAction(self: App, action: string, arg: string): bool =
log(lvlError, getCurrentException().getStackTrace())

try:
withScriptContext self, self.scriptContext:
withScriptContext self, self.wasmScriptContext:
if self.wasmScriptContext.handleGlobalAction(action, args):
return true
except CatchableError:
Expand Down
Loading

0 comments on commit ba520d9

Please sign in to comment.