[英]vim expandtab doesn't work after new installation
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突然停止工作。 經過幾天前我對舊系統所做的相同操作后,現在python抱怨縮進。
我沒有安裝任何插件,為什么會這樣呢?
PS已經查看過相同的問題,但它們與插件有關,而我沒有。 PS注意:之后:
vim不會根據cindent
啟動換行符
:set paste
之后,仍然沒有壓痕。 為什么會這樣?
set paste
“中斷”縮進。 這就是全部。 這就是它起作用的原因。 將文本粘貼到Vim中通常與輸入每個字母相同。 例如,打開一個包含一些文本的文件(在Vim中),並確保Vim處於正常模式。 復制以下文本: d4dAhowdy
。 將其粘貼到Vim中。 您將看到它刪除了四行( d4d
),在行尾( A
)更改為插入模式,然后鍵入howdy
。 粘貼到Vim中與輸入字母相同。 它不一定只是完全粘貼所有內容。 假設您輸入:
if this:
that
if this:
按Enter鍵, if this:
Vim會將行縮進,因此該代碼實際上將顯示為:
if this:
that
使用set paste
將其關閉,以便在粘貼該代碼(包括縮進)時,Vim不會自動縮進,並且一切都可以正常顯示。 如果要set nopaste
然后粘貼上面未縮進的代碼,Vim會為您縮進它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.