隨筆-204  評論-90  文章-8  trackbacks-0
          set nocompatible "關(guān)閉vi兼容
          set enc=utf-8
          "set number "顯示行號
          filetype plugin on 
          "文件類型
          set history=500 "歷史命令
          syntax on 
          "語法高亮
          "set autoindent "ai 自動縮進(jìn)
          "set smartindent "智能縮進(jìn)
          set showmatch "括號匹配
          set ruler 
          "右下角顯示光標(biāo)狀態(tài)行
          set nohls "關(guān)閉匹配的高亮顯示
          set incsearch 
          "設(shè)置快速搜索
          set foldenable "開啟代碼折疊
          "set fdm=manual "手動折疊
          set foldmethod=syntax 
          "自動語法折疊
          set modeline "自動載入模式行
          "自動插入modeline
          func! AppendModeline()
          let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d :",
          \ &tabstop, &shiftwidth, &textwidth)
          let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
          call append(line("$"), l:modeline)
          endfunc
          "按\ml,自動插入modeline
          nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
          "空格展開折疊
          nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>

          "set tabstop=4
          "set shiftwidth=4
          set ts=4
          set sw=4
          set expandtab
          "自動tab

           

          if has(
          "autocmd")
          filetype plugin indent on
          endif
          autocmd filetype python setlocal et sta sw=4 sts=4


          "根據(jù)文件類型自動插入文件頭
          autocmd BufNewFile *.py,*.sh exec ":call SetTitle()"
          func SetTitle()
          if &filetype == 'sh'
          call setline(1"\#!/bin/bash")
          call append(line("."), "\# Author:itxx00@gmail.com")
          call append(line(".")+1"")
          else
          call setline(1"\#!/bin/env python")
          call append(line("."), "\#coding:utf-8")
          call append(line(".")+1"\#Author:itxx00@gmail.com")
          call append(line(".")+2"")
          endif
          endfunc 
          "新建文件后自動定位至文件末尾
          autocmd BufNewFile * normal G
          "F2去空行
          nnoremap <F2> :g/^\s*$/d<CR>
          posted on 2013-10-25 21:24 一凡 閱讀(322) 評論(0)  編輯  收藏 所屬分類: linux
          主站蜘蛛池模板: 兴宁市| 屏南县| 玉溪市| 综艺| 金阳县| 城固县| 南投县| 宁武县| 九龙城区| 正阳县| 长垣县| 富裕县| 景东| 九龙县| 正蓝旗| 大埔区| 聊城市| 乐东| 邹平县| 曲麻莱县| 长乐市| 崇信县| 商都县| 贺州市| 乳源| 白城市| 栖霞市| 永寿县| 积石山| 东城区| 河东区| 潞城市| 阜新市| 任丘市| 贵德县| 天祝| 永川市| 长岛县| 华安县| 阜城县| 庆城县|