Error with left key in command line - byobu

Accessing through putty with putty-256color in terminal type (and UTF-8 Trasl). I press left or right key in the prompt line. It shows this rectangle:
But If I press Ctrl or Shift and Left/Right it moves cursor OK.
When I access through VNC it works fine.
I may be something of putty
Byobu 5.87
tmux 1.9
Any suggestion?
Thanks.

This is the result of display-panes tmux command to display the panes id.
Originally, it is bound to C-b q but seems like either your right/left keys send this sequence or you have your bindings changed so that that command gets executed on right/left keys.
To check what your keys sequences, use just cat.
To check your tmux key bindings use list-keys command in tmux.

Related

Configure up-arrow to browse through commands starting with already typed characters

This is a self-answered post.
On octave-3.8.2 command line, the up-arrow recalled only commands starting with characters already typed on the current line.
This behaviour has been lost in recent octave (4.2.0) for instance.
How to bring back the previous behaviour ?
Octave is now using ~/.inputrc if present, rather than its default octave/4.2.0/m/startup/inputrc.
Another readline configuration can be used at any time readline_read_init_file.
If behaviour is to be shared between all readline programs (bash for instance), then just add the following (taken from this answer, for bash) to your ~/.inputrc:
# allow to enter the first characters of a command,
# and then use the Up and Down keys to move through only those commands
# in history that begin with that string.
"\e[A": history-search-backward # arrow up
"\e[B": history-search-forward # arrow down
If this should be done only for octave, one way is to wrap these lines between $if octave ... $else ... $endif:
$if octave
"\e[A": history-search-backward # arrow up
"\e[B": history-search-forward # arrow down
$endif
Another way would be to issue a readline_read_init_file("~/.octave_inputrc") in your ~/.octaverc.

Modify Key-Bindings in Byobu

I have recently installed byobu terminal multiplexer, and I found that I am not able to move in a fast way through the terminal. In linux you can do: Control+Arrows (Left/Right). I want to find the same but in byobu.
And I would like to configure it, in order to be able to use Ctrl+Left and Ctrl+Right if it's possible, not other combinations.
Any idea?
I have tried already this: How to make byobu forward-word and backward-word with CTRL+arrow?
But is not working for me.
Ubuntu 13.10
Thanks in advance.
One way to change your key bindings is to edit /usr/share/byobu/keybindings/f-keys.tmux (or edit ~/.byobu/keybindings.tmux).
You will find these lines :
bind-key -n M-Left previous-window
bind-key -n M-Right next-window
M is for Meta, aka the ALT key. Example. Change the lines for :
bind-key -n C-Left previous-window
bind-key -n C-Right next-window
C for Ctrl key (and S for Shift key).
Save, quit, press F5 to reload profile.
Refs : Bybobu doc, Byobu-and-mc, keybindings-in-byobu-using-tmux-backend, tmux
If the Function and other keys are bound to some other program, they won't work. Also, on some OS e.g CentOS, the keys (and their combinations) cease to function.
My solution is to use the bind-key which is Ctrl a to perform different actions. Here are a list of few important shortcuts with bind-key
Help
$ Ctrl-a ?
Create new window
$ Ctrl-a c
Horizontal split
$ Ctrl-a | #Shift + \ = |
Vertical split
$ Ctrl-a %
Rename windows
$ Ctrl-a ,
Move window
$ Ctrl-a .
To move between splits (tested on RHEL)
$ Ctrl-a (arrow-keys)
NOTE: Tested on RHEL/CentOS

EMACS find-grep command switching windows

I have the following in my .emacs
(defun find-in-workspace(term)
(interactive "sSearchInWorkspace: \n")
(grep-find (concat "grep -rnH --include=\*.{c,cpp,h} --include=-e '" term "' /home/workspaces/*")))
which is just a wrapper around grep-find so that it can search all the files in my workspace.
My problem is with the grep buffer. I would like to keep my cursor in the grep buffer's window when I select items from it so that I can quickly browse through the code, but selecting a line will automatically moves my cursor to the other window, which adds up in keystrokes when I have a list of over 5 items. Is there anyway I can build this functionality into this function, or change a setting for grep-find? I've been searching but haven't found a solution.
See the functions next-error and previous-error. They leave the grep buffer, but they work from anywhere, so, for example, if you bind next-error to a convenient a key then you can keep pressing it and it will iterate over the grep buffer.
There might be some options of grep behavior, that you might find if you dig in the lisp/progmodes/grep.el from the source, but I really think it might be better and easier to have a look of GrepPlus library which bring many enhancement of emacs grep.
Otherwise you could also use occur and see how you could customize it. In occur, when you are in the match buffer, you can it C-o instead of Ret, which will show in the other buffer the match you selected, keeping your cursor in the match buffer. Difference with grep, is that it only works with opened buffer. I'm rather sure grep+ might have the equivalent. You should have a look
There are two functions for doing exactly what you want: previous-error-no-select and next-error-no-select.
Also, you may find useful next-error-follow-minor-mode.

Set up "toggle comment" command in slickedit? Add more than one hotkey to a command in slickedit?

Is there a way to do either of these two things?
Add hotkey to "toggle comment". By
default slickedit seems to have 2
separate commands, comment and
erase-comment. I wish to have a single
hotkey to handle both (similar to how
eclipse/netbeans handles it).
█
Add 2 separate hotkeys to do the same
command.
In SE16 (probably also in previous versions, I didn't check) you'll find a command toggle-comment (look in source file box.e). You may bind that to a key.
And the second one is simple: Go to Tools -> Options, select category "Keyboard and Mouse", sub "Key Bindings". Search the command/key you need, and press the button "Add..." to add another key binding.

Moving a word forward in z shell

In zshell how to move forward word, I can set -o vi and use vi format. Is there a way to move forward in zshell by a word
If you're using iTerm2 on OSX, you can use the Natural Text Editing preset under Preferences -> Profile -> Keys.
This supports these key combos (which are very similar to other editors):
alt/option + left = move left one word
alt/option + right = move right one word
The ZLE widget for moving forward by one word is forward-word. Therefore, you may use bindkey to bind this widget to any key you want.
For example,
$> bindkey ^O forward-word
would allow you to move forward by one word when pressing Ctrl-O. Note that ^O is actually a quoted insert of Control followed by O.
Your zsh command prompt works either like emacs or like vi. If it works like vi, put it in command mode (esc) and type w. If it works like emacs, use M-f.
More information available at man zshzle.
Similar to other answers, but for Zsh on iTerm it took me a while to find this:
If you are using Zsh, like Oh My Zsh, in iTerm then go to: Preferences > Profiles > Keys sub-menu
Click + sign
Add your shortcut combo, choose "Send Escape Sequence"
inputs for left and right below.
left:
[1;5D
right:
[1;5C
forward word [Meta]+[f]
backward word [Meta]+[b]
On macOS, [option]+[→] and [option]+[←] work too.
In my zsh terminal it was already set to the below using bindkey
"^[f" forward-word
"^[b" backward-word
I was not sure how to use this, read on Apple Forum's, this is basically
^+[ release it then press f or press esc release it then press f
Similarly for backward,
^+[ release it then press b or press esc release it then press b