【问题标题】:My terminal's indentation is not working properly我的终端缩进无法正常工作
【发布时间】:2013-07-02 21:35:02
【问题描述】:

我是mac用户。当我在 termianl 中使用 Vim 时,自动缩进根本不起作用。
缩进仅在我通过下一行手动进入时才有效。

我已经应用了 autoindent,像这样的 cindent。这是我的 .vimrc 代码。我真的需要你的帮助。

  1 " 환경설정                                                              
  2 syntax on
  3 
  4 set nu
  5 set hi=100
  6 set ru
  7 set mps+=<:>
  8 set backup
  9 syntax enable
 10 colorscheme desert
 11 set history=50
 12 set visualbell
 13 set noerrorbells
 14 set loadplugins
 15 
 16 set encoding=utf-8
 17 set fileencodings=utf-8,cp949,default,latinl
 18 set termencoding=utf-8
 19 set printencoding=utf-8
 20 set printmbcharset=ISO10646
 21 
 22 " Editing
 23 set paste
 24 set tabstop=4
 25 set softtabstop=4
 26 set shiftwidth=4
 27 set showmatch
 28 set autowrite
 29 set autoindent
 30 set cursorline
 31 set showcmd "show commandline
 32 set title "show title
 33 set statusline=\ %<%l:%v\ [%P]%=%a\ %h%m%r\ %F\     " 다중 문서 작업을 >>
    위한 Status 줄
 34 set km=startsel,stopsel "shift키로 선택 영역 만들기 허용
 35 " 영역 상태에서 ctrl+f, b 로 이동하면 영역 해제
 36 

 37 set smartindent
 38 set expandtab
 39 set cindent
 40 set autoindent
 41 set textwidth=80 " if it is over 80 char
 42 set wrap " then it warped next line
 43 set nobackup
 44 set shiftwidth=4 "autoindent at 4 line
 45 set ignorecase " no large-small character difference when it is searched
 46 set laststatus=2
 47 
 48 " window
 49 set ruler   "show cursor position
 50 
 51 " macro
 52 map <F2> :tabnew<CR>
 53 map <F4> :w<CR>
 54 
 55 " c 파일의 경우 Makefile이 없으면 gcc를 불러줌
 56 au BufRead,BufNewFile *.c
 57 \ if !filereadable("Makefile") && !filereadable("makefile") |  
 58 \ set makeprg=gcc\ %\ -o\ %< | 
 59 \ endif 
 60 
 61 " cpp 파일의 경우 Makefile 이 없으면 g++를 불러줌
 62 au BufRead,BufNewFile *.cpp
 63 \ if !filereadable("Makefile") && !filereadable("makefile") |  
 64 \ set makeprg=g++\ %\ -o\ %< | 
 65 \ endif 
 66 
 67 " java 파일의 경우 Makefile 이 없으면 javac를 불러줌
 68 au BufRead,BufNewFile *.java 
 69 \ if !filereadable("Makefile") && !filereadable("makefile") |  
 70 \ set makeprg=javac\ %  |
 71 \ endif
 72 
 73 " 지난번 편집했던 곳으로 Jump
 74 au BufReadPost *
 75 \ if line("'\"") > 0 && line("'\"") <= line("$") |
 76 \   exe "normal g`\"" |
 77 \ endif 

【问题讨论】:

  • 虽然这与您的问题无关,但您可能需要清除 vimrc 中的所有重复项 (autoindent shiftwidth etc.)。另外,smartindent 没有任何用处,应该删除,我建议您添加filetype plugin indent on。见:help :filetype
  • 好的。谢谢罗马。

标签: vim terminal vi indentation


【解决方案1】:

删除set paste。粘贴模式将有效地禁用缩进。

【讨论】:

猜你喜欢
  • 2021-05-07
  • 1970-01-01
  • 2015-09-02
  • 2017-06-13
  • 2020-02-15
  • 1970-01-01
  • 2020-11-06
  • 2016-11-23
  • 1970-01-01
相关资源
最近更新 更多