在Vim中,如何用换行符打破一行文字?
例如,我处于INSERT
模式,我想从这里开始......
$('#toggle_contact_search_mode').click([CURSOR IS HERE]);
到这里......
$('#toggle_contact_search_mode').click(
[CURSOR IS HERE]
);
我得到的结果是,当我处于插入模式时,我将光标放在上面的第一个位置,然后点击返回...
$('.edit_phone_number').ajaxForm({
success: function(response) {
$('input, select, textarea', '.edit_phone_number').removeClass('updating');
}
});
$('input, select, textarea', '.edit_phone_number').focus(function(event) {
$(event.target).removeClass('updating').addClass('focussed');
});
我根本不想重新格式化。我只是希望Vim只需输入换行符并保持插入模式。
更新
当我暂时删除.vimrc
文件时,Vim会按预期运行。我的.vimrc
:
" ==================================================================================
" Global stuff
" ==================================================================================
" Prevent Vim from emulating vi bugs and limitations
:set nocompatible
" Custom status line based on one from here:
" http://www.linux.com/archive/feature/120126
:set statusline=\ \ %f\ \ [FORMAT=%{&ff}]\ \ [TYPE=%Y]\ \ [POS=%04l,%04v][%p%%]\ \ [LEN=%L]
" Set status line colors
highlight StatusLine term=reverse ctermfg=DarkBlue ctermbg=Grey
" Set status line to be shown above the command buffer.
:set laststatus=2
" Enable syntax highlighting
:syntax on
" Enable line numbering, taking up 6 spaces
:set number
" Allow <BkSpc> to delete line breaks, beyond the start of the current
" insertion, and over indentations
" set backspace=eol,start,indent
" ==================================================================================
" Searching
" ==================================================================================
" Highlight matches as you type in the search string
:set incsearch
:set showmatch
" When searching ignore case (except explicit caps)
:set ignorecase
:set smartcase
" ==================================================================================
" Indenting
" ==================================================================================
" Copy indent from current line when starting a new line
" :set autoindent
"
" :set smartindent
" :filetype plugin on
" indent depends on filetype
" :filetype indent on
:set tabstop=2
:set softtabstop=2
:set shiftwidth=2
:set expandtab
" ==================================================================================
" Mappings
" ==================================================================================
" ESC
imap <C-k> <ESC>
" Go to the next tab
nmap <C-j> gt
imap <C-j> <ESC>gt
" Auto indent entire file.
" Sets a mark ("mt""), moves across the whole file to indent it ("gg=G"),
" then returns to the mark ("'t").
nmap <C-m> mtgg=G't
imap <C-m> <ESC><C-m>
答案 0 :(得分:6)
你的问题是imap <C-m>
映射 - control-M在逻辑上等同于在终端上输入。
答案 1 :(得分:1)
好像你.vimrc中的imap线条让你搞砸了。使映射在插入模式下工作似乎很奇怪,只是为了使它能够执行正常模式映射。你确定你实际上想要发生这种情况吗?我建议考虑删除最后两条imap线(c-j和c-m),看看你是否注意到它们已经消失了。
答案 2 :(得分:0)
我不知道VIM但是Ctrl + M在记事本中有效 - 您可以尝试一下。