You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
The alt+e bind to edit_command_buffer - that is, opening the current command in $EDITOR - is very handy. However, often I only realize half way editing a command that using my $EDITOR would be more convenient. In such cases, it's pretty cumbersome and superfluous to navigate to where I had my cursor in the fish shell, before I started my $EDITOR session.
Fortunately, editors like emacs (and maybe also vim) can be told to open a file at a specific line and column:
Usage: emacsclient [OPTIONS] FILE...
Tell the Emacs server to visit the specified files.
Every FILE can be either just a FILENAME or *[+LINE[:COLUMN]]* FILENAME.
Therefore, it would be great if edit_command_buffer could be told about the current cursor column (and possibly line). Afaik, there is currently no good way to pass such information to edit_command_buffer. I'm also not sure if it's possible to get the cursor's current column, and then pass that as some kind of argument to edit_command_buffer.
The text was updated successfully, but these errors were encountered:
So, there's commandline --cursor, which prints the offset from the origin of the line, which would work fine for the singe-line case. You could probably hack that into a lines/column thing in script, though my version is not terribly elegant:
set-l offset (math (commandline--cursor ) + 1)
set-l col 1
set-l line 1
set-l currpos 1
set-l cmdline (commandline)
whiletest$currpos-le$offsetset-l curr (string sub --start$currpos--length 1 -- $cmdline)
iftest"$curr" = \nset line (math$line + 1)
set col 0
elseset col (math$col + 1)
endset currpos (math$currpos + 1)
Anyway, the output of the coord function can be passed along to emacsclient.
I don't think we're likely to change edit_command_buffer, because of the minimal support for the concept - happy to hear other ideas though.