What does F2 key do in normal mode - vim

When I press the <F2> key it hides the line-indicator in the bottom right (see pictures), is this regular functionality? If so, where can I find the docs for this? I have tried looking this up using :help and online as well I cannot find any of this.
Before pressing F2:
After pressing F2:

After some good digging through my vimrc files. I have found my <F2> is mapped to 'pastetoggle'.

Related

What's the quickest way to pull up Vim's quickref page?

What is the simple key combination in Vim to bring up the quickref page, or at least a page that is functionally similar i.e. it contains a list of commands and their key bindings?
After manhandling Google for 15 minutes, I can't find anything shorter than :h quickref.
Not exactly the same as :help quickref but
:viu[sage]
opens :help visual-index and
:exu[sage]
opens :help ex-cmd-index.
I couldn't find a way to do it, but you could remap a key.
I personally think the F1 key for the default help page is useless to me. Maybe you are in the same boat and could remap it to the quickref.
noremap <F1> :h quickref<CR>

Vim map pattern not found

I want to map the F2 button to manage the date in vim.
I'm using vim snippets so I want to be able to write down the date while a certain text is selected, I came up with this:
vmap <F2> :s/currentdate/\=strftime("%d-%m-%Y")/<CR>.
It works fine but, here is the problem, I also want to be able to update the time:
vmap <F2> :s/..-..-....\|currentdate/\=strftime("%d-%m-%Y")/<CR>.
It doesn't work so I tested it directly on vim, without the F2 mapping and my command (when text is selected):
:'<,'>s/..-..-....\|currentdate/\=strftime("%d-%m-%Y")/ works fine.
It seems like the map command make the use of the 'OR' (\|) impossible.
Also, if there's another way to update the date, I'd be interested too.
Thanks in advance.
So thanks to #yolenoyer we have the solution (escape the backslash)
vmap <F2> :s/..-..-....\\|currentdate/\=strftime("%d-%m-%Y")/<CR>
Don't know why we have to escape it but it works.

Where to find a list of special character representations?

For example backspace is <BS> and tab is <Tab>, but where can I look them up if I don't know or remember the sequence for, say, the up or down arrow?
Two :helpful tricks:
In insert mode and in the command line, hitting <C-v> followed by some key inserts that key's internal notation.
For example,
:helpCtrl+v↑
produces
:help <Up>
The :help command supports completion so you can type a keyword related to what you want and hit <Tab> or <C-d>:
:help key<Tab>
I was going to ask this, but then I found the answer by random luck in the help files. So here it is for those who are looking for the same:
:help keycodes

Search vim help for subject under cursor

While working with some Vim scripts, I found myself typing
:help {subject}
quite a bit. I want CTRL+] (jump to definition of keyword under cursor) functionality, but instead of running :tag {ident} I want it to do :help {subject}, where {subject} is the word under the cursor.
Just press K. If you have set a global 'keywordprg', you need to unset it (or set it to the special :help value) in ~/.vim/after/ftplugin/vim.vim:
:setlocal keywordprg=:help
The simplest solution is
nnoremap K :help <C-r><C-w><CR>
To check the documentation of the keyword under your cursor, you can press Ctrl+] to go to its documentation.
If you have enable mouse support in nvim with the following options:
set mouse=a
you can double click the keyword to go to its documentation.
By the way, to go back to previous position in the help file, press Ctrl+O or Ctrl+T.
The above is also true for Neovim.
References
https://vimhelp.org/

Mapping :nohlsearch to escape key

I like to use hlsearch but I hate to keep everything highlighted after searching, to solve this problem I could simply use :nohlsearch or an abbreviation of it but that is still to much effort so I decided to try to do that on pressing escape. What I came up with is:
nnoremap <ESC> :nohlsearch<CR>
This works exactly as I want it to in GVim which I usually use for development but it does not work in vim.
If I search something in vim, press escape to deactivate the highlighting and use one of the arrow keys to navigate vim goes directly into insert mode and inserts a character on a new line.
As I never really came around to using h, j, k and l for navigation this is really annoying and I would like to know how I can make vim behave like gvim.
If you need more information you can find my entire vim configuration here.
Your problem is that when you press <Up> terminal sends something like <Esc>OA (you will see it if you type <C-v><Up> in insert mode) which is remapped to :nohlsearch<CR>OA. I do not know any solution except not mapping a single <Esc>, try either mapping to double <Esc>.
I created this map to disable search when press double <Esc>
nnoremap <silent> <Esc><Esc> :let #/ = ""<CR>
is :noh still too much work?
EDIT: I don't know about you, but I personally think :noh is easier than pressing Esc key, since I can press all the buttons without stretching my pinky too far (which is why I think the default mapping of Esc for going back to Command Mode from Insert Mode is a bit unfortunate). If you really use the :nohlsearch that much, you probably should remap it to something you can reach from the Home Area (i.e. regular letters, or numbers, or perhaps Ctrl-letters).
Anyway, typing the exact command you give works in my vim (on gnome-terminal). Are you sure you put the rule in .vimrc file, instead of .gvimrc? No luck after restarting vim? Try :source /path/to/config/file and see if that makes it to work.

Resources