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.
Related
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.
Every time I switch back to vim window, it shows the list, if current cursor on an empty line, it shows error: E349: No identifier Under Cursor.
The only workaround for this problem that I've discovered so far was to run tmux and then run vim inside one of tmux's panes.
According to https://unix.stackexchange.com/a/480138 ,
it is the FocusIn/FocusOut mode that can be disabled with:
echo -ne '\e[?1004l'
I encountered this problem when I would lose an ssh connection, so tmux on the remote server that enabled FocusIn/FocusOut mode would not be able to disable it. If I opened a vim on my local machine, vim would receive those events. If the FocusIn/FocusOut mode is not the default for your terminal, you can also disable it with:
reset
That list looks a lot like the output of :ilist! Plugin or [I with the cursor on Plugin or ]I with the cursor on the first Plugin. See if you don't have that somewhere in your vimrc (that you should append to your question, by the way).
The error message is likely caused by :help gd or :help gD.
It caused by the wincent/terminus plugin.
Fixed
Append let g:TerminusFocusReporting=0 to .vimrc
Alt-tabbing into Terminal sends a ^] command to VIM. To ignore that command, put
nnoremap ^] <Nop>
in your .vimrc file
I had to fix by removing the line set ttymouse= from my .vimrc.
You may need to set ttymouse to an appropriate value, see :h ttymouse.
I appeared in the 3.12 version of iterm2, and now it disappears after upgrading to 3.15
I am trying to map the '-' key to move a line down
in my vimrc I have
noremap - :m .+1 <cr>
but the carriage return is ignored and displayed in the terminal as <cr>
After reading Vim ignores <cr> i tried adding an additional <cr> but that just echoes the characters twice.
So after pressing the '-' key I have to physically press the <enter> key to get the command to run.
I have tried this in mac and linux and get the same results.
It works if I set nocp.
I haven't come across any instructions that this must be set for <cr> to work.
So this is the issue.
set nocp is set if a vimrc is detected.
if you are testing a custom vimrc and starting vim with vim -u mycustomvimrc then despite the fact it is loading a vimrc file it does not set nocp and maintains backward compatibility. In such cases you need to set nocp explicitly.
Thanks for all the suggestions to get this resolved.
Accidentally I typed vim -y install python-requests instead of yum ... and I do not know how to exit from vim now. Standard option with shift + : + q! does not work. Are there any options how to exit from vim without killing it?
With -y (easy mode), Vim defaults to insert mode, and you cannot permanently exit to normal mode via <Esc>. However, like in default Vim, you can issue a single normal mode command via <C-O>. So to exit, type <C-O>:q!<CR>.
Alternatively, there's a special <C-L> mapping for easy mode that returns to normal mode.
-y option makes vim start in easy mode, you can type CTRL-L to return to normal mode and then type :q! to exit.
I use the gVim Easy, and it works for me to add the set im! in the .gvimrc.
gVim Easy v.s. gVim
It's good to remember that vim and vim -y (gVim Easy) are almost identical except for these differences:
vim starts out in NORMAL mode; vim -y starts out in INSERT mode.
Esc, Ctrl-[, and Ctrl-C exit INSERT mode in vim. However, these do not work in vim -y. Instead, these have been replaced with Ctrl-L.
And it's good to remember this important similarity as well:
In INSERT mode, both vim and vim -y will allow you to use the Ctrl- commands that work during INSERT mode. Examples include:
Ctrl-T to indent the current line.
Ctrl-D to dedent (that is, un-indent) the current line.
Ctrl-N and Ctrl-P to auto-complete the word currently being typed.
Ctrl-R x to paste the contents of register x where the cursor is.
and, relevant to this thread:
Ctrl-O to temporarily enter NORMAL mode to issue one NORMAL-mode command (after which you'll immediately return to INSERT mode).
Hopefully you'll see that this last one (the Ctrl-O command) will allow you to save (with :w), save-and-quit (with :wq), discard unsaved changes (with :e!), as well as simply quit-without-saving (with :q!).
You can also use Ctrl-O followed by a non-ex command, like u (for "undo"), dd (to delete the current line), ZZ (to save-and-quit), and ZQ (to quit-without-saving).
So if you're not familiar with using Ctrl- commands in vim's INSERT mode, I strongly recommend learning at least the Ctrl-O command, as remembering that will help you figure out how to exit (and save documents in) vim -y. (While knowledge of Ctrl-L will help with vim -y, knowledge of Ctrl-O will help in both vim -y and vim.)
Key Takeaways
If there are only two things you remember from this post, remember these:
vim's normal way of exiting INSERT mode (that is, Esc, Ctrl-[, and Ctrl-C) have been replaced with Ctrl-L in vim -y (Vim Easy).
The INSERT mode command of Ctrl-O works just as well in vim -y (Vim Easy) as it does in vim. So you can use it to your advantage to execute any NORMAL commands you want.
I input :map! <C-q> :q <CR> in command line mode, then return to normal mode, and press ctrl-q, but vim does not quit. Why?
As Johnsyweb suggested, Ctrl-Q does not reach Vim in the first place. This holds for the popular Ctrl-S as well. Both can be fixed by adding
silent !stty -ixon > /dev/null 2>/dev/null
to your .vimrc as it forces these control sequences to reach the application.
Why anyone would want to add yet another way of quitting Vim to the plethora already available is beyond me. However...
On Fedora 15, Ctrl-Q is likely being captured by your terminal as XON (resume) and therefore not reaching Vim to quit the application.
You can check if there's an error in your mapping or a clash like so:
:verbose map! <C-Q>
:map! is for specifing mappings in insert and command-line modes.
normal-mode mappings are (usually) specified like so:
:nmap <C-Q> :q<CR>