終極vim配置

1、前言                                    html

  愛漂亮之心人皆有之,sublime的配色實在好看,因而但願Vim也能這樣。git

 

2、配置                                    github

 1.下載monokai(https://github.com/sickill/vim-monokai),而後將Monokai.vim保存到~/.vim/colors下;vim

 2.配置~/.vimrc文件,添加 syntax enable 、 colorscheme Monokai 兩行。個人~/.vimrc文件以下bash

複製代碼

set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese,cp936
set guifont=Consolas:h15
language messages zh_CN.utf-8
set lines=45 columns=100
set number
set autoindent
set smartindent
set tabstop=4
set autochdir

set shiftwidth=4
set foldmethod=manual

syntax enable
colorscheme Monokai
set nocompatible
set nobackup

複製代碼

 

3、參考                        app

http://calefy.org/2012/10/30/the-config-of-my-vim.htmlui

 

 

 

[plain] view plaincopyspa

  1. find `pwd` -name "*.[ch]" -o -name "*.cpp" > cscope.files  
  2. cscope -bR -i cscope.files  

上述命令中使用`pwd`取得絕對路徑名,以防止使用cscope時出現找不到文件的狀況;.net

 

命令cscope中的-i參數能夠去掉,由於cscope缺省就是從當前目錄的cscope.files中查找文件列表。htm

 

還有一個簡潔的辦法實如今當前目錄下創建cpp文件和c文件混合的cscope.out;

在~/.bashrc中添加以下alias:

  1. alias mkcscopefile='find `pwd` -name "*.[ch]" -o -name "*.cpp" > cscope.files'  
  2. alias mktag='ctags -R;cscope -bR'  

而後,在terminal中source ~/.bashrc,就可使用mkcscopefile;mktag命令來生成cscope.out和tags文件了。

若是路徑中含有空格,須要使用sed對生成的cscope.files文件進行處理,命令:

sed -i ‘s/^/"/;s/$/"/' cscope.files

 

from: http://blog.csdn.net/david_xtd/article/details/7737653

 

實時顯示當前的目錄:

1.  非實時顯示即正常模式下可執行命令: :f  或 CTRL+G
2.  實時顯示,請編輯%VIMRUNTIME/vimrc, 增長以下代碼:
 

    " 狀態欄     set laststatus=2      " 老是顯示狀態欄     highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue     " 獲取當前路徑,將$HOME轉化爲~     function! CurDir()         let curdir = substitute(getcwd(), $HOME, "~", "g")         return curdir     endfunction     set statusline=[%n]\ %f%m%r%h\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\ ascii=%b,hex=%b%{((&fenc==\"\")?\"\":\"\ \|\ \".&fenc)}\ \|\ %{$USER}\ @\ %{hostname()}\
相關文章
相關標籤/搜索