2017-12-14 4 views
1

私はvimrcをどうやって壊したのか分かりませんが、私は持っています。私はソラリゼーションをインストールしましたが、シンタックスハイライトは自動的には機能しなくなりました。エディタを開くたびに「シンタックスイネーブル」を再入力する必要があります。"syntax enable"は、vimrcではなく、通常のモードでのみ動作します。

私のvimrcは以下の通りです。

" ----- BASICS ----- 
set nocompatible "compatible with vi 
if !exists("g:syntax_on") 
    syntax enable 
endif 

filetype on "QS not sure about this one ! 
set number "add line numbers 
set showcmd "show command in bottom bar 
set cursorline "highlight cursor line 
set wildmenu "commandline tab completion 
set mouse=a "make vim useable with mouse 
set backspace=indent,eol,start " make backspace work like in most editors. 
set showmatch   " highlight matching [{()}] 

" ----- COLORSCHEME ----- 
let g:solarized_termcolors = 256 
set background=light 
colorscheme solarized 

    " ------ NAVIGATION ----- 
" long line navigation in normal mode 
nnoremap j gj 
nnoremap k gk 

" ------ TABS & SPACES ----- 
set tabstop=4  "number of visual spaces per TAB 
set shiftwidth=4 "size of indent with tab 
set softtabstop=0 
set noexpandtab "if you are using tab character inside your source 
"code - these are defensive settings to avoid conversion 

" ---------Searching ---------- 
set incsearch   " search as characters are entered 
set hlsearch   " highlight matches 

" ----------Folding ----------- 
set foldenable   " enable folding 
set foldlevelstart=10 " open most folds by default 
set foldnestmax=10  " 10 nested fold max 
nnoremap <space> za  
"space open/closes folds 
set foldmethod=indent " fold based on indent level 

set smartindent   " indents your code automatically 
filetype off     " required 
+0

256色をサポートするターミナルエミュレータを使用していますが、カスタムソラリゼーションターミナルカラーを使用したくないですか? –

+0

':verbose set syntax'とは何ですか? –

答えて

1

~/.vimrcの最後の行は、ファイルタイプの検出を無効にします。これがなければ、Vimは開いているすべてのファイルをプレーンテキストとして扱います。そのため、シンタックスプラグインはロードされません。その行を落とす、それは意味をなさない。

filetype off     " required 

すべてをオンにし、むしろ、内蔵ファイルタイプとインデントプラグインから利益を得るために:

filetype plugin indent on 

詳細について:help :filetypeを参照してください。

+0

どうもありがとうございます - どうして私はそこに投げ込んだのですか? – banbourg

+0

喜んで私は助けることができました。それを完全に理解することなく、他の場所から構成を組み込むことは常に危険です。 (私もこれで焼けた!) –

関連する問題