2022 Developer Survey is open! Take survey.

Questions tagged [line-editor]

The line editor in shells and other command line programs

Filter by
Sorted by
Tagged with
2 votes
1 answer
143 views

history-search-end doesn't work

My ~/.zshrc: setopt histignoredups autoload -U history-search-end zle -N history-beginning-search-backward-end history-search-end zle -N history-beginning-search-forward-end history-search-end bindkey ...
user avatar
3 votes
1 answer
30 views

How to execute ctrl+r query as-is instead of a match?

Sometimes when I reverse-search cmd in a shell I don't find a correct match and just want to execute search query as it is. Is there a way in bash/zsh and friends to execute it without discarding ...
user avatar
1 vote
2 answers
99 views

How do I figure out what just broke my zsh shell beginning-of-line and end-of-line bindings?

I am on macOS/darwin using a "default settings" zsh environment (no "oh-my-zsh" or any of that). Some developer tool I just installed apparently broke some keybinds that I use ...
user avatar
  • 125
2 votes
4 answers
174 views

Use substitution to delete everything up to a point on a line

I want to use a global substitution in Vim to delete everything up to https. Before The website is https://website.com The website is https://website.com The website is https://website.com After ...
user avatar
  • 323
1 vote
1 answer
55 views

Run line editing for user input (script command)

I used the script program to record an interactive session: $ script $ echo<-<-<-<-printf "hello\n" $ exit The sequence <- is representing the backspace character. I want the ...
user avatar
0 votes
1 answer
367 views

What is the difference between `set -o` vs `bindkey`?

From what I have seen, both set -o emacs and bindkey -e are used to modify the behavior of your terminal line editor to emulate emacs whereas set -o vi and bindkey -v are used to emulate vi ...
user avatar
1 vote
1 answer
244 views

Physical buffer in terminal is getting misaligned with display in oh-my-zsh configuration

I have been experiencing an unusual problem in the oh-my-zsh configuration in which the cursor gets out of sync with the text. (I normally work using screen in konsole. For instance on a new terminal ...
user avatar
  • 6,667
0 votes
1 answer
273 views

zsh with vi-mode: How to keep a command line for future use without executing

It happens quite often to me, that while entering a complex command I realize that I need to enter some other commands first. Being a vi user, I'd love to 0 D, enter a different command and later ...
user avatar
  • 11.2k
5 votes
2 answers
351 views

edit-and-execute-command interrupted by SIGTSTP

I've been using bash's edit-and-execute-command function: edit-and-execute-command (C-x C-e) Invoke an editor on the current command line, and execute the result as shell commands. Bash ...
user avatar
1 vote
2 answers
758 views

How to insert Line break regex

I have a file which contains one line like this test1.CSV test2.CSV test3.CSV test4.CSV... I want to put a line break after each .CSV file name like so test1.CSV test2.CSV test3.CSV test4.CSV ...
user avatar
4 votes
2 answers
2k views

Alt + . (dot) shows &, instead of a previous argument

I (ab)use Alt + . to recover the last argument in a previous command (I'm using ZSH): for example, $ convert img.png img.pdf $ llpp (alt + .) # which produces llpp img.pdf but sometimes I review a ...
user avatar
  • 167
4 votes
4 answers
562 views

Zsh refer to last element of current argument list and expand it

Suppose I do something like: ln a_file_with_a_long_filename.pdf ~/path/to/a/new/hardlink/a_file_with_a_long_filename_slightly_modified.pdf Is there a way to refer to and expand ...
user avatar
  • 16.7k
1 vote
2 answers
427 views

CLI: Editing binary strings

There's a nice CLI binutils utility for interpreting binary files, and outputting legible strings, in a cat-like fashion. It's called strings. If you try to cat a binary file, you'll see a bunch of ...
user avatar
  • 1,092
1 vote
1 answer
82 views

Changing to ancestor directory without typing all the dots and slashes

In zsh, how do I refer to the grandparent directory with ... rather than ../.., and so forth? I used to have this in oh-my-zsh and prezto. PS. Ideally, M-3 . should yield ../../...
user avatar
  • 2,933
4 votes
2 answers
1k views

zsh line editor: Can I navigate and edit by argument?

I have a common situation in the shell when a command is attempted command "/some/complex/and terrible/path" -vf --various --flags --and -- things --config-file="/some other/annoyingly/...
user avatar
  • 1,929
0 votes
1 answer
74 views

zsh command line editing problems when reverse-searching the history fixed by ctrl-l [closed]

In zsh, using oh-my-zsh and the robby-russell theme, under Fedora Core 23, I noticed that when I reverse-searched for commands in the command history and tried to edit the results, the display would ...
user avatar
  • 111
2 votes
1 answer
160 views

Is it possible to do live text-replace in shell?

I run zsh on my machine. I was wondering if I can do text-replace in shell. For example fn[SPACE/TAB]should be replaced with function. On OSX there is the option of keyboard-shortcuts but they don't ...
user avatar
3 votes
1 answer
881 views

Non-anchored history substring search in bash

There are 2 existing ways to get something like this easily: zsh's history-substring-search plugin bash's ctrl+r mode The problem with zsh is that it's not on many systems. The problem with bash's ...
user avatar
  • 1,929
1 vote
1 answer
72 views

Bash and/or Zsh: Is it possible to customize the Vi insert mode to create a bind that moves a specific number of characters?

I have a Vim configuration that is somewhat unconventional. I bind Shift+H and Shift+L to move left by 7 characters and move right by 7 characters, respectively. This makes it easier for my brain to ...
user avatar
  • 1,929
1 vote
1 answer
137 views

Line editing (readline?) with virtual keys

I want to bind terminal behavior to hotkeys without having to define escape sequences. I understand readline binds to characters instead of actual key presses. Can it also bind to the lower level ...
user avatar
  • 420
3 votes
2 answers
405 views

How to specify command arguments for bind -x based on history?

Let's say I have a command called synopsis that takes the name of a command as an argument and prints out its syntax. Now I want to bind the synopsis to a key sequence. How can I pass the name of the ...
user avatar
  • 33
3 votes
1 answer
576 views

Bash 4.4 bracketed-paste-mode stays on while running commands - corrupts paste

I've been using bracketed paste in VIM which is excellent for ensuring pasted content gets into the editor un-modified without triggering actions (such as auto formatting, and auto closing parenthesis)...
user avatar
  • 171
24 votes
5 answers
3k views

Bash command to copy before cursor and paste after?

I am not sure how to word this, but I often I find myself typing commands like this: cp /etc/prog/dir1/myconfig.yml /etc/prog/dir1/myconfig.yml.bak I usually just type out the path twice (with tab ...
user avatar
1 vote
1 answer
238 views

Extend vi mode to irb, postgres etc in zsh

I am using oh-my-zsh's vi-mode plugin. Its working awesomely for regular terminal usage. How to extend this vi-mode to psql, irb etc? In bash I used to do this by adding commands in .inputrc I am ...
user avatar
20 votes
6 answers
1k views

How do I input n repetitions of a digit in bash, interactively

I'd like to run the command foo --bar=baz <16 zeroes> How do I type the 16 zeroes efficiently*? If I hold Alt and press 1 6 0 it will repeat the next thing 160 times, which is not what I want....
user avatar
16 votes
2 answers
7k views

Can I navigate zsh's tab-completion menu with vi-like hjkl keys?

I use zsh's menu-based tab completion. I press Tab once, and a list of possible completions appears. If I press Tab again, I can navigate this list with the arrow keys. However, is it possible to ...
user avatar
  • 18.1k
2 votes
1 answer
333 views

MIT Scheme prompt: indent and up/down arrows

I run Scheme either as: rlwrap scheme, option which let's me use up/down left/right arrows, but that disables tab. Or as scheme option that let's me indent commands with tab, but disables the arrows. ...
user avatar
  • 1,913
1 vote
1 answer
827 views

How to get second to last parameter of previous command in bash?

I can use Esc+. to get the last parameter of the previous command, but is there an equally convenient short-cut to get the second to last parameter?
user avatar
1 vote
1 answer
184 views

Up arrow at an empty prompt in ksh93

This is a request for explanation or pointer to documentation. I'm a KornShell93 (ksh on Mac OS X or ksh93 elsewhere) user. I like the shell for its relative simplicity as an interactive shell and for ...
user avatar
  • 268k
20 votes
1 answer
10k views

SQLite3 command line: how do you cancel a command?

I made a mistake writing a command at the SQLite command prompt, which I now want to abort, this is how my command line looks sqlite> select * from todos' ...> ' ...> ;^C In this case,...
user avatar
0 votes
2 answers
4k views

Insert/overwrite mode in fish

I'm using Linux Mint on a MacBook and on its keyboard the equivalent for the INSERT key is the combination Fn + RETURN. At the moment I can only see the intended behavior of this combination in GNU-...
user avatar
3 votes
1 answer
535 views

zsh tcsh-like history navigation

In tcsh, the \eP and \eN commands take into account the whitespace-normalized prefix of the current line, not just the first word. For instance if my history contains git pull upstream feature-...
user avatar
  • 2,846
2 votes
1 answer
483 views

Find out if ctrl+backspace equals ctrl-H or ctrl-?

This question was about how to delete the last word in bash with ctrl-backspace. As already mentioned there, different Linux distros (or different Unices in general) behave differently: Some produce ^...
user avatar
  • 2,274
3 votes
3 answers
4k views

Why can't Korn Shell do ctrl-r?

If I use PC-BSD with the default shell (Korn) then Ctrl+r doesn't work. Why won't it work? Ctrl-r was introduced to search your history in the late 1970s or early 80s and my BSD still can't do it (...
user avatar
26 votes
2 answers
1k views

Opening Your Command Prompt In A Text Editor - What Is This Called?

One of my favorite tricks in Bash is when I open my command prompt in a text editor. I do this (in vi mode) by pressing ESC v. When I do this, whatever is in my command prompt is now displayed in my $...
user avatar
  • 455
7 votes
4 answers
2k views

Is it possible to name a part of a command to reuse it in the same command later on?

If I want to move a file called longfile from /longpath/ to /longpath/morepath/ can I do something like mv (/longpath)/(longfile) $1/morepath/$2 i.e. can I let the bash know that it should remember ...
user avatar
  • 405
3 votes
2 answers
853 views

rlwrap: tclsh multi-word autocompletion

How do I get multi-word autocompletion with rlwrap for tclsh? Example: I type file <space> then pressing <tab> <tab> I only want to see the sub-commands to file, such as exists ...
user avatar
22 votes
4 answers
22k views

Ctrl-Backspace and Ctrl-Delete in bash

Putting on Debian 8.3 stty werase '^H' or on Arch Linux 2/2016 stty werase '^?' in .bashrc (for example) makes Ctrl-Backspace delete the last word in the terminal. Still it's not the same behavior ...
user avatar
  • 2,274
32 votes
1 answer
3k views

ESC + { : What is it and where I can know more about it?

I was play around at the bash prompt, and pressed ESC followed by { , after which , the shell showed all the files for completion, in a fileglob string. Eg : If I had typed bash C followed by ESC+{ , ...
user avatar
  • 2,962
6 votes
2 answers
1k views

Echo text as suggested prompt in bash

Is it possible to change text that appears after $PS1. It is what user inputs. I want to suggest some command hereafter my_function is run. Of Course I should be able to modify/delete it using ...
user avatar
  • 567
5 votes
2 answers
2k views

How can I undo an accidental newline in bash?

If I unintentionally add a newline in a command, as far as I can tell, the only way to undo it is to press Ctrl+c and type the command again. For example: $ cat 'John's File' > ^C $ cat "John's ...
user avatar
  • 3,321
1 vote
0 answers
411 views

paste clipboard text plus string with .inputrc

I've got in my .inputrc something like "\C-v": "script.sh " I use a link from my clipboard as a parameter for the script, so I type ctrl-v and then paste the link, and then hit enter. So I've seen ...
user avatar
1 vote
1 answer
69 views

Some characters are filtered in bash

I'm currently running a Xubuntu image using VirtualBox and a strange issue just started occurring: I cannot enter a or c in a terminal or terminal emulator. A and C (that is, a/c + left/right Shift or ...
user avatar
  • 113
1 vote
1 answer
280 views

stty doesn't display backward-delete-word shortcut

stty -a shows, speed 38400 baud; rows 39; columns 143; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt ...
user avatar
6 votes
1 answer
3k views

How to cancel and keep reverse-i-search?

Often I fail to find something with reverse-i-search but want to keep what I have already written. For example, typing pdflatex fails to complete to pdflatex mydocument.tex. If I then cancel it with ...
user avatar
3 votes
1 answer
182 views

Pass 'typed text' from bash interactive shell to a command

I would like to pass whatever the user has typed in a bash shell to a command, when the user presses a keyboard binding|shortcut For example : Lets say Ctrl+b is our binding bind '"\C-b": "myCommand....
user avatar
6 votes
1 answer
1k views

bash/gnu readline multiline command: move row up/down

How to move one editing row up (back) or down (forward) in a multi-line command in bash/readline? Somethnig like gj/gk in Vim.
user avatar
5 votes
3 answers
224 views

Output Output of command to command line directly, NOT variable [duplicate]

I am on the bash shell and I want the output of a command to appear directly in the command prompt that appears after the command has executed ! Example of what I envision it, to illustrate my idea: ...
user avatar
  • 151
1 vote
1 answer
589 views

Ctrl-Y, emacs styled yank text is not working when user is switched

I cut the bash command line text using Ctrl+K. The line was cut as expected. Next, I ran sudo su to become the root user. I tried to paste the command that I cut as the non-sudo user using Ctrl+Y. ...
user avatar
4 votes
5 answers
4k views

Adjust gap between 2 columns to make them look straight

file1.txt: hi wonderful amazing sorry superman superhumanwith loss file2.txt : 1 2 3 4 5 6 7 When i try to combine using paste -d" " file1.txt file2.txt > actualout.txt actualout.txt : hi 1 ...
user avatar
  • 1,001