隨筆 - 67  文章 - 79  trackbacks - 0
          <2008年11月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456

          常用鏈接

          留言簿(1)

          隨筆檔案

          文章檔案

          相冊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          從網上東拼西湊的  沒多少是自己寫的  主要用來寫 python   使用pydiction來自動不全

          " ~/.vimrc
          "
           Last modified: Mon 27 Oct 2008 12:59:22 PM CST [zarra-desktop]
          "
           vim 配置文件

          " When started as "evim", evim.vim will already have done these settings.
          if v:progname =~"evim"
            finish
          endif

          " Use Vim settings, rather then Vi settings (much better!).
          "
           This must be first, because it changes other options as a side effect.
          set nocompatible
          set number
          " allow backspacing over everything in insert mode
          set backspace=indent,eol,start

          set autoindent          
          " always set autoindenting on
          if has("vms")
            set nobackup          
          " do not keep a backup file, use versions instead
          else
            set backup            
          " keep a backup file
            " 自動備份,我的備份大都在 ~/.backup 中,它好幾次都幫了我的大忙 :)
            set backupdir=./.backup,~/.backup,.,/tmp
          endif
          set history
          =50          " keep 50 lines of command line history
          set ruler               " show the cursor position all the time
          set showcmd             " display incomplete commands
          set incsearch           " do incremental searching

          " Don't use Ex mode, use Q for formatting
          "
           排版用的
          map Q gq

          " Switch syntax highlighting on, when the terminal has colors
          "
           Also switch on highlighting the last used search pattern.
          if &t_Co > 2 || has("gui_running")
            syntax on
            set hlsearch
          endif

          " 我常用的文本編碼 UTF-8 
          "
          set encoding=euc-cn
          set encoding=utf-8

          " DO NOT BELL!
          "
           不要用聲音煩我!
          set visualbell

          " 用鼠標畫文本表格用的
          :map <F1> :call ToggleSketch()<CR>

          "  樹形文本的展開、收縮
          if version >= 600
            
          " Reduce folding
            map <F2> zr
            map 
          <S-F2> zR
            
          " Increase folding
            map <F3> zm
            map 
          <S-F3> zM
          endif

          " Do not show help in file-explorer
          let explDetailedHelp=0
          " Open a file explorer
          "
           我喜歡用F4鍵打開一個文件瀏覽窗口
          if has("vertsplit")
            nnoremap 
          <silent> <F4> :call FileExplOpen()<CR>
            
          if !exists("*FileExplOpen")
              fun FileExplOpen()
                
          if @% == ""
                  20vsp .
                
          else
                  exe 
          "20vsp " . expand("%:p:h")
                endif
              endfun
            endif
          endif

          " 插入系統日期
          map <F5> :r !date +\%c<CR>

          " 函數,修改文件頭部的最后修改時間,就象這個文件的頭部一樣
          function! LastMod()
            
          if line("$"> 5
              let l 
          = 5
            
          else
              let l 
          = line("$")
            endif
            exe 
          "1," . l . "s/[Ll]ast [Mm]odified: .*/Last modified: " . strftime("%c") . " [" . hostname() . "]/e"
          endfunction

          " 手工更新文件最后修改時間
          map ,L :call LastMod()<CR>

          " Edit "Last modified"-comment in the top 5 lines of config files
          "
           自動更新文件修改時間
          if has("autocmd")
            augroup lastmod
              autocmd!
              autocmd BufWritePre,FileWritePre 
          * exec("normal ms")|call LastMod()|exec("normal `s")
            augroup END
          endif

          " Show TAB char and end space
          "
           我不喜歡 tab 和每行尾巴上的多余空格,如果文件里有,要記得告訴我
          set listchars=tab:>-,trail:~
          set list
          syntax match Trail 
          " +$"
          highlight 
          def link Trail Todo

          " python auto-complete code
          "
           Typing the following (in insert mode):
          "
             os.lis<Ctrl-n>
          "
           will expand to:
          "
             os.listdir(
          "
           Python 自動補全功能,只需要反覆按 Ctrl-N 就行了
          if has("autocmd")
            autocmd FileType python set complete
          +=k~/.vim/tools/pydiction/pydiction isk+=.,(
          endif

          " Only do this part when compiled with support for autocommands.
          if has("autocmd")

            
          " Enable file type detection.
            " Use the default filetype settings, so that mail gets 'tw' set to 72,
            " 'cindent' is on in C files, etc.
            " Also load indent files, to automatically do language-dependent indenting.
            " 自動檢測文件類型并加載相應的設置
            filetype plugin indent on

            
          " For all text files set 'textwidth' to 71 characters.
            autocmd FileType text setlocal textwidth=71

            
          " zope dtml
            autocmd BufNewFile,BufRead *.dtml setf dtml

            
          " python, not use <tab>
            " Python 文件的一般設置,比如不要 tab 等
            autocmd FileType python setlocal et | setlocal sta | setlocal sw=4
            
          " Python Unittest 的一些設置
            " 可以讓我們在編寫 Python 代碼及 unittest 測試時不需要離開 vim
            " 鍵入 :make 或者點擊 gvim 工具條上的 make 按鈕就自動執行測試用例
            autocmd FileType python compiler pyunit | setlocal makeprg=python\ %
            autocmd FileType python setlocal makeprg
          =python\ ./alltests.py
            autocmd BufNewFile,BufRead test
          *.py setlocal makeprg=python\ %
            
          " skeleton file
            " 自動使用新文件模板
            autocmd BufNewFile test*.py 0r ~/.vim/skeleton/test.py
            autocmd BufNewFile alltests.py 0r 
          ~/.vim/skeleton/alltests.py
            autocmd BufNewFile 
          *.py 0r ~/.vim/skeleton/skeleton.py

            
          " shell script
            autocmd fileType sh setlocal sw=4 | setlocal sta

            
          " RedHat spec file
            autocmd BufNewFile,BufReadPost *.spec setf spec

            
          " Brainfuck file
            autocmd BufNewFile,BufReadPost *.b setf brainfuck

            
          " When editing a file, always jump to the last known cursor position.
            " Don't do it when the position is invalid or when inside an event handler
            " (happens when dropping a file on gvim).
            " 記住上次的編輯位置
            autocmd BufReadPost *
              \ 
          if line("'\"") > 0 && line("'\"") <= line("$") |
              \   exe "normal g`\"" |
              \ endif

          endif 
          " has("autocmd")
           
          posted on 2008-11-06 16:00 zarra 閱讀(217) 評論(1)  編輯  收藏

          FeedBack:
          # re: Vimrc[未登錄] 2008-11-10 08:28 apple
          哎~~~還是一知半解~~~  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 金沙县| 白玉县| 弥渡县| 闵行区| 丰县| 屏边| 托里县| 获嘉县| 香港| 桂阳县| 荆门市| 城市| 微山县| 精河县| 青州市| 灵川县| 苗栗市| 瑞安市| 孟津县| 邵阳县| 浦县| 灵川县| 金沙县| 伊川县| 新郑市| 宁都县| 泗洪县| 威宁| 遂宁市| 内黄县| 滨海县| 秦皇岛市| 弥渡县| 江门市| 准格尔旗| 林芝县| 临汾市| 乌什县| 建瓯市| 塔城市| 宁武县|