I want to map a key where pressing down shift+command and hit enter to insert blank line above the current line.How can I make it work? Currently I have this.
nmap <S-Enter> O<Esc>j
I am using MacVim
Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl (named Command on Mac) + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8
But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim release.
Related
I am having a problem mapping Ctrl-# to a new command, it keeps executing the default # (searching backwards for word under cursor), the line I have in my .vimrc is:
map silent <c-#> :lnext<CR>
Is there something I am missing, is # handled specially in vim?
Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8
But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim release.
Here is the relevant piece of vimscript:
inoremap <c-i> <i></i><esc>F<i
I added this to ~/.vim/ftplugin/html.vim to make writing in italics easier. For some reason, whenever I'm in insert mode (even in a non-html file), and I press the tab key, I get <i></i> in my text. Any idea what could be wrong?
First off, you should be using inoremap <buffer> <c-i>... if you don't intend to infect non-HTML files.
Secondly, Ctrl-I and Tab are equivalent. AFAIK you can't map one without affecting the other. You might want to select a different mapping. See this question for more details.
Due to the way that the keyboard input is handled internally, you cannot map <Tab> / <C-I> separately, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8
But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim release.
I'm unable to remap Ctrl+' to go to the end of the line when in Insert mode. This line in my vimrc file doesn't work (doesn't seem to do anything at all):
inoremap <c-'> <end>
However, if I use other keys instead of the single quote, it works fine. For example, this works:
inoremap <c-e> <end>
Do I need to use a different syntax to use the single quote key in a key remapping like this?
Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8
But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.
Whenever I open vim, the first key that I press deletes things. It thinks that 'd' has been pressed, so if I type 'j' it deletes the first two lines and if I press 'G' it'll delete everything. I checked my .vimrc and by selectively commenting-out sections it appears to be this line:
nnoremap <C-[> gT
...but I don't see how that would cause it...?
<C-[> (or ^[) is the same as <Esc>, an important key. Especially in the terminal, the sending of input keys and the control of the screen is based on it ("ANSI Escape sequences"). (This is less an issue in GVIM, which has its own implementations for that.) Therefore, that key must not be mapped! Choose a different one. (Also not as part of a mapping (e.g. <Esc>x), because that will cause delays while Vim is waiting for other keys.)
Due to the way that the keyboard input is handled internally, Vim currently cannot distinguish between <C-[> and <Esc>. Also, some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8
But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.
Attempting to add a normal mode mapping in vim for Control + Enter to insert line break above cursor positon
:nmap <C-CR> O<Esc>
I am finding this does not work - what am I missing here?
This is probably based on your terminal rather than vim. You can tell what key your terminal sends by <C-Enter> via C-V C-Enter. Most likely this is a newline which you can use as <NL> in vim.
:nmap <NL> O<Esc>
Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today; though this particular mapping should work in GVIM, but not in most terminals. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals.
But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.