• 【Linux配置】vim配置文件内容


    • vim的配置
    • 文件:~/.vimrc
    • 在自己的家目录中的.vimrc文件进行编辑配置
    • 设置如下:
    •  1 set nu  "序号
       2 set tabstop=4  "tab键的大小
       3 set showcmd     
       4 nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>   "用F2开关数字,方便复制
       5 
       6 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
       7 "新建.c,.h,.sh,.java文件,自动插入文件头 
       8 autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" 
       9 ""定义函数SetTitle,自动插入文件头 
      10 func SetTitle() 
      11     "如果文件类型为.sh文件 
      12     if &filetype == 'sh' 
      13         call setline(1,"#########################################################################") 
      14         call append(line("."), "# File Name: ".expand("%")) 
      15         call append(line(".")+1, "#Copyright@ Author:Panhao_Neo ") "这里是版权名(作者)
      16         call append(line(".")+2, "# mail: panhao_neo@163.com")      "邮箱
      17         call append(line(".")+3, "# Created Time: ".strftime("%c"))
      18         call append(line(".")+4, "#########################################################################")
      19         call append(line(".")+5, "#!/bin/bash")
      20         call append(line(".")+6, "")
      21     else
      22         call setline(1, "/*************************************************************************")
      23         call append(line("."), "    > File Name: ".expand("%"))
      24         call append(line(".")+1, "  > Copyright@ Author:Panhao_Neo ")  
      25         call append(line(".")+2, "  > Mail: panhao_neo@163.com ")
      26         call append(line(".")+3, "  > Created Time: ".strftime("%c"))
      27         call append(line(".")+4, " ************************************************************************/")
      28         call append(line(".")+5, "")
      29     endif
      30     if &filetype == 'cpp'
      31         call append(line(".")+6, "#include<iostream>")
      32         call append(line(".")+7, "using namespace std;")
      33         call append(line(".")+8, "")
      34  endif
      35     if &filetype == 'c'
      36         call append(line(".")+6, "#include<stdio.h>")
      37         call append(line(".")+7, "int main()")
      38         call append(line(".")+8, "{")
      39         call append(line(".")+9, "    ")
      40         call append(line(".")+10, "}")
      41     endif
      42     "   if &filetype == 'java'
      43     "       call append(line(".")+6,"public class ".expand("%"))
      44     "       call append(line(".")+7,"")
      45     "   endif
      46     "新建文件后,自动定位到文件末尾
      47     autocmd BufNewFile * normal G
      48 endfunc
  • 相关阅读:
    栈解旋(unwinding)
    自定义异常
    异常的基本使用
    什么是跨域?
    Vue-Vue-router跳转页面时返回顶部
    jquery&vue backTop缓慢返回顶部的方法应用
    Windows 10下使用U盘安装Ubuntu双系统
    Windows下磁盘分配操作
    在双系统(Windows与Ubuntu)下删除Ubuntu启动项
    .net framework体系结构
  • 原文地址:https://www.cnblogs.com/panhao/p/4557488.html
Copyright © 2020-2023  润新知