vim expandtab在新安装后无法运行

时间:2016-04-05 14:44:32

标签: python vim indentation

let mapleader = "," 

set number

set textwidth=79  " lines longer than 79 columns will be broken
set shiftwidth=4  " operation >> indents 4 columns; << unindents 4 columns
set tabstop=4     " a hard TAB displays as 4 columns
set expandtab     " insert spaces when hitting TABs
set softtabstop=4 " insert/delete 4 spaces when hitting a TAB/BACKSPACE
set shiftround    " round indent to multiple of 'shiftwidth'
set cindent       " align the new line indent with the previous line

set nobackup
set nowritebackup
set noswapfile

vnoremap < <gv " continue visual selecting after shiftwidh
vnoremap > >gv 

nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

nnoremap j gj
nnoremap k gk

nnoremap <Leader>r :w \| !clear && ./%<CR>
command W w !sudo tee % > /dev/null
noremap <silent><Leader>/ :nohls<CR>

set clipboard=unnamedplus
set paste
set ignorecase

在重新安装我的arch linux之后,vim stoped work poperly。 在做了同样的事情后,我几天前用旧系统做了 - 现在python抱怨缩进。

我没有安装插件或其他什么,为什么会破坏?

P.S。已经看过相同的静止,但它们是关于插件,我没有。 附:注意到: vim根据cindent

赢得了新行后

:set paste之后仍有压痕。为什么会这样?

1 个答案:

答案 0 :(得分:1)

set paste&#34;休息&#34;缩进。就是这样。这就是它起作用的原因。将文本粘贴到Vim中通常与键入每个字母相同。例如,打开一个文件中包含一些文本(在Vim中),并确保Vim处于正常模式。复制以下文字:d4dAhowdy。将其粘贴到Vim中。您将看到它删除了四行(d4d),更改了行末尾的插入模式(A)和类型howdy。粘贴到Vim与输入字母是一回事;它并不一定只是粘贴所有内容。让我们说你输入:

if this:
that

if this:之后按Enter键,Vim会缩进该行,因此代码实际上会显示为:

if this:
    that

使用set paste将其关闭,以便在粘贴该代码时(包含缩进),Vim不会自动缩进,一切都会正常显示。如果您要set nopaste然后粘贴上面的 un 缩进代码,Vim会为您缩进。

相关问题