隨筆-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 一凡 閱讀(323) 評論(0)  編輯  收藏 所屬分類: linux
          主站蜘蛛池模板: 大姚县| 繁峙县| 邓州市| 新干县| 十堰市| 昆山市| 蓬安县| 寿阳县| 高平市| 密山市| 福建省| 会昌县| 舞钢市| 金坛市| 彰武县| 盖州市| 屯留县| 庄河市| 玛多县| 齐河县| 乐清市| 斗六市| 汉寿县| 台湾省| 安化县| 北辰区| 沈丘县| 泊头市| 文登市| 镇康县| 寿阳县| 赣州市| 海晏县| 神池县| 泰州市| 万安县| 泗洪县| 东山县| 通州市| 洪洞县| 蓝田县|