This Chapter mainly introduces the Recorder in vim,Which is used to do some repeated operations.This function is also called a macro.
for more information try :help recording
Registers(related with recording)
This section will introduce related concept/function of recording function. Which help us to understand how this works, and what we should pay attention to it.
register of vim: register is a superset of macro, it contains more function. In this part we should know, register can store some string or operations to help subsequent use.
Status: Using :registers or :reg to check those we have registered, or add the registers’s name behind to show those u’re interested in.
1 2 3 4 5
:regabc --- Registers --- "a register a content "b register b content "c register c content
Lifecycle The information in registers will not disappear with the window closed. But maybe with the system-level’s open-close. we should test this!!! So we can store some snippet,pwd,etc.
基于 VimScript) 该 blog 主要记录基础 vim 的配置文件编写,旨在使用基础 vim 的时候也能有一个较好的代码编辑体验,同时提供部分 keymap 集成一些简单的功能,方便文档编写时候的格式转换等。这个配置文件在后续配置 nvim 的时候部分配置也会沿用。
Vim 的基础配置
自动检测文件修改,以及对多个文件的 workspace 自动切换
1 2 3
" >>0-1 state detection. set autoread " when file change outside, we will know set autochdir " change workspace when we swtich file, when we open multi-file in one session.
鼠标和剪切板功能
设置 vim 对鼠标的支持,支持鼠标选择等
1 2 3 4 5 6
" reference the web get the best setting and use it always " suppose the mouse operation " but this function not work well in the weterm, we disable this part for work. set mouse=a "set selection=exclusive "set selectmode=mouse,key
" WSL yank support lets:clip = '/mnt/c/WINDOWS/system32/clip.exe'" change this path according to your mount point ifexecutable(s:clip) augroup WSLYank autocmd! autocmd TextYankPost * ifv:event.operator ==# 'y' | callsystem(s:clip, @0) | endif augroup END endif
设置撤销历史记录
多次编辑同一个文件的时候保持 Undo 的历史记录,便于对同一个文件进行编辑。
1 2 3 4
" >>0-2 keep file history setundofile" keep the undo history in file. set undodir=~/.vim/.undo// sethistory=1000