Closed 3hg4hj closed 1 month ago
Yes, it is the intended behavior. When we jump to an arbitrary line, generally it is not very helpful to move cursor to the same column as in the original line, since in the general case the new line has nothing to do with the original line. The beginning of the line is the only location that makes sense in all cases.
all it would take then to reset is pressing home, while navigating configuration files (that stretch many structurally repetitive lines) using jump as a substitute to holding down arrow keys is made slightly bothersome. at the very least it could accept %line%:c as an alias for current column (allowing a 1st layer comma instead of a 2nd layer colon too)
You can implement a custom command for that in lua. Add something like this to your ~/.config/micro/init.lua
:
local micro = import("micro")
local config = import("micro/config")
function jump2(bp, args)
if #args < 1 then
micro.InfoBar():Error("Not enough arguments")
return
end
local n = tonumber(args[1])
if n == nil then
micro.InfoBar():Error("Invalid argument")
return
end
bp.Cursor:Deselect(true)
if n > 0 then
bp:MoveCursorDown(n)
elseif n < 0 then
bp:MoveCursorUp(-n)
end
bp:Relocate()
end
function init()
config.MakeCommand("jump2", jump2, config.NoComplete)
end
Description of the problem or steps to reproduce
executing jump and goto brings the cursor to the beginning of the line, regardless of what column it was standing on
Specifications
Commit hash: 3b3fe63 OS: Void Linux x86_64 Terminal: urxvt