zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    策略模式-1.简单定义及一个实例
    单例模式-3.透明的单例模式
    单利模式2-一个简单的实例
    单例模式-1.单利模式的简单实现
    jquery animate的一个疑惑
    老版本select2设置初始值
    cookie的设置与清除会出现的一个问题
    给select2的ajax添加beforeSend方法
    Day16
    Day15
  • 原文地址:https://www.cnblogs.com/santiego/p/10792534.html
Copyright © 2011-2022 走看看