隨筆-204  評論-90  文章-8  trackbacks-0
          set nocompatible "關閉vi兼容
          set enc=utf-8
          "set number "顯示行號
          filetype plugin on 
          "文件類型
          set history=500 "歷史命令
          syntax on 
          "語法高亮
          "set autoindent "ai 自動縮進
          "set smartindent "智能縮進
          set showmatch "括號匹配
          set ruler 
          "右下角顯示光標狀態行
          set nohls "關閉匹配的高亮顯示
          set incsearch 
          "設置快速搜索
          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


          "根據文件類型自動插入文件頭
          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 一凡 閱讀(327) 評論(0)  編輯  收藏 所屬分類: linux
          主站蜘蛛池模板: 泸定县| 南昌县| 塘沽区| 景宁| 镇坪县| 白朗县| 五台县| 兰西县| 积石山| 濮阳市| 梅河口市| 平远县| 泾川县| 武川县| 蒙阴县| 上思县| 凤凰县| 尼木县| 比如县| 香格里拉县| 肇庆市| 濮阳市| 石首市| 望奎县| 新竹市| 商洛市| 长垣县| 保德县| 敦煌市| 遂川县| 涞水县| 巫山县| 凉城县| 云南省| 建湖县| 盐亭县| 油尖旺区| 宝鸡市| 赞皇县| 南乐县| 资兴市|