zoukankan      html  css  js  c++  java
  • NOI-linux下VIM的个人常用配置

    路径:/etc/vim/vimrc

    打开终端:Ctrl+Alt+T

    输入:sudo vim或gedit /etc/vim/vimrc (推荐用gedit,更好操作)

    以下是我的配置:

    "我的配置
      "显示行号
        set nu
        set number
      "更改缩进大小
        set tabstop=2
      "颜色主题
        color koehler
      "显示标尺
        set ruler
      "去空行  
        nnoremap <F2> :g/^s*$/d<CR> 
      "激活鼠标
        set mouse=a
      "新建标签  
        map <M-F2> :tabnew<CR>  
      "列出当前目录文件  
        map <F3> :tabnew .<CR>  
      "打开树状文件目录  
        map <C-F3> e  
      "C,C++ 按F5编译运行
        map <F5> :call CompileRunGcc()<CR>
        func! CompileRunGcc()
            exec "w"
            if &filetype == 'c'
                exec "!g++ % -o %<"
                exec "! ./%<"
            elseif &filetype == 'cpp'
                exec "!g++ % -o %<"
                exec "! ./%<"
            elseif &filetype == 'java' 
                exec "!javac %" 
                exec "!java %<"
            elseif &filetype == 'sh'
                :!./%
            endif
        endfunc
      "C,C++的调试
        map <F8> :call Rungdb()<CR>
        func! Rungdb()
            exec "w"
            exec "!g++ % -g -o %<"
            exec "!gdb ./%<"
        endfunc
      "自动缩进
        set autoindent
        set cindent
      "统一缩进为4
        set softtabstop=2
        set shiftwidth=2

    欧了~~~

    如果是考试,你就可以选择下面的代码,比较简单:

    set mouse=a
    set tabstop=4
    set ruler
    set nu
    set autoindent
    set autowrite
    set autoread
    set showcmd
    map <F9> <Esc> :w <CR> :!g++ % -o %< && ./%< <CR>
    imap <F9> <Esc> :w <CR> :!g++ % -o %< && ./%< <CR>
  • 相关阅读:
    Linux文件查找
    Linux之正则表达式
    linux文本处理
    Linux压缩归档管理
    spring-security问题记录
    mybatis-plus&springboot
    Mysql8- Public Key Retrieval is not allowed
    MySQL 5.7安装(linux)
    git把本地代码上传(更新)到github上
    linux相关(find/grep/awk/sed/rpm)
  • 原文地址:https://www.cnblogs.com/fushao2yyj/p/8404511.html
Copyright © 2011-2022 走看看