Vim 学习笔记

  • 插入:a,A
  • 插入:i,I
  • 替换并插入:s,S
  • 行尾:$
  • 行首:0
  • 首字:^
  • 尾字:_
  • 在1到100行的末尾添加分号::1,100 normal A;
  • 在2到4行的末尾添加#good字符,:2,4s/$/#good/g
  • 前一个字符词首:b
  • 后一个字符词尾:e
  • 后一个字符词首:w
  • 在51行和57行第一个单词词尾增加_out:51,57s/\w+/&_out
  • 在51行和57行所有单词词尾增加_out:51,57s/\w+/&_out/g
  • 给51行和57行第一个单词词尾增加单引号:51,57s/\w+/‘&’
  • 😒/green/bright &/g Replace each “green” with “bright green” in the line.
  • x, X 在一行字当中,x 为向后删除一个字符 (相当亍 [del] 按键),X 为向前删除一个字符(相当亍 [backspace] 亦即是退格键) (常用)
  • d$ 删除游标所在处,到该行行尾的所有字符
  • d0 删除游标所在处 ,到该行行首的所有字符
  • 注:下面的第三个字母都是大写,按玩Ctrl + w之后,按shif + 相应的字母。后面用^代替Ctrl
  • Ctrl + w + K :移动当前窗口至屏幕顶端,并占用全部宽度
  • ^WJ: 移动窗口至屏幕底端,并占用全部宽度
  • ^WH:移动窗口至屏幕左端,并占用全部高度
  • ^WL:移动窗口至屏幕右端,并占用全部高度
  • ^WT :移动窗口至屏新的现有分页
  • vep,粘贴覆盖当前单词
  • "09,az,可以使用的寄存器
  • :reg 显示当前寄存器内容
  • : 进入命令行模式,然后输入 edit <路径> 命令来打开路径对应的文件
  • g; 回到上次编辑的地方
  • gg=G,全局对齐
  • :{range}norm[al][!] {commands}, 比如:%norm !@a,在每个文件后面运行宏a.normal命令中的可选参数 ! 用于指示vim在当前命令中不使用任何vim映射;如果没有显式使用 ! 选项,即便是执行一个非递归映射 (noremap) 命令,它的参数仍有可能被重新映射。

下面是我的vimrc.

set nocp
set guifont=Courier_New:h13:cANSI
"set guifont=DejaVu_Sans_Mono:h12:cANSI
"set guifont=Consolas:h14:cANSI
set nowrap
filetype plugin on
set nocompatible
color torte
set nu!

" 设置文件编码格式
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1,gbk,gb18030,gk2312
if has("win32")
 set fileencoding=chinese
else
 set fileencoding=utf-8
endif
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim

"解决consle提示信息输出乱码
language messages zh_CN.utf-8
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

"for sw
set sw=4
set ts=4

map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
nunmap <C-A>

" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on

" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

" Input
:ab Input32 <Tab>: in<Tab>std_logic_vector(31 downto 0);
:ab Input16 <Tab>: in<Tab>std_logic_vector(15 downto 0);
:ab Input8  <Tab>: in<Tab>std_logic_vector( 7 downto 0);
:ab Input4  <Tab>: in<Tab>std_logic_vector( 3 downto 0);
:ab Input3  <Tab>: in<Tab>std_logic_vector( 2 downto 0);
:ab Input2  <Tab>: in<Tab>std_logic_vector( 1 downto 0);
:ab Input1  <Tab>: in<Tab>std_logic;
" Output
:ab Output32 <Tab>: out<Tab>std_logic_vector(31 downto 0):=(others=>'0');
:ab Output16 <Tab>: out<Tab>std_logic_vector(15 downto 0):=(others=>'0');
:ab Output8  <Tab>: out<Tab>std_logic_vector( 7 downto 0):=(others=>'0');
:ab Output4  <Tab>: out<Tab>std_logic_vector( 3 downto 0):=(others=>'0');
:ab Output3  <Tab>: out<Tab>std_logic_vector( 2 downto 0):=(others=>'0');
:ab Output2  <Tab>: out<Tab>std_logic_vector( 1 downto 0):=(others=>'0');
:ab Output1  <Tab>: out<Tab>std_logic:='0';
" Register
:ab Reg32 <Tab>: std_logic_vector(31 downto 0):=(others=>'0');
:ab Reg16 <Tab>: std_logic_vector(15 downto 0):=(others=>'0');
:ab Reg8  <Tab>: std_logic_vector( 7 downto 0):=(others=>'0');
:ab Reg4  <Tab>: std_logic_vector( 3 downto 0):=(others=>'0');
:ab Reg3  <Tab>: std_logic_vector( 2 downto 0):=(others=>'0');
:ab Reg2  <Tab>: std_logic_vector( 1 downto 0):=(others=>'0');
:ab Reg1  <Tab>: std_logic:='0';
" Process
:ab Process process(sys_clk)<Enter>begin<Enter>if rising_edge(sys_clk) then<Enter>;<Enter>end if;<Enter>end process;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值