With gvim, I can map <C-LeftMouse>, but I can't with vim running inside a terminal emulator (konsole in my case).
I have reasons to think it's because the sequence Ctrl + CLICK is not sent/detected :
in insert mode, typing Ctrl + V, Ctrl + CLICK prints "" with gvim, but only "" with konsole.
how to make vim / neovim to recognize this (useful) combination ?
EDIT Note that I already set mouse=a in vim
in the terminal you have to enable the mouse:
set mouse=a
map <C-LeftMouse> :echo 'Hello Left'<CR>
map <C-RightMouse> :echo 'Hello Right'<CR>
see :help mouse
Related
I can yank a visual selection into the X clipboard in vim using "+y - I would like to map this to something more convenient. I tried mapping to Ctrl-y by adding
:vmap <C-y> \"+y to my .vimrc but it doesn't work. How can I do this?
In ~/.vimrc add:
vnoremap <C-y> "+y<Esc>
or Ctrl-Shift-y:
vnoremap <C-S-y> "+y<Esc>
Make sure that your terminal does not already use that shortcut. For Gnome terminal see this.
Tip: if using default Gnome terminal shortcuts, paste that C-y yanked chars with: C-S-v in terminal or just C-v elsewhere.
The problem was that I was escaping the " character. This, it seems, is wrong in this context. simply:
:vmap <C-y> "+y
works, as expected.
My shell is tcsh. I'm using vim in tmux with konsole. When I type backspace in insert mode it inserts ^?. This only happens in tmux. In konsole settings the backspace input is set to \b. I try changing it to \x8 and there is no change. fixdel doesn't help, set bs=2 in .vimrc doesn't work. I don't use setty anywhere, nor do I change the tmux keybindings. Any help? Please?
Just try :set backspace=indent,eol,start. Then, check your backspace. If this works, just put this line in your vimrc.
This works for me with Vim+tmux; I don't use Konsole or tcsh, so I can't confirm that those won't break it, but I'd be very surprised if those did.
I want to remap the Ctrl + y command in vim (scroll up command) to Ctrl + q.
I tried to do
:map <C-q> <C-y>
But it does not seem to work...
Do you have any suggestion ?
Does this only affect the Linux terminal (not GVIM), and also Ctrl + S? Then, you need to disable the terminal's flow control commands, by putting the following into your ~/.bashrc:
stty start undef stop undef
PS: You should use :noremap; it makes the mapping immune to remapping and recursion.
When I create the following key mapping via the command buffer it works as expected moving the cursor 5 lines down:
map ^[[1;3B 5<Down>
When I add it to my .vimrc file so that it works across sessions, pressing Alt+Down moves backwards 1 line (to somewhere not vertically above - maybe it's going to a previous sentence). My :map output is this:
0 ^
^[[1;3B 5<Down>
n gx <Plug>NetrwBrowseX
n <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR>
Press ENTER or type command to continue
Why doesn't this vimrc mapping work similarly to what I type in the command buffer?
My version of vim is:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 10 2014 00:22:49)
Included patches: 1-135
Compiled by <cygwin#cygwin.com>
UPDATE
There are 2 issues.
my version of Vim doesn't understand map <M-Down> 5<Down> but does understand map <M-Down> 5j
Something in my .vimrc file prevents map <M-Down> 5j from working. I had to put a bunch of hacks in to get "normal" vim behavior in my Cygwin environment:
"==================
" Keyboard trouble
"=================
" Every so often I am using a system that inserts a A, B, C, or D
" when using the arrow keys within the Vim editors insert mode.
" Vim is for VI Improved. While I did not dig into the exact reasons
" as to why (terminal emulation?) it happens, it is quite annoying.
set nocompatible
"set term=cons25
" This fixes Cygwin's vim's page up, home, end etc. keys
" http://superuser.com/questions/480215/
" how-to-map-pagedown-and-pageup-keys-to-function-normally
set term=mintty
set backspace=2 " backspace on Cygwin Windows Objy was not deleting properly.
" But this doesn't solve other cursor movements like
"home and end
"source /home/sarnobat/.vim/cscope_maps.vim
"g:CCTreeCscopeDb = "/home/sarnobat/cscope/cscope.files"
"==============================
" Key bindings
"==============================
map 0 ^
I don't understand those characters: ^[[1;3B. In vim you can choose the Alt key as letter M and the arrow letter as down, so:
map <M-down> 5<Down>
will work in either command-line and from your vimrc file.
you could try the following:
map <M-down> 5j
Tried it on cygwin and it worked. hjkl is the preferred method of navigating left, down, up and right.
The following command in vimrc works well for vim in my ubuntu os,
:map 11 :tabnext 1<CR>
,while in my CentOS system, i entered '11', it returns:
, i have to delete '<CR>', and then enter the "Enter" key to jump to tab 1;
All the '<CR>' in vimrc doesn't work, it seems the vim can't recognize '<BR>' as "Enter" KEY, anyone help me?
Try to replace <CR> with Ctrl + VEnter.
It looks like your CentOS system starts Vim in Vi-compatible mode. To be exact, the < flag in 'cpoptions' seems to be set.
Try launching Vim via vim -N or by putting set cpo-=< before the mapping definition. If this fixes the issue, you probably want to permanently disable Vi-compatible mode, by putting set nocompatible at the top of your .vimrc.