【譯】用 Rust 實現 csv 解析-part2
阿新 • • 發佈:2020-11-02
set ts=4 et set noexpandtab colorscheme desert " 搜尋忽略大小寫 set ignorecase smartcase " 開啟實時搜尋功能 set incsearch " 高亮顯示搜尋結果 set hlsearch "關閉vi相容模式 set nocompatible " 定義快捷鍵在結對符之間跳轉 nmap <Leader>M % " 顯示行號 set number " 命令開啟檔案型別檢測功能,它相當於檔案型別檢測功能的開關 filetype on " 語法高亮 syntax on " 自動縮排 set autoindent set smartindent set mouse-=a " table鍵盤4空格 set tabstop=4 " 當使用移動(shift)命令時移動的字元數 set shiftwidth=4 set encoding=utf-8 set termencoding=utf-8 set fileencoding=utf-8 set fileencodings=ucs-bom,utf-8,chinese,cp936,gb18030,gbk,gb2312,latin-1 " 禁止生成備份檔案 set nobackup set fileformat=unix " 配色方案 "set background=dark "colorscheme solarized "colorscheme molokai "colorscheme phd "colorscheme darkblue colorscheme desert " 高亮顯示當前行/列 set cursorline "highlight CursorLine cterm=NONE ctermbg=black ctermfg=green guibg=NONE guifg=NONE "set cursorcolumn "highlight CursorColumn cterm=NONE ctermbg=black ctermfg=green guibg=NONE guifg=NONE " vundle 環境設定 filetype off set rtp+=~/.vim/bundle/Vundle.vim " vundle 管理的外掛列表必須位於 vundle#begin() 和 vundle#end() 之間 call vundle#begin() Plugin 'VundleVim/Vundle.vim' Plugin 'scrooloose/nerdtree' Plugin 'altercation/vim-colors-solarized' " 外掛列表結束 call vundle#end() filetype plugin indent on " 使用 NERDTree 外掛檢視工程檔案。設定快捷鍵,速記:file list nmap <Leader>fl :NERDTreeToggle<CR> " 設定 NERDTree 子視窗寬度 let NERDTreeWinSize=22 " 設定 NERDTree 子視窗位置 "let NERDTreeWinPos="right" let NERDTreeWinPos="left" " 顯示隱藏檔案 let NERDTreeShowHidden=1 " NERDTree 子視窗中不顯示冗餘幫助資訊 let NERDTreeMinimalUI=1 " 刪除檔案時自動刪除檔案對應 buffer let NERDTreeAutoDeleteBuffer=1 autocmd FileType des setlocal et sta sw=4 sts=4 autocmd FileType python setlocal et sta sw=4 sts=4 autocmd FileType html setlocal noet sta sw=4 sts=4 autocmd FileType xsl setlocal noet sta sw=4 sts=4 autocmd FileType xml setlocal noet sta sw=4 sts=4 autocmd FileType tpl setlocal noet sta sw=4 sts=4 autocmd FileType php setlocal et sta sw=4 sts=4 autocmd FileType c setlocal et sta sw=4 sts=4 autocmd FileType cpp setlocal et sta sw=4 sts=4 autocmd FileType js setlocal et sta sw=4 sts=4 " 當新建 .h .c .hpp .cpp .mk .sh等檔案時自動呼叫SetTitle 函式 autocmd BufNewFile *.[ch],*.hpp,*.cpp,Makefile,*.mk,*.sh,*.py exec ":call SetTitle()" " 加入註釋 func SetComment() call setline(1,"/*================================================================") call append(line("."), "* Copyright (C) ".strftime("%Y")." Baidu.com. All rights reserved.") call append(line(".")+1, "* ") call append(line(".")+2, "* File:".expand("%:t")) call append(line(".")+3, "* Author:yourname") call append(line(".")+4, "* Date:".strftime("%Y年%m月%d日")) call append(line(".")+6, "*") call append(line(".")+7, "================================================================*/") call append(line(".")+8, "") call append(line(".")+9, "") endfunc " 加入shell,Makefile註釋 func SetComment_sh() call append(line(".")+1, "/*================================================================") call append(line(".")+2, "* Copyright (C) ".strftime("%Y")." Baidu.com. All rights reserved.") call append(line(".")+3, "* ") call append(line(".")+4, "* File:".expand("%:t")) call append(line(".")+5, "* Author:yourname") call append(line(".")+6, "* Date:".strftime("%Y年%m月%d日")) call append(line(".")+7, "*") call append(line(".")+8, "================================================================*/") call append(line(".")+9, "") call append(line(".")+10, "") endfunc " 加入python註釋 func SetComment_py() call append(line(".")+1, "#================================================================") call append(line(".")+2, "# Copyright (C) ".strftime("%Y")." Baidu.com. All rights reserved.") call append(line(".")+3, "# ") call append(line(".")+4, "# File:".expand("%:t")) call append(line(".")+5, "# Author:yourname") call append(line(".")+6, "# Date:".strftime("%Y年%m月%d日")) call append(line(".")+7, "#") call append(line(".")+8, "#================================================================") call append(line(".")+9, "") call append(line(".")+10, "") endfunc " 定義函式SetTitle,自動插入檔案頭 func SetTitle() if &filetype == 'make' call setline(1,"") call append(line("."),"") call SetComment_sh() elseif &filetype == 'sh' call setline(1,"#!/system/bin/sh") call append(line("."),"") call SetComment_sh() elseif &filetype == 'python' call setline(1,"\#!/usr/bin/env python") call append(line("."), "\# -*- coding: gb18030 -*-") call SetComment_py() else call SetComment() if expand("%:e") == 'hpp' call append(line(".")+10, "#ifndef _".toupper(expand("%:t:r"))."_H") call append(line(".")+11, "#define _".toupper(expand("%:t:r"))."_H") call append(line(".")+12, "#ifdef __cplusplus") call append(line(".")+13, "extern \"C\"") call append(line(".")+14, "{") call append(line(".")+15, "#endif") call append(line(".")+16, "") call append(line(".")+17, "#ifdef __cplusplus") call append(line(".")+18, "}") call append(line(".")+19, "#endif") call append(line(".")+20, "#endif //".toupper(expand("%:t:r"))."_H") elseif expand("%:e") == 'h' call append(line(".")+10, "#pragma once") elseif &filetype == 'c' call append(line(".")+10,"#include \"".expand("%:t:r").".h\"") elseif &filetype == 'cpp' call append(line(".")+10, "#include \"".expand("%:t:r").".h\"") endif endif endfunc set tags=tags; set autochdir