亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 3645 | 回復: 7
打印 上一主題 下一主題

vim配置問題請教 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-07-21 09:59 |只看該作者 |倒序瀏覽
按照網上搜到的資料如下:
http://vim.1045645.n5.nabble.com ... onal-td1141787.html

在.vimrc文件中添加一些配置語句, 要判斷vim打開的文件是否是c文件, 語句如下:
  1. let mytype = &filetype
  2. echo "xxxxxxxxxxxxxxxxxxxxxxxxx============="mytype"========================================"
  3. if &filetype=="c" || &filetype=="C"
  4. "if &ft == "c"
  5.     echo "-----------------------file type was c------------------------------"
  6.     " 'filetype' is c
  7. elseif &filetype == "cpp"
  8.     echo "-----------------------file type was cpp------------------------------"
  9.     " it is cpp
  10. else
  11.     echo "-----------------------file type was other------------------------------"
  12.     " it is something else
  13. endif
復制代碼
可無論我每次用vim打開什么文件, filetype讀取出來都是空的,  輸出如下:
  1. $ vi test.c
  2. xxxxxxxxxxxxxxxxxxxxxxxxx=============  ========================================
  3. -----------------------file type was other------------------------------
  4. 請按 ENTER 或其它命令繼續(xù)
復制代碼
而進入了test.c文件后, 我用命令獲取到的文件類型又是正確的, 輸出如下:
  1. :set filetype
  2. filetype=c
復制代碼
請高手解惑

論壇徽章:
0
2 [報告]
發(fā)表于 2011-07-21 10:06 |只看該作者
au FileType C 吧

論壇徽章:
0
3 [報告]
發(fā)表于 2011-07-21 10:13 |只看該作者
filetype on

論壇徽章:
0
4 [報告]
發(fā)表于 2011-07-21 10:51 |只看該作者
學習

論壇徽章:
0
5 [報告]
發(fā)表于 2011-07-21 11:46 |只看該作者
au FileType C 吧
yangyang1581 發(fā)表于 2011-07-21 10:06


完全木有用:
  1. filetype on
  2. au FileType C
  3. let mytype = &filetype
  4. echo "xxxxxxxxxxxxxxxxxxxxxxxxx============="mytype"========================================"
  5. if &filetype=="c" || &filetype=="C"
  6. "if &ft == "c"
  7.     echo "-----------------------file type was c------------------------------"
  8.     " 'filetype' is c
  9. elseif &filetype == "cpp"
  10.     echo "-----------------------file type was cpp------------------------------"
  11.     " it is cpp
  12. else
  13.     echo "-----------------------file type was other------------------------------"
  14.     " it is something else
  15. endif
復制代碼
設置了以后輸出還是:
$ vi test.c

--- 自動命令 ---
xxxxxxxxxxxxxxxxxxxxxxxxx=============  ========================================
-----------------------file type was other------------------------------
請按 ENTER 或其它命令繼續(xù)

論壇徽章:
0
6 [報告]
發(fā)表于 2011-07-21 11:48 |只看該作者
回復 3# lkk2003rty


這個我也早試過了, 沒有用, 進入到c文件以后用filetype看很正常:
  1. :filetype
  2. filetype detection:ON  plugin:ON  indent:ON
復制代碼

論壇徽章:
0
7 [報告]
發(fā)表于 2011-07-21 11:59 |只看該作者
au FileType php call AddPHPFuncList()
function AddPHPFuncList()
    echo "-----------------------file type was PHP------------------------------"
endfu

論壇徽章:
0
8 [報告]
發(fā)表于 2011-07-21 17:49 |只看該作者
au FileType php call AddPHPFuncList()
function AddPHPFuncList()
    echo "-----------------------f ...
yangyang1581 發(fā)表于 2011-07-21 11:59



    這種方法沒有問題, 我以前也是用 autocmd FileType c,cpp 來處理,  偶然在網上發(fā)現&filetype的方法, 想嘗試下, 結果不行.
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯網協會會員  聯系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP