Chinaunix首页 | 论坛 | 博客
  • 博客访问: 268012
  • 博文数量: 45
  • 博客积分: 930
  • 博客等级: 准尉
  • 技术积分: 553
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-22 17:53
文章分类

全部博文(45)

文章存档

2013年(5)

2012年(40)

分类: LINUX

2012-07-21 08:00:43

把下面的文件保存为Linux主文件夹的".vimrc"文件(不同的Linux版本略有不同,ubuntu下是.vimrc),就可以把vim打造成一把利器!

点击(此处)折叠或打开

  1. " This is my _vimrc under windows platform
  2.  " and it can be used on *nix too
  3.  " all the difference of them is the font setting session
  4.  " happy Viming,
  5.  " copyLeft (#) Abruzzi John
  6.      
  7.  set linebreak " line break
  8.  set nocompatible " no compatible
  9.  set history=400 " history
  10.  set ruler
  11.  set number " line number
  12.  set hlsearch " highlight search
  13.  set noincsearch " no in C search
  14.  set expandtab " expand table
  15.  set t_vb= "close bell
  16.  set foldmethod=marker
  17.  set tabstop=4 " table step
  18.  set shiftwidth=4
  19.  set nobackup " don't backup
  20.  set smarttab " smart table
  21.  set smartindent " smart indent
  22.  set autoindent " auto indent
  23.  set cindent "cindent
  24.  set cursorline " hightlight cursor line 高亮光标所在行
  25.      
  26.  " set the back space
  27.  set backspace=indent,eol,start "这行比较重要,刚接触vim的朋友会发现有时候backspace键删不了文字
  28.    
  29.  colorscheme desert " color scheme
  30.      
  31.  let Tlist_Use_Right_Window=0 " for tag_list plugin only
  32.  let Tlist_File_Fold_Auto_Close=1 " for tag_list plugin only
  33.      
  34.  let g:winManagerWindowLayout="FileExplorer|TagList" " for winmanager
  35.      
  36.  filetype plugin indent on " filetype setting
  37.  set completeopt=longest,menu " for code complete
  38.      
  39.  " the following function is used for show the status bar on the buttom
  40.  function! CurrectDir()
  41.      let curdir = substitute(getcwd(), "", "", "g")
  42.      return curdir
  43.  endfunction
  44.  set statusline=\ [File]\ %F%m%r%h\ %w\ \ [PWD]\ %r%{CurrectDir()}%h\ \ %=[Line]\ %l,%c\ %=\ %P
  45.      
  46.  " this is a setting of font
  47.  if has("win32")
  48.      set guifont=Courier_New:h10:cANSI
  49.  endif
  50.      
  51.  " make sure that syntax always on
  52.  if exists("syntax_on")
  53.      syntax reset
  54.  else
  55.      syntax on
  56.  endif
  57.      
  58.    
  59.  " java complete
  60.  if has("autocmd")
  61.      autocmd Filetype java setlocal omnifunc=javacomplete#Complete
  62.  endif
  63.    
  64.  """"""""""""""""""""""""""""""""""""""""""""""""""""""
  65.  let performance_mode=1
  66.    
  67.  function MySys()
  68.      if has("win32")
  69.          return "win32"
  70.      elseif has("unix")
  71.          return "unix"
  72.      else
  73.          return "mac"
  74.      endif
  75.  endfunction
  76.    
  77.  if MySys() == "unix" || MySys() == "mac"
  78.      set shell=bash
  79.  else
  80.      " set win32 shell
  81.  endif
  82.    
  83.  " set auto read when file is changed from outside
  84.  if exists("&autoread")
  85.      set autoread
  86.  endif
  87.    
  88.  " enable the mouse
  89.  if exists("&mouse")
  90.      set mouse=a
  91.  endif
  92.    
  93.  " set mapleader
  94.  let mapleader=","
  95.  let g:mapleader=","
  96.    
  97.  "fast saving
  98.  nmap x :xa!
  99.  nmap w :w!
  100.    
  101.  "switch to current directory
  102.  map <leader>cd :cd %:p:h<cr>
  103.    
  104.  " just for fun
  105.  map ggVGg?
  106.    
  107.  " folding code
  108.  if exists("&foldenable")
  109.      set fen
  110.  endif
  111.    
  112.  if exists("&foldlevel")
  113.      set fdl=0
  114.  endif
  115.    
  116.  " tag list --
  117.  map :Tlist
  118.    
  119.  "remove the windows ^M windows系统中常常可以看到文本中夹杂着^M这样的控制字符,用此命令删除之
  120.  noremap <leader>m :%s/

阅读(1678) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~