Tag Info

New answers tagged

0

To extend mrb answer: Indeed ^[b is ESC+b or (Meta/Alt+b). You can display character literally by proceeding it with Ctrl+v. In this case you will find the following: Ctrl+v Ctrl+b ^B Ctrl+v Meta+b ^[b Ctrl+v ESC b ^[b Additionally you will find in zsh manual: backward-word (ESC-B ESC-b) (unbound) (unbound) Move to the beginning of the previous ...


1

The ^ notation is commonly used in the GNU world for control characters, where ^a is Ctrl-A (ASCII 1 where A is ASCII 65). In other words it is shorthand for "use the character 64 slots before this on". The ESC key is ASCII 27 which is 64 steps before [, hence ^[ is shorthand for ESC. In the GNU Emacs editor several modifier keys were used, CTRL, META ...


1

^ is usually control, but ^[ actually means Escape or Alt (or meta, if you like emacs). So you can press Escb or Escf for those key combinations. By default, Alt doesn't work on Mac terminals, but iTerm2 has a setting: "Option acts as [ ] Normal [ ] Meta [ ] +Esc". You want +Esc.


2

Actually ^[ is the Alt key. So in your case the terminal (Iterm2) uses Alt + b and Alt + f to go backwards and forwards a word. This is controled by your terminal and has nothing to do with zsh.


0

TERM=xterm mono Source/PashConsole/bin/Debug/Pash.exe solves the problem. The default TERM=xterm-256color causes the garbage on the terminal. This is not a problem with gnome terminal, not even Pash, but with Mono, see https://bugzilla.xamarin.com/show_bug.cgi?format=multiple&id=18315


5

To make this an alias, which is possible, you need to use double quotes around the entire value for the alias. You'll also need to escape a few things within the alias as a result, and you need to escape any of the field arguments to awk since these will get interpreted as arguments by Bash as well when you're setting the alias. This worked for me: $ alias ...


6

Can you help me understand how to create this alias? May I advise you to create a function if you use bash and put it in .bashrc? mm() { ps -u "$USER" -o pid,rss,command | awk '{print $0}{sum+=$2} END {print "Total", sum/1024, "MB"}' } If it's bash, variables need to be quoted. In a function, no need to put everything on one line.


2

In an escape sequence like ^[[31m, the escape character ^[ is non-printing, but the other characters [31m are printing characters. So sort -i won't help you: it ignores the escape characters but still sorts [31mred[0m before [32mgreen[0m. A generic way to sort data according to criteria that go beyond the built-in abilities of the sort utility is to double ...


0

Something like ␛[01;38;05;129m, where the first character ␛ is the ASCII escape character (U+0027), is a terminal escape sequence. It instructs the terminal to start displaying bold, blinking text in color 129. \e is bash syntax for the escape character (inside $'…', in PS1, in echo -e and in printf). \[ and \] are not terminal escape sequences, they're ...


3

-k option of sort takes two numerical arguments: field and character. You want to sort on 6th character of first field. It is 6th character because %F{green} is replaced by ESC[32m. So this should work: print -lP "%F{green}"${^$(setopt)} "%F{red}"${^$(unsetopt)} | sort -k 1.6


2

The "non-printing escape sequence" is needed when using non-printing characters in $PS1 because bash needs to know the position of the cursor so that the screen can be updated correctly when you edit the command line. Bash does that by counting the number of bytes in the $PS1 prompt and then that's the column number the cursor is in. However, if you place ...



Top 50 recent answers are included