when I use Ctrl-W (or Ctrl-H) in insert mode it does nothing. In gvim with the same vimrc works. I'm using Ubuntu 10.4 with gnome, what may be wrong?
Try adding to your .vimrc: set backspace=indent,eol,start
Type this from normal mode:
:verbose mapC-vC-wEnter
This will tell you two things:
you will see what your terminal emits for C-w (it is shown on the vim command line before you press Enter)
it will tell you whether C-w has any mappings in any mode
it will tell you where the mapping comes from
Subsequently look at
:verbose iabbrev
to see whether abbreviations are in the way
just try type "i" or "a"
maybe you terminal has reserved these key binds?
Related
in my .vimrc I have the following
imap jj <ESC>
When I type jj however while in insert mode, instead of exiting insert mode VIM literally types <ESC> into my document. Hitting the escape button does take me from insert to command mode, as expected.
How do I remap jj to allow me to exit insert mode?
I am using vim 7.4 on Ubuntu 16.04
:help key-notation has this to say:
If you want to use the full <> notation in Vim, you have to make sure the '<'
flag is excluded from 'cpoptions' (when 'compatible' is not set, it already is
by default).
:set cpo-=<
This might have been accidentally set in your Vim session, and after a Vim restart the problem went away.
:set nocompatible worked for me. I think vi-compatibility mode may have been the problem.
I would like to bind CTRL-N in nvim's terminal mode to autocomplete, just like CTRL-N in insert mode. I don't know command what CTRL-N is bound to in insert mode, so I am not sure how to bind it to the same key in another mode. I am new to Vim and might be confused by emacs concepts here.
The vim completion only works in insertmode, its not possible to open the completion menu in other modes.
the terminal mode however does allow you to remap keys so to make <C-n> activate the shells completion system one would add to init.vim
tnoremap <C-n> <Tab>
this might however not be what you asked for.
your asumption is right your in terminal mode. The autocompletion feature of vim doesnt work in the terminal as its a special kind of buffer that can not be edited. There are plugins though that create a pseudo terminal where the completion menu can be used see
https://github.com/Shougo/vimshell.vim
Currently, when I press cursor-left in the command line in neovim (:whatever foo bar), the cursor will move over a whole word. Most of the time, I just want it to move one character.
This shouldn't be the default behaviour. It's probably a plugin or something you once added to your vimrc at some point. Try using :verbose cmap to see what it's set to (also see How do I debug my vimrc file?).
You should also be able to use :cnoremap <Left> <Left> to restore the default behaviour.
This has to do with putty and how it sends cursor keys. The trick is to find out what nvim actually sees, and then :cnoremap... accordingly.
The way to figure out what your nvim receives, is this:
enter input mode
hit ctrl-v
hit the key you want to see
Be aware that nvim behaves slightly differently than vim here: vim shows you the actual escape sequence, while nvim shows you the translated keys. The latter is a tad unfortunate.
In my case, for reasons I haven't figured out, nvim saw Ctrl-Left as , but Left as . Since I never need S-Left in the command line, :cnoremap <S-Left> <Left> did the trick.
Is there a default key for scrolling in insert mode? I know that I could just
:imap <F5> <ESC><C-e>a
:imap <F6> <ESC><C-y>a
but I'm wondering if there's any key binding there by default.
For completeness, there are two dedicated commands for scrolling in insert mode, CTRLXCTRLE and CTRLXCTRLY. They are probably the proper ones to map.
See the documentation here: :h i_CTRL-X_CTRL-E.
In normal mode CTRLE and CTRLY do the same thing, I use them quite often.
In insert mode, type Ctrl-o, then type zz.
It'll set current line in the middle of the screen.
Actually, you can type any command.
I would like to map ctrl+a in visual mode to select and copy all text from the current buffer.
The basic idea is to execute: %y* (copy all buffer to clipboard). So, the mapping should be: xmap :%y* (xmap for visual mode only)
However, whenever I run this mapping, this output is shown:
E492: Not an editor command: '<,'>%y*
And, I think Vim is right :-). When in visual mode, pressing the ":", makes the cmd-line show those surprising characters:
":'<,'>"
The only relevant piece of info where I could find this pattern ('<,'>) is that one: http://vimdoc.sourceforge.net/htmldoc/cmdline.html#v_:
(and it didn't help me).
Question: Am I doing something wrong (configuration...) ? Is there another answer to my need (copy all text to clipboard) ?
I am running Vim 7.3 and I only set nocompatible in my vimrc
Thanks for your help,
Tom
Use:
xnoremap <whatever> :<c-u>%y*<return>
The additional ctrl-u erases the command line till the cursor.
From vim reference:
*c_CTRL-U*
CTRL-U Remove all characters between the cursor position and
the beginning of the line. Previous versions of vim
deleted all characters on the line. If that is the
preferred behavior, add the following to your .vimrc: >
:cnoremap <C-U> <C-E><C-U>
Use the following mapping:
nmap <C-A> ggVGy
It yanks all the current file. By the way, I'm not sure it's exactly what you what. I don't understand why you want a visual mapping.