How to select text with arrow keys in fish shell - fish

I am a windows user. I am trying Ubuntu via WSL-2. I am struggling to select text with arrow keys in fish shell. I tried so many places to get answer for this question, but no one gave me proper solution. In documentation they wrote about binding for begin-selection. But what is the default way to do this?

begin-selection is a key binding, but it's not enabled in the standard key bindings by default.
You'll need to set some key bindings to begin and end selecting text. For example:
bind \e, begin-selection
bind \e. end-selection
will set Alt-< and Alt-> to be begin and end select mode, respectively. These can be used with the default Ctrl-X clipboard copy function.

Fish does not support your intended style of selecting text. The begin-selection and end-selection commands are intended for VI-style selection in VI mode.
See this feature request, this question on superuser and daleeidd/natural-selection for an attempt to implement shift-select.

Related

Powershell 7.3.0 Tab completion not working

I've recently upgraded PowerShell to version 7.3.0 version and now, when I type a command, I see its suggestions like when I'm typing pip it adds list like in this image. Or when I type start of the command it suggests its full name.
The problem is that when I press Tab it doesn't complete the command, instead it just starts listing current directories, i.e. here is an image after pressing Tab once.
Also even when I start typing the full name of the command like pip li it still shows the ending, but when pressing Tab it just does nothing.
I expected this to complete the current command with the suggestion after Tab is pressed.
I've tried to google this problem but haven't found the exact same case I have with 7.3.0 version.
Just press -> (right arrow) key
If you want to change key bindings:
source: https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/
Key Bindings for Predictions
Key bindings control cursor movement and additional features within the prediction. To support users running Predictive IntelliSense on multiple platforms, key bindings are user-settable from the command line or your profile script.
PSReadLine contains functions to navigate and accept predictions. As an example, to accept a displayed prediction, PSReadLine contains functions:
AcceptSuggestion – Accept the current inline suggestion
AcceptNextSuggestionWord – Accept the next word of the inline suggestion
AcceptSuggestion is built within ForwardChar, which by default is bound to RightArrow. Pressing RightArrow accepts an inline suggestion when the cursor is at the end of the current line.
AcceptNextSuggestionWord is built within the function ForwardWord, which can be bound with Ctrl+f by Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord. Pressing Ctrl+f accepts the next word of an inline suggestion when the cursor is at the end of current editing line.
As a user, you can bound other keys to AcceptSuggestion and AcceptNextSuggestionWord for similar functionalities. Search for ForwardCharAndAcceptNextSuggestionWord in SamplePSReadLineProfile.ps1 for an example to make RightArrow accept the next word from inline suggestion, instead of the whole suggestion line.
List of additional suggested key bindings defined in PSReadLine SamplePSReadLineProfile.ps1

Neovim: Change Cursor Type for Insert Mode

I'm new to (Neo) Vim and I'm trying to find configurations that I like and learn from them.
Whenever I watch people code in vim/neovim, I notice that their cursor a thick box, same as when they're outside of Insert mode.
Basically, while in insert mode, my cursor is thin like this |, but I want to change it so that it's thick like it is when you're outside of insert mode.
I'm on the latest version of Neovim and I use Windows 10 if that's useful information.
Yes, that is possible with guicursor option, but whether what option takes effect also depends on your terminal, for example, using Windows Termianl.
This is a working setting to make cursor shape block in insert mode:
set guicursor=n-v-c-i:block
which means to make cursor shape block in normal, visual, command, and insert mode. For more details, please use :h 'guicursor'.
You should be able to change that setting with guicursor. (For NeoVim there is termcap-cursor-shape.)
But note that the two different cursor actually make sense: In normal mode you are always on a character (i.e. you can use i and a to produce different results), while in insert mode the curor must be between two characters.
Personally I think that it would just get confusing to have a blocky cursor in insert mode due to the reason above, but furthermore it would make it harder to distinguish the two modes too!
And for future reference, there is a dedicated stackexchange for vi and vim!

How to skip forward/backward a word at a time when editing postgres command in psql?

In most command line interface "cli" programs the Option-arrow key combinations allows one to move forwards/backwards a word at a time. But in psql both Option-arrow and Control-Arrow actually insert non printable control characters that corrupt the command. In addition in most CLI programs hitting CTL-A goes to the beginning of the command and CTL-E goes to the end of the command. But in psql those combinations do not have any effect.
Navigating a single character at a time is simply too slow: I can not imagine this were an unsolved problem. What is the configuration needed to get one of those key combinations to skip forward/backward by words not characters?
This is an answer containing the response in the comment by by #Marth. The ~/.inputrc does cause the issue.
# want vi to be the default editor for readline
set editing-mode vi
$if mode=vi
# normal mode
set keymap vi-command
set keymap vi-insert
"\C-n": backward-kill-word
"\C-p": history-search-backward
$endif
I have completely removed the ~/.inputrc now.

Difference among Emacs org-mode in GUI, gnome-terminal and Guake terminal? [duplicate]

I am trying to use org-mode and whenever I press Crtl+return emacs does C-J instead. I know this because when I use c-h k and then press crtl+return, emacs shows:
"It is bound to C-j."
Is there anyway I can make it register ctrl+return so I can insert headings?
I am using emacs23 through the terminal on ubuntu 12.04 x64. When I do this on my windows machine it does insert a new heading.
Possibly. As #phils says, C-Enter is usually not a valid sequence for the vast majority of terminal emulators. This is because when you press a key, or key combination, the terminal sends a sequence of characters to the relevant application. Pressing a sends a, whereas Enter sends CR - carriage return (otherwise known as ^M, \r or \015).
What sequences are actually implemented in modern terminals is mostly just a hang-over from the earlier, physical, terminals that they emulate (notably the VT-100). These machines didn't allow the use of Ctrl in conjunction with every key, such as the function keys, for example, so C-F1 was not possible and didn't have an escape sequence defined. Similarly, there is no control sequence for C-Enter, so when you press it, the terminal ignores the Ctrl and just sees the Enter.
You may, however, be able to define your own escape sequences in your terminal, which you can then bind to the correct key combinations in emacs. See here, for example. I was able to use this method to be able to use C-Enter. Unfortunately, this is still a bit of a pain, as it requires a lot of configuration and you may still be unable to use some sequences (C-M-% doesn't work in konsole for me). As with #phils, I've taken to using the GUI, but I'd love to have better integration with my terminal.
That's not a valid sequence for most terminals, I'm afraid, so they simply can't send it to Emacs.
If you run GUI Emacs instead, the key bindings will work.
Thomas Dickey's xterm is the only terminal software I know of which can (I think) support all the normal Emacs bindings. If you're okay with compiling that, then you could try it with the following .Xdefaults-(hostname) (or .Xresources if you re-merge after editing) to get basic support working:
XTerm*metaSendsEscape: true
XTerm*modifier: meta
XTerm*modifyOtherKeys: 1
You actually need XTerm*modifyOtherKeys: 2 to fully extend the sequences (otherwise you still can't type the likes of C-M-%), but by default that setting will break most key sequences, and right now I couldn't tell you how to configure things correctly for that setting (the only example I've seen -- xterm-extras.el as mentioned on the wiki and available in the easymacs download -- didn't work for me).
I mostly use GUI Emacs, but I'd love to get this working properly, so if anyone has had success with xterm-extras.el or similar, please do speak up.
If you're willing to install an Emacs package and configure your terminal, I wrote an Emacs package which can teach Emacs and terminals how to properly recognize all PC keyboard keys and modifier key combinations:
https://github.com/CyberShadow/term-keys
Its default configuration enables encoding the CtrlReturn combination, which allows Emacs to distinguish it from CtrlJ.

How to highlight the selection in Emacs keybinding of Eclipse?

I have searched the Web for this, but with no luck. Any idea?
Thanks.
Try using the Emacs+ plugin available here:
http://www.mulgasoft.com/emacsplus
It provides a HUGE range of functionality - including the selection highlighting that you're looking for - that really helps the move from Emacs. I've only been using it for a couple of days, but it appears stable and integrates very well with the editor.
As described here, you can set emacs key binding to work in component editor in Eclipse
Go to Preferences -> General -> Keys.
Change Scheme to Emacs if you haven't done so already, so you can easily
spot the emacs key bindings.
Sort by Category and look at the "Text Editing" categories
Find the commands that you care about, e.g. Next Column, Previous Column
Select that command and click "Copy Command"
Set the binding to the key by pressing the keys, e.g. press Control-f to
generate "^F".
Change "When:" to "Editing Components".
Repeat for all the key bindings you care about.
So if, in emacs, selection is done by setting the mark (Control-Space) at the start of the region, then moving the point to to the end of the region, you could associate the appropriate shortcut to:
Text Editing > Select Text Start
Text Editing > Select Text End