picsgogl.blogg.se

Vim keybindings for leanote
Vim keybindings for leanote















If readline does not make a distinction then the Vi mode, which is on top of it, can't make the distinction either. So, what we can conclude is that readline does not distinguish between the lines in the multiline command we did input above.

#Vim keybindings for leanote ps2

echo "yay got commented out, the shell attempted to run yep and we see PS2 because we have an unfinished quote from yup". That seems strange, right? But it is exactly what we asked, readline commented the line and passed it to the parser. Let's first more the cursor to the end by pressing $: $ echo "yayĪnd now we hit #, things happen, and this is how the shell session looks: $ #echo "yay it is not an editing biding (which should actually be "search next" in Vi). Anyhow, we know that, if we hit # a readline command will execute, i.e. M-# in emacs mode and to # in vi command mode.īasically, if we hit # the line should be commented out and passed to the interpreter (not sure why it is passed to the interpreter, to appear in the history I guess). The string that is inserted when the readline insert-comment command is executed. Here is a command from the readline section of man bash: comment-begin (``#'') The command history (in memory) is stored as a linked list, not as text separated by newlines.).Īnd let's try to find a way to prove that the line becomes several commands only when the interpreter parses it. Therefore let's make a hypothesis that we are actually editing not several lines but a single line which contains newline characters (Yes, there is a huge difference there. If I keep pressing k and/or j I scroll through previous commands, not lines in command.PS2 ( > on my machine) was not printed as when I typed it directly.

vim keybindings for leanote

Next I press Esc, k and get the following ( cho "yay

vim keybindings for leanote

Let us say that I type the following in a bash prompt (I also press Return and the output is generated): $ echo "yay

vim keybindings for leanote

And since the distinction cannot be performed there can not be keybindings for each. It is easy to prove that the distinction between these two (in a multiline command) things inside readline/bash cannot be performed.















Vim keybindings for leanote