caldav-calendar
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCalDAV Calendar (vdirsyncer + khal)
CalDAV Calendar (vdirsyncer + khal)
vdirsyncer syncs CalDAV calendars to local files. khal reads and writes them.
.icsvdirsyncer 可将CalDAV日历同步至本地文件,khal 负责对这些文件进行读写操作。
.icsSync First
先同步
Always sync before querying or after making changes:
bash
vdirsyncer sync在查询日历或修改内容后,务必先执行同步:
bash
vdirsyncer syncView Events
查看事件
bash
khal list # Today
khal list today 7d # Next 7 days
khal list tomorrow # Tomorrow
khal list 2026-01-15 2026-01-20 # Date range
khal list -a Work today # Specific calendarbash
khal list # 查看今日事件
khal list today 7d # 查看未来7天事件
khal list tomorrow # 查看明日事件
khal list 2026-01-15 2026-01-20 # 查看指定日期范围的事件
khal list -a Work today # 查看指定日历(Work)的今日事件Search
搜索事件
bash
khal search "meeting"
khal search "dentist" --format "{start-date} {title}"bash
khal search "meeting"
khal search "dentist" --format "{start-date} {title}"Create Events
创建事件
bash
khal new 2026-01-15 10:00 11:00 "Meeting title"
khal new 2026-01-15 "All day event"
khal new tomorrow 14:00 15:30 "Call" -a Work
khal new 2026-01-15 10:00 11:00 "With notes" :: Description goes hereAfter creating, sync to push changes:
bash
vdirsyncer syncbash
khal new 2026-01-15 10:00 11:00 "Meeting title"
khal new 2026-01-15 "All day event"
khal new tomorrow 14:00 15:30 "Call" -a Work
khal new 2026-01-15 10:00 11:00 "With notes" :: Description goes here创建完成后,执行同步以推送修改:
bash
vdirsyncer syncEdit Events (interactive)
编辑事件(交互式)
khal editbash
khal edit "search term"
khal edit -a CalendarName "search term"
khal edit --show-past "old event"Menu options:
- → edit summary
s - → edit description
d - → edit datetime range
t - → edit location
l - → delete event
D - → skip (save changes, next match)
n - → quit
q
After editing, sync:
bash
vdirsyncer synckhal editbash
khal edit "search term"
khal edit -a CalendarName "search term"
khal edit --show-past "old event"菜单选项:
- → 编辑标题
s - → 编辑描述
d - → 编辑时间范围
t - → 编辑地点
l - → 删除事件
D - → 跳过(保存修改,查看下一个匹配项)
n - → 退出
q
编辑完成后,执行同步:
bash
vdirsyncer syncDelete Events
删除事件
Use , then press to delete.
khal editD使用 找到目标事件后,按 即可删除。
khal editDOutput Formats
输出格式
For scripting:
bash
khal list --format "{start-date} {start-time}-{end-time} {title}" today 7d
khal list --format "{uid} | {title} | {calendar}" todayPlaceholders: , , , , , , , , , ,
{title}{description}{start}{end}{start-date}{start-time}{end-date}{end-time}{location}{calendar}{uid}用于脚本编写的格式示例:
bash
khal list --format "{start-date} {start-time}-{end-time} {title}" today 7d
khal list --format "{uid} | {title} | {calendar}" today可用占位符:, , , , , , , , , ,
{title}{description}{start}{end}{start-date}{start-time}{end-date}{end-time}{location}{calendar}{uid}Caching
缓存
khal caches events in . If data looks stale after syncing:
~/.local/share/khal/khal.dbbash
rm ~/.local/share/khal/khal.dbkhal 会将事件缓存至 。若同步后数据仍显示过时,可执行:
~/.local/share/khal/khal.dbbash
rm ~/.local/share/khal/khal.dbInitial Setup
初始配置
1. Configure vdirsyncer (~/.config/vdirsyncer/config
)
~/.config/vdirsyncer/config1. 配置vdirsyncer(~/.config/vdirsyncer/config
)
~/.config/vdirsyncer/configExample for iCloud:
ini
[general]
status_path = "~/.local/share/vdirsyncer/status/"
[pair icloud_calendar]
a = "icloud_remote"
b = "icloud_local"
collections = ["from a", "from b"]
conflict_resolution = "a wins"
[storage icloud_remote]
type = "caldav"
url = "https://caldav.icloud.com/"
username = "your@icloud.com"
password.fetch = ["command", "cat", "~/.config/vdirsyncer/icloud_password"]
[storage icloud_local]
type = "filesystem"
path = "~/.local/share/vdirsyncer/calendars/"
fileext = ".ics"Provider URLs:
- iCloud:
https://caldav.icloud.com/ - Google: Use storage type
google_calendar - Fastmail:
https://caldav.fastmail.com/dav/calendars/user/EMAIL/ - Nextcloud:
https://YOUR.CLOUD/remote.php/dav/calendars/USERNAME/
iCloud配置示例:
ini
[general]
status_path = "~/.local/share/vdirsyncer/status/"
[pair icloud_calendar]
a = "icloud_remote"
b = "icloud_local"
collections = ["from a", "from b"]
conflict_resolution = "a wins"
[storage icloud_remote]
type = "caldav"
url = "https://caldav.icloud.com/"
username = "your@icloud.com"
password.fetch = ["command", "cat", "~/.config/vdirsyncer/icloud_password"]
[storage icloud_local]
type = "filesystem"
path = "~/.local/share/vdirsyncer/calendars/"
fileext = ".ics"各服务商地址:
- iCloud:
https://caldav.icloud.com/ - Google: 使用 存储类型
google_calendar - Fastmail:
https://caldav.fastmail.com/dav/calendars/user/EMAIL/ - Nextcloud:
https://YOUR.CLOUD/remote.php/dav/calendars/USERNAME/
2. Configure khal (~/.config/khal/config
)
~/.config/khal/config2. 配置khal(~/.config/khal/config
)
~/.config/khal/configini
[calendars]
[[my_calendars]]
path = ~/.local/share/vdirsyncer/calendars/*
type = discover
[default]
default_calendar = Home
highlight_event_days = True
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%dini
[calendars]
[[my_calendars]]
path = ~/.local/share/vdirsyncer/calendars/*
type = discover
[default]
default_calendar = Home
highlight_event_days = True
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d3. Discover and sync
3. 发现日历并同步
bash
vdirsyncer discover # First time only
vdirsyncer syncbash
vdirsyncer discover # 首次使用时执行
vdirsyncer sync