vim使用

.vimrc 配置 https://www.ruanyifeng.com/blog/2018/09/vimrc.html

跳转

移动到函数名上,按下( ctrl + ] )便可以跳转到函数定义的地方
ctrl+i 向前跳到前几次光标位置
ctrl+o 向后跳到后几次光标位置
% 匹配括号移动
*# 匹配光标所在的单词

翻页

整页翻页 ctrl+f ctrl+b
翻半页 ctrl+d ctlr+u
滚一行 ctrl+e ctrl+y

改变光标显示位置

zz 让光标所在的行居屏幕中央
zt 让光标所在的行居屏幕最上一行 t=top
zb 让光标所在的行居屏幕最下一行 b=bottom
H M L 光标在首行、在中间、在末行

有关tab的使用

:tabedit path/to/file
:tabnew path/to/file
:tabonly #only show this tab
:tabfind  
:f       #show file path
:args    #show open tabs
{i}gt    #go to ith tab
:explore  #show cur dir
:Te      #show cur dir in new tab

about window

C_W (Ctrl+w) hjkl      # goto different window
:vsp                    #vertical window

about marco

qd, q, @q, @@

about jump

() sentences, {} paragraph
'.  #to last change
g;  #to last edit
:marks      # show all marks
:ma          

修改正在编辑的文件名称:
在命令模式下,输入file,后跟路径和文件名,即可在保存。如将此文件命名为welcome.txt,并保存在当前目录下。
命令:file welcome.txt

abour ~/.vimrc
1.设置(软)制表符宽度为4
set tabstop=4
set softtabstop=4
2.设置缩进的空格数为4
set shiftwidth=4
3.设置自动缩进:即每行的缩进值与上一行相等;使用 noautoindent 取消设置:
set autoindent
4.使用 C/C++ 语言的自动缩进方式
set cindent
5.设置C/C++语言的具体缩进方式(以我的windows风格为例):
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
6.显示行号
set nu
7.显示标尺
set ruler
8.将搜索内容反白
set hlsearch
9.可以删除任意值
set backspace=2

折叠

posted @ 2020-07-31 18:34  阿龙233  阅读(121)  评论(0编辑  收藏  举报