Skip to content

Commit

Permalink
Merge pull request #1457 from fox0430/develop
Browse files Browse the repository at this point in the history
v0.3.0
  • Loading branch information
fox0430 authored Dec 21, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents b2c2177 + 7ed4b1a commit b246c84
Showing 87 changed files with 2,165 additions and 698 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build

on:
push:
paths-ignore:
- 'LICENSE'
- '*.md'
- 'documents/'
- 'docs/'
branches:
- develop
- master
pull_request:
paths-ignore:
- 'LICENSE'
- '*.md'
- 'documents/'
- 'docs/'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
nim: [ '1.4.2', 'stable', 'devel' ]
name: Build on ${{ matrix.nim }}
steps:
- uses: actions/checkout@v2
- name: Setup nim
uses: jiro4989/setup-nim-action@v1
with:
nim-version: ${{ matrix.nim }}
- run: nimble build -y
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ jobs:
# - macOS-latest
# - windows-latest
env:
NIM_VERSION: 1.4.8
NIM_VERSION: stable
steps:
- uses: actions/checkout@v1
- run: |
@@ -88,8 +88,3 @@ jobs:

- name: Run integtation test
run: shpec ./shpec.sh

- name: Build on Nim devel
run: |
choosenim -y devel
nimble build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ A command line based editor inspired by vi/vim written in Nim.

This project's goal is a very customizable, high productivity, user friendly, high performance and funny animation editor.

![moe](https://user-images.githubusercontent.com/15966436/93508284-5fa0ca00-f959-11ea-8282-d64f540e0c54.png)
![moe](https://user-images.githubusercontent.com/15966436/146791140-e020a07f-7ca1-4bfd-a6a4-f20f4c7885db.png)

## Features

1 change: 1 addition & 0 deletions documents/howtouse.md
Original file line number Diff line number Diff line change
@@ -60,6 +60,7 @@
| <kbd>**Z**</kbd> <kbd>**Z**</kbd><br>Write current file and exit | <kbd>**Z**</kbd> <kbd>**Q**</kbd><br>Same as `:q!` | <kbd>**Ctrl**</kbd> <kbd>**w**</kbd> <kbd>**c**</kbd><br>Close current window | <kbd>**?**</kbd><br>`keyword` Search backwards |
| <kbd>**/**</kbd><br>`keyword` Search forwards | <kbd>**\\**</kbd> <kbd>**r**</kbd><br>Quick Run | <kbd>**s**</kbd> OR <kbd>**c**</kbd><kbd>**u**</kbd><br> Delete current charater and enter insert mode | <kbd>**y**</kbd><kbd>**{**</kbd><br> Yank to the previous blank line |
| <kbd>**y**</kbd><kbd>**}**</kbd><br> Yank to the next blank line | <kbd>**y**</kbd><kbd>**l**</kbd><br> Yank a character| <kbd>**X**</kbd> OR <kbd>**d**</kbd><kbd>**h**</kbd><br> Cut a character before cursor | <kbd>**g**</kbd><kbd>**a**</kbd><br> Show current character info |
| <kbd>**t**</kbd><kbd>**x**</kbd><br> Move to the left of the next ```x``` (any character) on the current line | <kbd>**T**</kbd><kbd>**x**</kbd><br> Move to the right of the back ```x ``` (any character) on the current line | <kbd>**y**</kbd><kbd>**t**</kbd><br><kbd>**Any key**</kbd><br> Yank characters to an any character | <kbd>**c**</kbd><kbd>**f**</kbd><br><kbd>**Any key**</kbd><br> Delete characters to an any character and enter insert mode |

</details>

4 changes: 2 additions & 2 deletions example/moerc.toml
Original file line number Diff line number Diff line change
@@ -67,9 +67,9 @@ enable = false

allBuffer = false

[StatusBar]
[StatusLine]

multipleStatusBar = true
multipleStatusLine = true

merge = false

12 changes: 7 additions & 5 deletions moe.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.2.8.0"
version = "0.3.0"
author = "fox0430"
description = "A command lined based text editor"
license = "GPLv3"
@@ -10,10 +10,12 @@ bin = @["moe"]
# Dependencies

requires "nim >= 1.4.2"
requires "https://github.com/walkre-niboshi/nim-ncurses >= 1.0.2"
requires "unicodedb >= 0.9.0"
requires "parsetoml >= 0.4.0"
requires "ncurses >= 1.0.2"
requires "unicodedb >= 0.10.0"
requires "parsetoml >= 0.6.0"

task release, "Build for release":
exec "nim c -o:moe -d:release src/moe"
exec "nimble build -d:release"

task debug, "Build for debug":
exec "nimble build -d:debug --debugger:native --verbose -y"
2 changes: 1 addition & 1 deletion shpec.sh
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ describe "moe is an editor"
describe "invocation options"

it "can display it's version"
assert equal `moe -v | grep -oPq "^moe v\d+\.\d+\.\d+\.\d+$";echo $?` 0
assert equal `moe -v | grep -oPq "^moe v\d+\.\d+\.\d+$";echo $?` 0
end

it "can display command line options"
26 changes: 17 additions & 9 deletions src/moe.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, times
import std/[os, times]
import moepkg/[ui, editorstatus, normalmode, insertmode, visualmode,
replacemode, filermode, exmode, buffermanager, logviewer,
cmdlineoption, bufferstatus, help, recentfilemode, quickrun,
@@ -17,6 +17,18 @@ proc loadPersistData(status: var EditorStatus) =
currentMainWindowNode.restoreCursorPostion(currentBufStatus,
status.lastPosition)

proc addBufferStatus(status: var EditorStatus,
parsedList: CmdParsedList) =

if parsedList.path.len > 0:
for path in parsedList.path:
if dirExists(path):
status.addNewBuffer(path, Mode.filer)
else:
status.addNewBuffer(path)
else:
status.addNewBuffer

proc initEditor(): EditorStatus =
let parsedList = parseCommandLineOption(commandLineParams())

@@ -33,14 +45,10 @@ proc initEditor(): EditorStatus =
exitUi()
quit())

if parsedList.len > 0:
for p in parsedList:
if dirExists(p.filename):
result.addNewBuffer(p.filename, Mode.filer)
else:
result.addNewBuffer(p.filename)
else:
result.addNewBuffer
if parsedList.isReadonly:
result.isReadonly = true

result.addBufferStatus(parsedList)

result.loadPersistData

2 changes: 1 addition & 1 deletion src/moepkg/backup.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, times, re
import std/[os, times, re]
import settings, unicodeext, fileutils, bufferstatus, gapbuffer, messages,
commandline

2 changes: 1 addition & 1 deletion src/moepkg/bookmark.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
import std/os

type Bookmark* = object
path*: string
2 changes: 1 addition & 1 deletion src/moepkg/buffermanager.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import terminal, os, heapqueue, times
import std/[terminal, os, heapqueue, times]
import gapbuffer, ui, editorstatus, unicodeext, highlight, window, movement,
color, bufferstatus

3 changes: 2 additions & 1 deletion src/moepkg/bufferstatus.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tables, times, options
import std/[tables, times, options]
import syntax/highlite
import gapbuffer, unicodeext

@@ -40,6 +40,7 @@ type BufferStatus* = object
mode* : Mode
prevMode* : Mode
lastSaveTime*: DateTime
isReadonly*: bool

proc initBufferStatus*(path: seq[Rune], mode: Mode): BufferStatus {.inline.} =
BufferStatus(isUpdate: true, path: path, mode: mode, lastSaveTime: now())
2 changes: 1 addition & 1 deletion src/moepkg/build.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, osproc, strformat, unicode
import std/[os, osproc, strformat, unicode]
import syntax/highlite

proc build*(filename, workspaceRoot,
2 changes: 1 addition & 1 deletion src/moepkg/clipboard.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import unicode, os
import std/[unicode, os]
import independentutils, platform, settings

proc runesToStrings(runes: seq[seq[Rune]]): string =
10 changes: 7 additions & 3 deletions src/moepkg/cmdlineoption.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import parseopt, pegs, os, strformat
import std/[parseopt, pegs, os, strformat]

type CmdParsedList* = seq[tuple[filename: string]]
type CmdParsedList* = object
path*: seq[string]
isReadonly*: bool

proc staticReadVersionFromNimble: string {.compileTime.} =
let peg = """@ "version" \s* "=" \s* \" {[0-9.]+} \" @ $""".peg
@@ -34,6 +36,7 @@ Usage:
moe [file] Edit file
Arguments:
-R Readonly mode
-h, --help Print this help
-v, --version Print version
"""
@@ -59,11 +62,12 @@ proc parseCommandLineOption*(line: seq[string]): CmdParsedList =
for kind, key, val in parsedLine.getopt():
case kind:
of cmdArgument:
result.add((filename: key))
result.path.add(key)
of cmdShortOption:
case key:
of "v": writeVersion()
of "h": writeHelp()
of "R": result.isReadonly = true
else: writeCmdLineError(kind, key)
of cmdLongOption:
case key:
2 changes: 1 addition & 1 deletion src/moepkg/color.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import std/[strutils, tables, macros, strformat]
import ncurses
import strutils, tables, macros, strformat

# maps annotations of the enum to a hexToColor table
macro mapAnnotationToTable(args: varargs[untyped]): untyped =
2 changes: 1 addition & 1 deletion src/moepkg/commandline.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import terminal
import std/terminal
import ui, unicodeext, color

type CommandLine* = object
10 changes: 6 additions & 4 deletions src/moepkg/commandview.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import terminal, strutils, sequtils, strformat, os, algorithm
import std/[terminal, strutils, sequtils, strformat, os, algorithm]
import ui, unicodeext, fileutils, color, commandline

type ExModeViewStatus = object
@@ -239,13 +239,12 @@ proc clearCommandBuffer(exStatus: var ExModeViewStatus) =
proc deleteCommandBuffer(exStatus: var ExModeViewStatus) =
if exStatus.buffer.len > 0:
if exStatus.buffer.len < terminalWidth(): dec(exStatus.cursorX)
exStatus.buffer.delete(exStatus.currentPosition - 1,
exStatus.currentPosition - 1)
exStatus.buffer.delete(exStatus.currentPosition - 1)
dec(exStatus.currentPosition)

proc deleteCommandBufferCurrentPosition(exStatus: var ExModeViewStatus) =
if exStatus.buffer.len > 0 and exStatus.currentPosition < exStatus.buffer.len:
exStatus.buffer.delete(exStatus.cursorX - 1, exStatus.cursorX - 1)
exStatus.buffer.delete(exStatus.cursorX - 1)
if exStatus.currentPosition > exStatus.buffer.len:
dec(exStatus.currentPosition)

@@ -657,6 +656,9 @@ proc getKeyOnceAndWriteCommandView*(
status.commandLine.window.moveLeft(exStatus)
elif isRightkey(key):
exStatus.moveRight
if status.settings.popUpWindowInExmode:
status.deletePopUpWindow
status.update
elif isUpKey(key):
if isSearch: setPrevSearchHistory()
else: setPrevCommandHistory()
2 changes: 1 addition & 1 deletion src/moepkg/configmode.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import terminal, times, strutils
import std/[terminal, times, strutils]
import gapbuffer, ui, editorstatus, unicodeext, window, movement, settings,
bufferstatus, color, highlight, search, editor

2 changes: 1 addition & 1 deletion src/moepkg/cursor.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import deques, strformat
import std/[deques, strformat]
import editorview, unicodeext

type CursorPosition* = object
2 changes: 1 addition & 1 deletion src/moepkg/debugmode.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import terminal, times, strformat, options
import std/[terminal, times, strformat, options]
import gapbuffer, ui, unicodeext, highlight, color, window, bufferstatus,
movement, settings

2 changes: 1 addition & 1 deletion src/moepkg/diffviewer.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import times, terminal
import std/[times, terminal]
import editorstatus, unicodeext, bufferstatus, highlight, color, gapbuffer, ui,
movement, window

Loading

0 comments on commit b246c84

Please sign in to comment.