Skip to content

# fish-shell/fish-shell

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Loading…

# Remove unnecessary pressing#1286

Open
opened this Issue · 16 comments

### 5 participants

When typing text, it gives options previously entered. It is very good.
But that would be necessary after pressing "enter", he carried out an entire row with the team! He performs only what you typed and it is wildly angry. You should click first on the keyboard cursor, then to enter. Why extra touch?

If you mean the line suggestion from history and that it doesn't execute on enter. That is a feature.

How else could you enter some other command that it didn't suggest? The autosuggestions are not always right.

Therefore you need some extra keypress. You might find ctrl+f a more convenient combination to achieve this instead of the right arrow key.

For example, if I want to execute just ls, however earlier I had executed ls ab*. If the line suggestion shows ls ab* and enter would accept that, how would I execute just ls?

In my work often need command-prompt as they are repeated. New teams must cause more clicks than the old. That is, let pressing the arrow <- on the keyboard erases clues and pressing enter to execution is a clue.

The algorithm is now:
1. Typed "ls"
2. He showed me a hint that I need a thousand times a day "ls ab *"
3. I am a thousand times a day clicked -> that would complement the team
4. I hit enter to execute the command that

The desired algorithm:
1. Typed ls
2. Be prompted "ls ab *" (it is in the stories because she needed me already!)
a. First embodiment
a.1. I clicked <-
a.2. Tip erased, there is only "ls"
a.3. I pressed enter
a.4. Execution
b. Second Embodiment
b.1. I pressed enter
b.2. Performance

Another option.

You can enter a key to execute the command.
1. Enter - perform typed
2. Shift + enter - execute hint

What's stopping you add shift + enter to perform autocompletion?
Or add hotkeys in the config?

algorithm:
1. ls
2. Proposed "ls ab *"
a.1. shift + enter
a.2. Execution "ls ab *"
b.1. enter
b.2. Execution "ls"

Wow my message screwed, sorry for that. Anyway,

Why shift+enter? how about ctrl + enter, alt + enter? What is the problem with C-e and C-f? C-e and f are already ubiquitous key for that kind moving. forward cursor.

shift key and enter key close and you can press with one hand very easy and fast.

Hot keys in the configuration file allow set up this.

We must do the best, but not as everywhere else.

Yes another.
cursor -> + Enter is pressed on two key (or C-f + Enter...many keys)
shift + enter - it's actually one keypress.

Ergonomics.

I forgot about I'm using capslock as ctrl. I agree C-f + Enter less ergonomics for regular keyboard layout.

As I know there is no easy way grabbing shift+enter from fish. fish accepts keys from terminal emulator and terminal doesn't make special key code for shift+enter. That's some standard thing.

At least, you can bind some another key to 'accept-autosuggestion' function.

bind \em accept-autosuggestion

\em is Alt+m. I could not find how to bind two sequences(accept + Enter).

I find.

function fish_user_key_bindings
bind .....
bind .....
end
funcsave fish_user_key_bindings

then

in /home/.../.config/fish/functions/fish_user_key_bindings.fish
edit keybindings

but

How to add "accept+execution" function...i do not know.

And use fish_config!!!

How to call fish internal functions (execute or accept-autosuggestion) in fish functions?
I try

function auto
accept-autosuggestion
execute
end

function fish_user_key_bindings
bind \em auto
end

this is not work

And want to shift+enter!!! :)

I use simply hack
install xdotool and:

bind \em 'xdotool key KP_Right;xdotool key KP_Enter'

This should work:

function fish_user_key_bindings
bind \em 'commandline -f accept-autosuggestion; commandline -f execute'
end


But there seems to be a bug, only having the accept-autosuggestion works for autosuggestion, but having both only runs execute.

Yes, for some reason only works execution. My hack works fine, but I want to shift + enter.

As stated earlier it depends on your terminal emulator, which one are you running?

Usually there is no difference between: enter, shift-enter, ctrl+j, ctrl+m. fish receives the exact same key-code. You can however with some terminals configure which key-codes get sent. I know for example in iTerm I made shift+enter map to line-feed instead of newline. Then you could map this in your bindings to this command.

However, I had to disable that, just realized how sloppy I am, usually I keep holding shift when pressing enter if the last character I entered was using shift.

added this to the fish-tank milestone

I had exactly the same problem and tried to solve it via the above binding
bind \em 'commandline -f accept-autosuggestion; commandline -f execute'
Didn't work. After some lengthy experimentation and much swearing I realised that the functions given in the -f switch seem to be interpreted backwards by fish. Both the following bindings do work as expected:
bind \em 'commandline -f execute; commandline -f accept-autosuggestion'
bind \em 'commandline -f execute accept-autosuggestion'
Strange... is that a bug or a feature?

Bug is in #1567

to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.