The line editor in shells and other command line programs

learn more… | top users | synonyms

3
votes
1answer
10 views

Keep the space after completion for some characters in zsh

Zsh has a bit of completion-related automation that's nice most of the time: after pressing Tab, a space is inserted automatically (or some other appropriate character such as , inside braces). I ...
2
votes
2answers
38 views

clipboard in bash

We can cut and paste current line in bash with ctl+u and ctl+y But I have read here that bash doesn't have clipboard concept, so how those shortkeys working? (or in another way: what they doing?)
1
vote
2answers
57 views

How to delete a word next of last slash

I have the following path : $ vim /path/to/some/where If I press Ctrl + w, It removes entire text to first space. The result would be : $ vim How do I delete just the word next of last slash ...
1
vote
2answers
54 views

Map Return with no other input to an alias

I would like to use Return with no other input to run an aliased command in the shell. Is this possible in Bash or Zsh? In other words, when I enter an empty command line, I want to run one specific ...
1
vote
1answer
22 views

Key to comment out the current line and keep editing it in zsh

On Bash I was using ESC # after Ctrl+R to prefix a # to the found line and keep it in the terminal, something similar for zsh?
1
vote
3answers
52 views

How to transpose command line arguments with emacs keybindings?

Using Bash, with emacs keybindings set, the transpose-words keybinding (M-t) doesn't transpose arguments, but "words" (by its own definition of words). So if I have this: vimdiff ...
4
votes
0answers
66 views

How to stop bash editing the history when I reuse and modify an entry?

Some instances of bash change the command history when you re-use and edit a previous command, others apparently don't. I've been searching and searching but can't find anything that says how to ...
1
vote
3answers
175 views

How to handle backspace while reading?

How do I handle the backspaces entered, it shows ^? if tried & how read counts the characters, as in 12^?3 already 5 characters were complete(though all of them were not actual input), but after ...
2
votes
1answer
65 views

Why does tmux fail to “scroll” when entering a command that exceeds one line? (OSX Terminal.app)

When I use tmux and enter a command that exceeds the line, it fails to redraw the previous line. It simply clears the current line and I can't see what I just wrote. It does only redraw the first ...
2
votes
5answers
376 views

How can I delete input in the terminal?

Xubuntu 13.10 Say I paste a command, something like sudo apt-get install abc yxz 123 DEF MMM KKK into the terminal. Then I suddenly had a change in mind and thus I would like to delete the last ...
8
votes
3answers
187 views

Clear / erase a mistyped password in a terminal

One thing that annoys me using Linux's terminal is when I have to type a invisble password, like when you run ssh the terminal I was wondering if there's a way to clear/erase the invisible password ...
1
vote
1answer
113 views

Simulating READLINE_LINE in Bash < 4.0

I am trying to make some of my code bash 3.X compatible and I have a key-binding that utilizes READLINE_LINE inside its callback function. 3.0 versions of Bash don't supply the READLINE_LINE, so I ...
3
votes
3answers
754 views

rlwrap: mysql autocompletion not working

Normally, autocompletion works fine in mysql command-line client (mysql-client-5.5). I have a table called booking. When I type the letter b and pres TAB the name of my table gets autocompleted: ...
6
votes
1answer
874 views

First characters of the command repeated in the display when completing

The first two chars were repeated while I use Tab to do completion. In the screenshot below, cd is repeated. I have tried rxvt-unicdoe, xterm, terminator. All these terminal emulators have this ...
0
votes
1answer
241 views

In tcsh shell how I find a particular word in the command prompt?

Suppose I have the following line in my command prompt and the cursor is at the and of the line or the beginning of the line by using (CTRL+A) [subhrcho@slc04lyo pcbpel]$ abc def ghi jkl How can I ...
3
votes
1answer
137 views

Where is the bash feature to open a command in $EDITOR documented?

I have recently discovered that if we press Ctrl+X Ctrl+E, bash opens the current command in an editor (set in $VISUAL or $EDITOR) and executes it when the editor is closed. But it doesen't seem to be ...
1
vote
1answer
386 views

How can I move between words in the command prompt in tcsh in linux?

I want a feature like vim's going forward or backwards command (w,e,ge,b) etc in the shell prompt. I am using tcsh shell in Linux. I would like to go 'n' number of words backs or forward etc and do ...
5
votes
1answer
156 views

can you make zsh autocorrect smarter?

I like zsh autocorrect, but it keeps asking me about things that don't need correcting. dzil build zsh: correct 'build' to '.build' [nyae]? % .build is a directory created by the build (or any ...
1
vote
1answer
180 views

How can I clear portion of what is typed into the prompt while working on Linux and using C-shell?

I am working in Linux and C-shell. Often times I would require to change some portion of what is there already in the prompt that I obtain from reverse searching through the history command by use of ...
7
votes
1answer
141 views

The shell's “delete word” shortcut deletes too many characters

Under Bash some behavior of Alt+d has been driving me crazy since years and I figured out that maybe it could be fixed with a setting. If I'm at a terminal and issue a command like this: ...$ cat ...
5
votes
1answer
3k views

How to input / start a new line in bash terminal?

I notice some sample bash for loops are spread out over multiple lines in examples for VARIABLE in file1 file2 file3 do command1 on $VARIABLE command2 commandN done (eg here ...
3
votes
4answers
644 views

Shell: How do I get the last argument the previous command when it was detached?

Within the shell, typing ALT+. or using !$ recalls the last passed argument of the previous command. I use this all the time, but how do you do that when you detached the previous command? $ ...
2
votes
3answers
724 views

tcsh shortcut to move the cursor back to previous space

I'm looking for a keyboard shortcut in tcsh to move the cursor back to the previous blank: not ESC+B which takes me back one word (for instance, in a path argument, to the previous path component) - I ...
4
votes
1answer
208 views

Is there a command for switch to vicmd mode in zsh?

I have mapped alt-k and alt-j for browsing history, but I would like to switch vicmd automatically whenever I call up a history entry, because most of the time I need to move the cursor to a certain ...
2
votes
1answer
346 views

Is there a way of color-highlighting paired brackets in shell (bash)?

Does anyone know if there is a way reproducing the same behaviour many text editors provide for colour-highlighting the syntax operators such as brackets or curly brackets. It would be very useful for ...
2
votes
0answers
253 views

Tcsh: Searching history using Ctrl-P and Ctrl-N

What are the equivalent functions in tcsh for the following zsh functions? up-line-or-history history-beginning-search-backward down-line-or-history history-beginning-search-forward I have the ...
8
votes
5answers
730 views

How to repeat currently typed in parameter on bash console?

I was just typing something along the lines of: mv foo/bar/poit/zoid/narf.txt and suddenly realized, damn, I have to type large parts of that parameter again mv foo/bar/poit/zoid/narf.txt ...
4
votes
4answers
991 views

Replace whole line in a file from command-line

I have a text file which has some contents similar to this: # General information about the project. project = u'Py6S' copyright = u'2012, Robin Wilson' # The version info for the project you're ...
12
votes
2answers
2k views

zsh wants to correct vim to .vim

I'm using zsh on Gentoo x64, and when I type sudo vim /path/to/file from my home folder, zsh asks: zsh: correct 'vim' to '.vim' [nyae]? I want to run vim not my .vim folder. How do I fix this? ...
1
vote
2answers
311 views

Is there a convenient way to wrap a bash command list into rlwrap?

Thanks to a question on superuser.com, I found out about this utterly convenient rlwrap tool. It satisfies my needs (i.e. add command history to another cmdline tool), but I was wondering how I can ...
2
votes
1answer
123 views

History-search in zsh working only for commands?

Say I have the following entries in my command history: less documents/doc1.txt less documents/doc2.txt less files/file1.txt less files/file2.txt ls pwd and that I have the following keyboard ...
21
votes
4answers
3k views

Change cursor shape (or color) to indicate vi mode in bash

To clarify: I am not asking how to change the cursor when using vim within a terminal. I want the cursor to change when switching between input and command mode within Bash's vi-mode: set -o vi ...
4
votes
1answer
305 views

Adding more Emacs-like bindings to ZSH's line editor (ZLE)

I have a couple of questions regarding the emacs-like keyboard bindings in Zsh. As background to all the questions: I have Emacs-like keybinding activated with bindkey -e (activated by default) ...
7
votes
3answers
3k views

ZSH: search history on up and down keys?

Currently, I have the following in my .zshrc: bindkey '^[[A' up-line-or-search bindkey '^[[B' down-line-or-search However, this only seems to match the content of my current input before a space ...
6
votes
2answers
2k views

Stop ZSH from trying to correct command

$ knife cookbook download recipe zsh: correct 'cookbook' to 'cookbooks' [nyae]? How can I get zsh to stop trying to correct cookbook to cookbooks?? cookbooks is a directory where I run the command ...
5
votes
2answers
2k views

zsh kill Ctrl + Backspace, Ctrl + Delete

How to configure zsh such that Ctrl+Backspace kills the word before point? How to achieve that Ctrl+Delete kills the word after point? I use urxvt as terminal emulator.
13
votes
2answers
902 views

Copy and set-mark in Bash as in Emacs?

I would like to be able to copy and paste text in the command line in Bash using the same keyboard bindings that Emacs uses by default (i.e. using C-space for set-mark, M-w to copy text, C-y, M-y to ...
3
votes
1answer
516 views

zle - I cannot find why Ctrl+R does not work for non-root

The Ctrl+R works for root (well toor) however I cannot find why it does not work for user. User .zshrc: setopt AUTO_CD setopt CORRECT_ALL setopt EXTENDED_GLOB # History SAVEHIST=10000 HISTSIZE=10000 ...
18
votes
1answer
977 views

Using zsh's line editor to wrap around subprocesses

Is it possible to use zsh's built-in line editor (zle) to feed input to a subprocess? That is, I would like to run zlewrap mycommand where zlewrap is a zsh function and mycommand is any program that ...