一年前写了一篇提高效率的手艺,提到了 Vim 作为划时代的文本编辑工具,可以有效的提高文本编辑的效率,对于写作或者 coding 都非常有用。 今天整理一个稍微进阶的教程。vimer 十几年的 95% 的操作使用,应该都在这里。
Vim 作者,Bram 于 2023.08.05 日去世了,享年 62 岁。像我这种只要碰键盘就离不开 vim 的人,对 vim 的感激,是十分强烈的。悼念 Bram。 计算机的基石和发展,也就这几十年。那一批有卓越贡献的人,后面二十年会相继离去。C 语言之父丹尼斯十年前走了,70 岁。后面会越来越多。
按键
单个行为操作
移动:hjkl / w / e / b / $ / 0 (^)
删除:dd / x
行合并:J
换行:o / O
撤回 / 返回:u / C + r
插入:i / (I-A-a)
查找:f (-;-,) / t / * / #
替换:r
括号匹配:%
黏贴复制:yy-dd/p
拖屏:HLM / zz (zt-zb) / c + e / c + y / c + f (d-b-u) / :n / G / gg
set nocompatible " be iMproved, required filetype off " required
" set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin on GitHub repo Plugin 'tpope/vim-fugitive' " plugin from <http://vim-scripts.org/vim/scripts.html> " Plugin 'L9' " Git plugin not hosted on GitHub Plugin 'git://git.wincent.com/command-t.git' " git repos on your local machine (i.e. when working on your own plugin) Plugin 'file:///home/gmarik/path/to/plugin' " The sparkup vim script is in a subdirectory of this repo called vim. " Pass the path to set the runtimepath properly. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} " Install L9 and avoid a Naming conflict if you've already installed a " different version somewhere else. " Plugin 'ascenator/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " To ignore plugin indent changes, instead use: "filetype plugin on " " Brief help " :PluginList - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " :PluginSearch foo - searches for foo; append `!` to refresh local cache " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line
Dein
https://github.com/Shougo/dein.vim
1 2
sh -c "$(wget -O- <https://raw.githubusercontent.com/Shougo/dein-installer.vim/master/installer.sh>)"