> For the complete documentation index, see [llms.txt](https://kanneg881.gitbook.io/workspace/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kanneg881.gitbook.io/workspace/vim/han-shu-ku.md).

# 函數庫

`escape({string}, {chars})` \
轉義 string，chars 為要被轉義的字元

`executable({expr})`\
本函數檢查名字由 {expr} 指定的可執行文件存在與否\
1 存在\
0 不存在\
-1 此系統中沒有實現\
大概就是說指令是否可以執行的意思\
例如 php 指令是否可以執行

`expand({expr} [, {nosuf} [, {list}]])`\
擴展 `{expr}` 裡的通配符和下列特殊關鍵字

| 特殊符號 | 名稱    |
| ---- | ----- |
| `%`  | 當前文件名 |

| 修飾符  | 功能            |
| ---- | ------------- |
| `:p` | 擴展為完整的路徑      |
| `:h` | 頭部（去掉最後一個部分）  |
| `:t` | 尾部（只保留最後一個部分） |
| `:r` | 根部（去掉一個擴展名）   |
| `:e` | 只有擴展名         |

範例\
`expand('%:t')`

`getcmdtype()`\
取得當前命令行類型，例如查找 `/` 或 `?`

`submatch({nr}[, {list}])`\
只用於 `:substitute` 命令或 `substitute()` 函數中的表達式內。 返回匹配內容的第 {nr} 個子匹配。 {nr} 為 0 則返回整個匹配的內容
