.rb
我很高兴使用不同的缓冲区和出色的 vim 插件Ctrlp编辑一些 文件。但是,当我重新打开特定文件时,出乎意料的是,micropost.rb
所有自动缩进和语法突出显示都不起作用。
我很确定这与我.micropost.rb.swp
在打开 Vim 之前删除它(即相应的交换文件)这一事实有关。并且交换文件中存在某种遗留物。
现在,即使我 1)备份文件 2)micropost.rb
从头开始编写。没有检测到.rb
文件。
但是请注意,如果我开始在新文件中编写相同的代码,例如picopost.rb
,一切都会按预期工作。
编辑 1,这是我的.vimrc
:
execute pathogen#infect()
set runtimepath^=~/.vim/bundle/ctrlp.vim
syntax on
filetype plugin indent on
set number
"" ADD A line to diferently indented blocks of code
set list lcs=tab:\|\
let mapleader=","
" Fast saving
nmap <leader>w :w!<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
"set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
" a combination of spaces and tabs are used to simulate tab stops at a width
" other than the (hard)tabstop
set softtabstop=4
""CTRLP mappings
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i use
hi Folded ctermbg=darkgrey
"Autosave folding state at quit
au BufWinLeave * mkview
au BufWinEnter * silent loadview
""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""
" Always show the status line
set laststatus=2
" Format the status line
"set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
"set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
"
"Splits configuration
set splitbelow
set splitright
"Max out the height of the current split ------ ctrl + w _
"Max out the width of the current split------ ctrl + w |
"Normalize all split sizes, which is very handy when resizing terminal-------- ctrl + w =
"Swap top/bottom or left/right split ------ Ctrl+W R
"Break out current window into a new tabview ---------- Ctrl+W T
"Close every window in the current tabview but the current one ------- Ctrl+W o