歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Vim配色方案設置(更換Vim配色方案)

Vim配色方案設置(更換Vim配色方案)

日期:2017/2/28 15:32:58   编辑:Linux教程

(1)安裝vim後,執行命令

whereis vim

你會看到返回結果:vim: /usr/bin/vim /usr/share/vim /usr/share/man/man1/vim.1.gz

注意:/usr/share/vim 為vim為用戶提供的共享數據或設置方案選擇

(2) 在你的家目錄下創建.vimrc

set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set cindent
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
set expandtab

(3)增加配色方案

首先查看你的系統中自帶的有哪些,從(1)中我們知道執行命令 ls -l /usr/share/vim/vim70/colors/

可以看到

-rw-r--r-- 1 root root 2588 2011-03-06 blue.vim
-rw-r--r-- 1 root root 2809 2011-03-06 darkblue.vim
-rw-r--r-- 1 root root 548 2011-03-06 default.vim
-rw-r--r-- 1 root root 2399 2011-03-06 delek.vim
-rw-r--r-- 1 root root 2812 2011-03-06 desert.vim
-rw-r--r-- 1 root root 1666 2011-03-06 elflord.vim
-rw-r--r-- 1 root root 2476 2011-03-06 evening.vim
-rw-r--r-- 1 root root 3238 2011-03-06 koehler.vim
-rw-r--r-- 1 root root 2460 2011-03-06 morning.vim
-rw-r--r-- 1 root root 2006 2011-03-06 murphy.vim
-rw-r--r-- 1 root root 1037 2011-03-06 pablo.vim
-rw-r--r-- 1 root root 2673 2011-03-06 peachpuff.vim
-rw-r--r-- 1 root root 2174 2011-03-06 README.txt
-rw-r--r-- 1 root root 1239 2011-03-06 ron.vim
-rw-r--r-- 1 root root 2720 2011-03-06 shine.vim
-rw-r--r-- 1 root root 2419 2011-03-06 slate.vim
-rw-r--r-- 1 root root 1627 2011-03-06 torte.vim
-rw-r--r-- 1 root root 1840 2011-03-06 zellner.vim


所以我們知道配色方案的名字有morning,evening,desert等等,

如果我們想要將配色方案改為evening,那麼我們只需要在.vimrc中增加一行 colorscheme evening即可。

(4)如果覺得配色方案太少,可以從外部下載配色方案,這裡給出一個網址:

http://vimcolorschemetest.googlecode.com/svn/colors/

你可以使用工具wget下載下來,然後將.vim的文件放入/usr/share/vim/vim70/colors/目錄下,然後更改.vimrc即可生效。

Copyright © Linux教程網 All Rights Reserved