How to exit Tig search view? - search

In Tig, press the </> key to enter the search view. But if I accidentally press it, how should I quit?
I tried the ESC and Backspace to no avail.
I made a video about it.
https://imgur.com/vo8qJSs

Use Ctrl+C to exit the search prompt

You can also hit enter to just run the search (doesn't matter if it's an invalid one). You'll just receive a No match found for "your search" message while recovering the focus on your view

Related

How to exit emacs text editor in Ubuntu terminal?

So I'm in a file and can't get out, I'm on SSH so can't reset terminal. Can anyone help? There is no information online that I can find, 99% of the results are about Vim but I'm not using Vim.
I've tried CTRL+C, CTRL+D, :quit, exit, quit, ESC and many more,
I've also tried all options in the opposite case.
There's multiple ways which worked for me, here they are.
Option one was to press CTRL+X+C, the X first is important.
Although you said you had tried this, so on to option two. Do what I said above, but putting C first, then you should have an input at the bottom, enter ! and it should exit the editor.
You're welcome.
Hold the Ctrl button. Press 'x' button, release it, then press 'c' button: Exit Emacs
Reading the answers and the comments, it is very strange, that Ctrl+x then Ctrl+c is not working. All key combinations in Emacs are bound to commands, also Ctrl+x Ctrl-c. It is bound to the command
save-buffers-kill-terminal
So what you can try is press Alt-x to execute a command. You should see M-x in the minibueffer at the bottom of emacs. then enter save-buffers-kill-terminal and voilá, you exited emacs. (Emacs will ask, if you have unsaved buffers or running processes, otherwise it will exit directly)
Hope this helps.

ESC key doesn`t work when I enter 'vi .bash_profile'

As I said on title, ESC key does not work when I enter to 'vi .bash_profile' and I have to use forced termination. I searched other question already and I tried press 'Ctrl+[' but it was not working also. Does anybody know how to escape from 'vi .bash_profile' after editing?
ESC key does not work when I enter to 'vi .bash_profile' and I have to
use forced termination.
vi is not terminated by Esc. To exit from vi, there are a number of ways:
:qEnter or ZQ - don't write changes
:xEnter or ZZ - write any changes
…

Vim does not like brackets

I have a problem that have been bothering me for days now.
Whatever I do, I simply cannot place any single {,},[ or ].
Every time I try, it takes me up to the next or previous paragraph. I've looked it up and I can't find a good way to unmap it and finally have my azerty keyboard to behave correctly so I can peacefully code
In the normal mode, press 'i' to enter the insert mode.
And you can start to edit your file.
After everything is done, press the 'ESC' key and then ':wq' to save your modification.
Vim / vi has several different modes. This dates back to the times when you would edit using a teletyper, i.e. no "visual" representation of the data you are editing, no mouse etc.
With only the "usual" keys at your disposal, you need to navigate in the data, you need to insert data, and you need to execute commands on the data. Not so coincidentially, these are the three modes of Vim / vi, and in each mode, the keys do something differently.
By default, the editor starts in the "normal mode", which you will use to navigate, and enter the other modes from.
In this mode, ) moves you to the end of the sentence, ( to the previous sentence. } and { do the same for paragraphs, combinations of [ and ] work with chapters.
If you enter "insert mode" (most simply by pressing i in "normal mode"), you can enter all the above letters normally. You exit "insert mode" by pressing <Esc>. You will recognize "insert mode" by -- INSERT -- being displayed in the bottommost line of the screen.
If you are in "insert mode", and pressing any of the above keys does move your cursor instead of entering the corresponding symbol, there is some (broken) configuration at work. Check your ~/.vimrc, and if necessary, rename it and try again with a "clean" configuration.
It is next to impossible to do Vim / vi justice in the scope of a SO answer. It is very much an expert-friendly editor, not a novice-friendly one. You need to actually learn how to use this editor, but it is absolutely worth it in the long run.
In insert mode, you should be able to insert brackets without trouble.
In normal mode, those correspond to motions.
To go to insert mode from normal mode, press i.
See: :h object-motions
Alright, Problem Solved ! I had to uninstall and reinstall the Ubuntu bash on windows 10 multiple times and it worked ! Thanks for the help everone !

Vim autocomplete: Cancelling autocomplete popup

If I hit ctrl+n in vim, I'll get a list of suggested autocomplete options in a popup box.
This is fine...but if I decide I don't want to autocomplete after all, I'm not quite sure what to press to revert the suggestion.
For example, suppose I type rea, hit ctrl+n, and autocomplete pops up with really_long_method_name_damn_this_is_annoying...and I don't want that. I can't quite figure out how to revert the syntax back to just rea... I have to manually delete the unwanted characters.
I'm guessing this is a pretty straightforward thing, but still - if anyone knows how, please let me know.
Ctrl+E will end the current completion and put back that originally typed text.
See
:h complete_CTRL-E
:h ins-completion
Try pressing Ctrl+P to take you back to the original (or if you are feeling ambitious, Ctrl+N until you loop back around :) ).
Type :help ins-completion-menu for a detailed description of all your options.
Press Ctrl+P followed by Esc. The former will remove the autocompleted text, and the latter will close the popup.

Vim incremental search next result

I have incsearch and hlsearch enabled
So I hit / to enter search mode.
Then I type text I want to search for and it finds the first occurrence of the text I typed.
Then I want to jump to next occurrence of the text I typed without exiting search mode so that I could refine my search text later without having to exit to normal mode, then hitting n and then going back to search mode by hitting / again.
If this is possible, how can I do it?
The best thing that I can find that you can do is the following:
Search for your pattern using /blah
Then, hit n or ? until you see what's out there...
Then go back to / and press CTRL-r /
this will bring back the last pattern that you searched for, so you can continue entering more text there...
I'm sure you can remap that combination to some key so that you can quickly go back to the search with the pattern already entered.
I've found a way thanks to bwana147 from #vim irc channel on freenode.net
:cnoremap <c-n> <CR>n/<c-p>
After that typing text in search mode and then hitting ctrl-n goes to next occurrence of that text without exiting search mode
I have incsearch and hlsearch enabled. So I hit / to enter search mode. Then I type text which I want to search for and it finds the first occurrence.
Okey so far ...
Here, I can't quite understand what you're asking.
Then I want to jump to next occurrence of the text I typed without exiting search mode
This is done by pressing n
so that I could refine my search text later without having to exit to normal mode, then hitting n and then going back to search mode by hitting / again.
You got me lost here ... isn't this behaviour exactly what incsearch enables you?
Use Ctrl-g or Ctrl-t for incremental search. When you want to search something hit /some, then hit Ctrl-t this will jump the cursor to first some, but you stay in search mode, you can add "thing" to search, and search pattern will be /something.

Resources