Since a couple of weeks ago every time I press the super key(windows key) vim executes 3p and some other commands(specified bellow), this all started when I bound my super key to open the terminal by executing xfce4-terminal --drop-down. I've already unbound it but the problem is still there.
I want to unbind the super key so I can bind it to some other command.
First thing I tried was to list all commands using :map but found nothing related.
This is what I've got:
Y y$
v gx <Plug>NetrwBrowseXVis
n gx <Plug>NetrwBrowseX
v <Plug>NetrwBrowseXVis * :<C-U>call netrw#BrowseXVis()<CR>
n <Plug>NetrwBrowseX * :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<CR>
n <C-L> * :nohl<CR><C-L>
Then I executed vim -w and stored the output of the super key.
Output:
ESC[1;3P
Every time I press the super key this was executed.
Related
e.g. if I type :im it outputs a long list of messages of the insert mode mappings.
i <Plug>(fzf-maps-i) * <C-O>:call fzf#vim#maps('i', 0)<CR>
The i is for insert mode.
:help <Plug> says that you use it for "internal mappings which is not to be matched with any key sequence". What is this good for? If you manage to press an unpressable key combination it will open the :Maps terminal buffer? Aside from this specific situation, why would you want to bind an unpressable binding?
Next, we have the *. What does it refer to? :helpgrep star or :helpgrep * fail me.
Next we have this line:
i <Plug>(fzf-complete-file-ag) * fzf#vim#complete#path('ag -l -g ""')
Why does the first line above use * and then still use <C-O>:call ... <CR> while this one just mentions the function name?
<Plug> [...] What is this good for? If you manage to press an unpressable key combination it will open the :Maps terminal buffer?
It is an unpressable key combination. It doesn't mean it cannot be generated. If you look at the docs of fzf.vim, you will see an example of a related mapping that user can insert into their .vimrc:
nmap <leader><tab> <plug>(fzf-maps-n)
If the user then presses LeaderTab, it will generate <plug>(fzf-maps-n). This mapping is not noremap, so it will trigger the map <plug>(fzf-maps-n) mapping defined by the plugin. This way the plugin exposes a mappable key sequence, but without any side-effects for the users where they might accidentally trigger it; though they can still map to it if they wish to.
Next, we have the *
:help map-listing will tell you * means it is not remappable (i.e. created by inoremap instead of imap).
Why does the first line above use * and then still use <C-O>:call ... <CR> while this one just mentions the function name?
It is not visible from the listing, but the command that created it was:
inoremap <expr> <plug>(fzf-complete-file-ag) fzf#vim#complete#path('ag -l -g ""')
Note the <expr> modifier. :help :map-<expr>
I occasionally like to map vim keys to search and then do something. I've been doing this for decades, but when I do it now, it takes over a second each time I use the mapped key.
I believe the cause is this, response from ":map" in vim:
n gx <Plug>NetrwBrowseX
n <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR>
What are these mappings for, and how can I get rid of them?
The map I'm adding today is
:map g nz.
Simply so every time I find the searched term, it's centered in the screen so I can quickly compare contexts.
Try nunmap gx.
From the source code netrw.vim:
" s:NetrwBrowseX: (implements "x") executes a special "viewer" script or program for the {{{2
" given filename; typically this means given their extension.
" 0=local, 1=remote
fun! netrw#NetrwBrowseX(fname,remote)
I recently generated tags for my project using Exuberant Ctags following approach 4 at: http://ctags.sourceforge.net/faq.html#15.
After this, I have been able to use the tags, tag and stags command to jump to tags. However, Ctrl + ] i.e. <C-]> does not jump to a tag when pressed.
I read through some similar questions and found that the following might be relevant:
:verbose setlocal iskeyword?
iskeyword=#,48-57,_,192-255,#
Last set from /usr/share/vim/vim74/ftplugin/vim.vim
And
:map <C-]>
No mapping found
My Ctrl and ] keys are working fine. I'm able to type the square brace, and I'm also able to use commands like Ctrl + W h/j/k/l to switch between vim splits.
I have checked inside and outside of screen, and checked my .vimrc and .bashrc as well. My .vimrc is at: http://pastebin.com/GkF416SY
Unfortunately, I remain clueless as to whether Ctrl + ] is getting eaten by some program (PuTTY/bash?) or if there is some other issue. I would really appreciate help in fixing this issue. I'd be happy to provide any further information.
EDIT: I'm using a COLEMAK layout with an ordinary keyboard. The [ key is immediately to the left of Enter.
EDIT 2:
I still have the same problem with the staffanc/cscopemaps.vim plugin turned off and cleaned with PluginClean.
I've ensured that cscopetag is not set by using 'set cscopetag&' within the session. It still did not help.
I tried Ctrl + W } -> this opens the preview window with the tag in it. The problem keeps getting weirder.
EDIT 3:
Following #gregory's advice, remapping to worked. Interestingly enough, mapping to and pressing Alt + ] doesn't work!
Oddly, Alt + \, Alt + / also don't work while remapping. One side's Alt key is sending in the character directly, so I'm forced to use Right Alt.
EDIT 4:
I found the following in the list of mapped keys:
o [% * v:<C-U>call <SNR>13_MultiMatch("bW", "o") <CR>
v [% <Esc>[%m'gv``
n [% * :<C-U>call <SNR>13_MultiMatch("bW", "n") <CR>
o ]% * v:<C-U>call <SNR>13_MultiMatch("W", "o") <CR>
v ]% <Esc>]%m'gv``
n ]% * :<C-U>call <SNR>13_MultiMatch("W", "n") <CR>
I'm not sure, but this may be the cause of the problem. Could you please explain the use of the '%' character here? I took a quick look, but I haven't been able to track it down yet.
On my French AZERTY keyboard, if want want to hit CTRL+], I have to remember where it's placed on a US/QWERTY keyboard. Then, I hit CTRL + this key.
IOW, as I never remember where those keys are depending on the keyboard used, I've mapped CTRL+] to something I can remember: <M-Down>.
I'm working on mappings in vim and ran into a problem. I can map to <Up>, <Down>, <Left>, and <Right>, and I can map to <S-Left> and <S-Right>, but I can't map to <S-Up> and <S-Down>. In other words
:nmap <S-Right> l
works, and so does
:nmap <Up> l
but
:nmap <S-Up> l
doesn't.
Maybe SO will know the answer to this problem, in which case I'll change the question title to be more specific. But failing that, I'd like commands I can use to diagnose what's failing where.
(if I broke your up key with the above command, type :unmap <Up>)
The issue probably is with your terminal [settings].
What you can do to troubleshoot is trying to literally insert the keys received by Vim. In insert mode, type <C-V> followed by the (shifted) cursor key. For me (gnome-terminal with TERM=gnome-256color), I get these distinct values (so shifted cursor keys all work for me, yay):
" Up, S-Up, Down, S-Down
^[OA ^[[1;2A ^[OB ^[[1;2B
" Left, S-Left, Right, S-Right
^[OD ^[[1;2D ^[OC ^[[1;2C
If you see the same values for shifted and unshifted keys, your terminal doesn't distinguish between them, so Vim cannot, neither. The next step would then be to check your terminal settings / use a different terminal.
noremap :hsp :botright new
noremap :vsp :botright vnew
"Not an editor command: hsp"
I'm probably googling the wrong thing, but I can't find many results on aliasing vim commands. I can find tons of info about mapping keys to commands like my one for tabs:
noremap <C-t> :tabnew<CR>
But can't find commands mapped to other commands.
What you're doing is simulating a command with a mapping. You're saying that when you press the 4 keys :hsv in normal mode, it should type out the keys :botright new (which would need a <CR> to run, as others have said), but it's not actually making the command hsv. You could make an actual command with a user command (:h user-commands). These must start with a capital letter, though.
:command Hsp botright new
:command Vsp botright vnew
Now you can type :Hsp and hit enter to run the command botright new.
Did you try command abbreviation?
ca hsp botright new
ca vsp botright vnew
You will have to initialize the expansion of the abbreviation by hitting the space key afterwards. Depending on the global vim configuration, expansion also happens automatically just when enter is pressed.
with your same mapping, I cannot get the Not an editor command: hsp error message with my vim (v7.4).
Your mapping works fine, but you don't have <cr> at the end, so when you press :hsp in normal mode, your mapping will switch to commandline mode, and put the mapped command there, without executing it. You have to manually press Enter.
#XZS's answer works, but keep in mind that it is an abbreviation(ab), not a mapping. ab is not command aliases, it is not exactly same as mapping. For example, you have to press another key (like space) after hsp to trigger the ab. also, you cannot ab some special keys, this would be another limitation of ab.
There is c(nore)map for command mapping.
e.g. you could have:
cnoremap hsp botright new
with above line, as same as your original one, you have to manually press Enter, if you want it to be executed, you need add <CR> at the end of the line.
I think if I do this, I would create mapping.
Creating command alias can be tricky:
Using a simple cabbrev and/or cmap will cause expansions and mappings to fire in unexpected places like during searches with / and in the middle of filenames.
cmap's will have a visible delay in outputting to the screen which is why cabbrev is often used.
However there are a few ways to create a proper alias:
Create a command via :command.
e.g. command W w
command's first letter must be a uppercase letter
must supply -nargs, -bar, -complete, and -range options according to the needs of your alias
Expression :cabbrev to guard the abbreviation from expanding in in proper places.
expression mapping use the <expr> option
verify getcmdtype() is equal to :
verify the abbreviation is at the beginning of command line via getcmdline() or getcmdpos()
e.g. cnoreabbrev <expr> W getcmdtype() == ':' && getcmdline() ==# 'W' ? 'w' : 'W'
Use :Alias via the cmdalias.vim plugin by Hari Krishna Dara
e.g. Alias W w
uses an expression cabbrev under the covers similar to the technique above