-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: "goto -1" to move cursor to end of document #1682
Comments
I notice "goto -1" was effectively also mentioned here: #1082 (comment) |
This patch works for me: diff --git a/internal/action/command.go b/internal/action/command.go
index cae2b3f..b85117b 100644
--- a/internal/action/command.go
+++ b/internal/action/command.go
@@ -701,6 +701,9 @@ func (h *BufPane) GotoCmd(args []string) {
InfoBar.Error(err)
return
}
+ if line < 0 {
+ line = h.Buf.LinesNum() + 1 + line
+ }
line = util.Clamp(line-1, 0, h.Buf.LinesNum()-1)
col = util.Clamp(col-1, 0, util.CharacterCount(h.Buf.LineBytes(line)))
h.Cursor.GotoLoc(buffer.Loc{col, line})
@@ -710,6 +713,9 @@ func (h *BufPane) GotoCmd(args []string) {
InfoBar.Error(err)
return
}
+ if line < 0 {
+ line = h.Buf.LinesNum() + 1 + line
+ }
line = util.Clamp(line-1, 0, h.Buf.LinesNum()-1)
h.Cursor.GotoLoc(buffer.Loc{0, line})
} |
Seems like a cool functionality. You should open a PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like if micro allowed the command "goto -1" to move the cursor to the end of the document.
"goto -2" would move the cursor to the second-to-last line of the document, etc.
This is consistent with nano and mcedit.
Thanks.
The text was updated successfully, but these errors were encountered: