I often need to add few lines to the file at the end, that would be handy to have a cli switch to open a file and automatically scroll down to the end and put cursor at the last character in the file as well. Is this already possible? Can this be a feature otherwise?
Maybe
echo „some line“ >> someFile.txt
Already does the job?
well, yeah for some simple cases it will do, but Micro is an editor, and editin in an editor is a good thing, you can check if the added line aligns with the existing lines, you can add more than one lines, the syntax will be highlighted, tabs and indents will work in a right way, you can copy/paste, etc..
This is a bit hacky but at the moment you can do micro file.txt:10000 and as long as your file is less than 10000 lines it will put your cursor on the last line. It would probably be pretty easy to implement something like micro file.txt:end.
maybe file.txt:-1 could be added as an unobtrusive option
or how about micro file.txt --last-line
Now what if you want to get the line before that? Maybe use Peano Numbers https://wiki.haskell.org/Peano_numbers
file.txt —pre(pre(last-line)) to get to the line before the line before the last line :D
can we make it a command?
"C-e last"
which will put you on the last line.
"C-e last 6". which will put you on the line 6 lines before the last line.
I think this will work!
"C-e last"
which will put you on the last line.
"C-e last 6". which will put you on the line 6 lines before the last line.
I think this will work!
Ctrl+L works for jumping to a line, it could support -1 as well to jump to lines, counting from the bottom
I still think this needs to be a command though.
"C-e l i 4": the "l" is an abbreviation for the last line, the "i" means invert the ordering, and the "4" means the 4th line. But since "i" inverts the order, "4" becomes "-4" which is the 4th line before the last line.
Default keybindings are Ctrl+Down to end of file, I believe.
Most helpful comment
maybe file.txt:-1 could be added as an unobtrusive option