Vim
跳转到导航
跳转到搜索
安装
参见主条目Vim源代码。
中文菜单不能显示
这是由于gVim的语言配置文件使用的编码为UTF-8而非UTF8所致。去给相应的文件作个链接就好了。
for i in *utf-8*; do ln -s $i `echo $i|tr -d '-'`; done
编码
改变编码可以使用
LANG=zh_CN.GB18030 gvim
启动程序,然后设置 encoding
。注意在终端中同时需要更改终端编码(或者使用 luit),否则会显示乱码。
如果程序已经运行,则设定 encoding
,然后设定 lang ctype
以使文字正常显示。
注,这样可能会使部分含中文的脚本异常。
Python支持
可以调用 fork()、execlp() 等函数,但在图形界面版中,调用 fork() 后如不及时调用 execlp() 会导致X出错而失败。
常用二合字母
编码 | 结果 | 编码 | 结果 |
---|---|---|---|
-! | ↑ | -v | ↓ |
S* | Σ | (U | ∩ |
Rg | ® | cO | © |
?2 | ≈ | != | ≠ |
技巧
使用 Vim 配合 tmux 来生成带高亮的 HTML 文件:
tmux new-session -d -s vpaste 'TERM=screen-256color vim -R +"set nocul nocuc nofoldenable number" +TOhtml +"sav! /tmp/page.html" +"qall!" ~/.vim/local.vim'
bug
- 打开 gzip 文件时,不能使用
++enc
,否则不能读取文件。 - 在
highlight region
中,matchgroup
必须在start
等之前指定,否则无效
终端
第一句是在进入vim的时候,把光标变成红的;第二句定义进入插入模式,光标变成蓝色的;第三句的意思是插入模式结束,光标变回红的;第四句,设定vim 退出的时候,光标变成绿色。[1]
silent !echo -ne "\e]12;IndianRed2\007"
let &t_SI="\e]12;RoyalBlue1\007"
let &t_EI="\e]12;IndianRed2\007"
autocmd VimLeave * :!echo -ne "\e]12;green\007"
环境变量
一些有用的环境变量如下:
VIMINIT
- Vim 启动时执行的命令。可以在此 source 用户位于它处的 vimrc 文件。
MYVIMRC
- 用户的 vimrc 文件位置。被设置为在 Vim 启动后被设置为找到的那个 vimrc 的位置,除非
VIMINIT
和它均被设置。设置它并不会直接导致 Vim 使用其作为 vimrc。
另见shell命令记录#定制。
参见
- Vim源代码
- Vim插件列表
- Vim代码片断
- vim-addons(命令行工具)
外部链接
观点和评论
- On sharpening the saw
- Vim Koans - Arabesque
- 10 Questions with Vim's creator, Bram Moolenaar - Binpress
- Why I Still Use Vim - Commit Log - Medium
教程
- 简明 Vim 练级攻略 | 酷壳 - CoolShell.cn, 简明Vim练级攻略 - 平凡的世界
- http://learnvimscriptthehardway.stevelosh.com/
- VIM学习笔记
在 Windows 上的使用
技巧和工具
- vivim - Integrate Vim into Visual Studio
- visual_studio.vim - Vim and Microsoft Visual Studio .NET integration, based on Python
- win-iconv, iconv implementation using Win32 API to convert.
- MarcWeber/vim-addon-async - GitHub,利用
+clientserver
特性和子进程进行异步通信 - bartman/vim - GitHub,和子进程进行异步通信的补丁
- yukihironakadaira-vim-cmdsrv-nox - clientserver without X
- AHK: 用 gVim 编辑任意窗口的文字 - 小众软件
- vpaste.net - Vim based pastebin
- Vim Color Scheme Editor (更正版)
- Bytefluent | Vivify, 在线预览和编辑配置方案(多种文件类型预览)
- 使用GNU GLOBAL索引代码 - Adam's
- ardagnir/athame: Full vim for your shell (bash, zsh, gdb, python, etc): 在 readline 中使用 Vim
其它
- 七星庐 - Vim 也是个播放器: 在 Vim 里播放《Bad Apple》影片