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>
Related
I don't how to remove ctags from vim. Each time I type 'Ctrl+]' it tries to find the tags. I want to map this key for other usage. How can I do it?
Ctags is an external program that is not part of Vim. It can't be removed from Vim because it isn't there in the first place.
Vim's various ctags-related commands can't be removed either. If you want to map <C-]> to something else then there is nothing stopping you.
This normal mode mapping, for example, will delete the current word when you press <C-]>, effectively overriding the original meaning of <C-]>:
nnoremap <C-]> diw
See :help 05.4 for a gentle introduction to mappings.
I would like to set some shortcut for set relativenumber and than I would like to set number as far I will put any key that is not number or hjkl and pass it key to active buffer. It would be really usefull for me. Is it possible?
Yes, it is possible.
Vim help give several examples on how you can accomplish this task. You should read :help 05.3, :help 40.1 and vim faq-mapping-keys.
In order to use F4 to toggle the 'relativenumber' you can use the following:
noremap <silent> <F4> :set relativenumber!<cr>
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
In bash, adding the lines
"\e[B": history-search-forward
"\e[A": history-search-backward
to my .inputrc, allows me to search the history for expressions that begin with the characters in front of my cursor by using the <page-up>/<page-down> keys.
Can I achieve something similar in vim?
I already know about the possibility of opening a history window with q: and performing even complex searches there, but I am looking for a simple solution for the simplest case of history search.
Thank you!
This is built-in as <Up> and <Down>.
Of course, you can customize this, e.g.:
:cnoremap <PageUp> <Up>
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.