Vim备忘

Vim备忘

下载

gVim 8.1 for Windows

命令

k或↑             上移
j或↓             下移
h或←             左移
l或→             右移

w                右移光标到下一个字的开头;
e                右移光标到一个字的末尾;
0                数字0,左移光标到本行的开始;
$                右移光标,到本行的末尾;
n                n表示数字,按下数字后按空格键,光标右移n个字符,会跨行移动;
/str1            正向搜索字符串 str1;
o                插入空白新行,并跳转光标;
+                光标移动到非空格符的下一行;
-                光标移动到非空格符的上一行n;

gg               将光标定位到文件第一行起始位置
yy               复制一行  
dd               剪切一行
y                复制
p                粘贴
u                撤销

分屏

Ctrl+w, s       水平分屏
Ctrl+w, v       垂直分屏
Ctrl+w, c       关闭当前分屏窗口

.vimrc配置

来自mhy12345大佬

"ctags
set tags=tags;
set autochdir

"encoding
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8

"functions
function Compile()
        if &filetype == 'cpp'
                exec "!g++ % -o %< -g -Wall -Wextra -Wconversion -std=c++11"
        elseif &filetype == 'c'
                exec "!gcc % -o %< -g -Wall -Wextra -Wconversion"
        elseif &filetype == 'pas'
                exec "!fpc % -g"
        elseif &filetype == 'tex'
                exec "!xelatex '%'"
        elseif &filetype == 'java'
                exec "!javac %"
        elseif &filetype == 'scss'
                exec "!sass % > %<.css"
        endif
endfunction

function Debug()
        if &filetype == 'cpp' 
                exec "!gdb ./%<"
        elseif &filetype == 'tex'
                exec "!okular './%<.pdf'"
        elseif &filetype == 'java'
                exec "!jdb %<"
        endif
endfunction

function Run()
        if &filetype == 'cpp'
                exec "!time ./%<"
        elseif &filetype == 'tex'
                exec "!okular './%<.pdf'"
        elseif &filetype == 'java'
                exec "!java %<"
        elseif &filetype == 'ruby'
                exec "!ruby %"
        elseif &filetype == 'html'
                exec "!firefox %"
        elseif &filetype == 'php'
                exec "!php %"
        elseif &filetype == 'sh'
                exec "!bash %"
        endif
endfunction

"basic settings
set hlsearch
set smartindent
set number
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set mouse=a
syntax on
filetype plugin indent on
imap jj <esc>
map <F9> : call Compile() <CR>
map <F5> : call Debug() <CR>
map <F6> : call Run() <CR>
map <F8> : ! g++ % -o %< -O2 <CR>
map <F12> : ! subl ./% <CR>
map <F2> : ! python % <CR>
colors evening

转载于:https://www.cnblogs.com/santiego/p/10792534.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值