我在vimrc中添加了如下內(nèi)容。執(zhí)行了source /etc/vimrc。但是沒有效果
auto BufNewFile *.py,*.sh, exec ":call SetTitle()"
let $author_name = ”Tianlianhao“
let $author_emal ="214520626@qq.com"
func SetTile()
if &filetype == 'sh'
call setline(1,"\#####################################################")
call append (line("."),"\#File Nme:".expand("%"))
call append(line(".")+1,"\#Author:".$author_name)
call append(line(".")+2,"\#mail:".$author_email)
call append(line(".")+3,"\#Created Time:".strftime("%c"))
call append(line(".")+4,"\#==============================================")
call append(line(".")+5,"\#!/bin/bash")
call append(line(".")+6,"")
else
call setline(1,"\#######################################################")
call append(line("."),"#\#File Name:".expand("%"))
call append(line(".")+1,"\#Author:".$author_name)
call append(line(".")+2,"\#mail:".$author_email)
call append(line(".")+3,"\Created Time:".Strftime("%c"))
call append(line(".")+4,"\#================================================")
call append(line(".")+5,"\#!/usr/bin/python")
call append(line)("."+6,""))
2019-03-24
還有一點(diǎn)一定要記住,有可能/etc/vimrc不生效,一般情況的是在自己家目錄下邊的.vimrc這個(gè)文件才會生效!!!一定要注意!!!!!!!!!!
2019-03-16
1.在結(jié)尾添加 if結(jié)束和func結(jié)束:
endif
autocmd BufNewFile * normal G
endfunc
2.在vimrc文件的首部添加:(*****)
filetype on????? #"打開文件類型檢測
2018-11-07
你的if判斷都沒有閉合,而且這些是照著視頻上抄的吧?去網(wǎng)上搜一個(gè)完整的vimrc配置,自己修改一下
2018-06-13
你確定沒有效果??
你是不是用vim打開的?