当前位置:   article > 正文

Verilog编辑器Gvim的配置_gvim设置

gvim设置

1.Gvim下载

Ubuntu

  1. sudo apt-get install vim
  2. sudo apt-get install gvim

CentOS7:

  1. sudo yum install vim
  2. sudo yum install gvim

win:

download : vim onlineicon-default.png?t=N7T8https://www.vim.org/download.php

2.配置位置

win:安装目录下

linux:在home目录下,如果没有就新建

可以使用我的配置,替换掉图中的两个文件即可,下载地址如下:

链接:https://pan.baidu.com/s/13U_AIwD-tuE5T21cxitjfw 
提取码:9s5m

3.基本配置

3.1.字体和颜色设置

  1. " =============================================================
  2. " 字体和颜色设置
  3. " =============================================================
  4. "自动开启语法高亮"
  5. syntax enable
  6. "设置字体"
  7. set guifont=Monospace\ 13
  8. "设置主题样式"
  9. colorscheme desert
  10. "set background=light
  11. "高亮显示当前行"
  12. set cuc
  13. set cul

3.2.文字处理设置

  1. " =============================================================
  2. " 文字处理设置
  3. " =============================================================
  4. "使用空格来替换Tab"
  5. set expandtab
  6. "设置所有的Tab和缩进为4个空格"
  7. set tabstop=4
  8. "设定<<>>命令移动时的宽度为4"
  9. set shiftwidth=4
  10. "使得按退格键时可以一次删除4个空格"
  11. set softtabstop=4
  12. set smarttab
  13. autocmd FileType make set noexpandtab
  14. "缩进,自动缩进(继承前一行的缩进)"
  15. set autoindent
  16. set cindent
  17. "智能缩进"
  18. set si
  19. "自动换行”
  20. set wrap
  21. "设置软宽度"
  22. set sw=4
  23. "行内替换"
  24. set gdefault

3.3.界面设置

  1. " =============================================================
  2. " 界面设置
  3. " =============================================================
  4. "显示光标位置的状态行"
  5. set ruler
  6. "设置命令行的高度"
  7. set cmdheight=1
  8. "显示行数"
  9. set number
  10. "关闭遇到错误时的声音提示"
  11. "关闭错误信息响铃"
  12. set noerrorbells
  13. "关闭使用可视响铃代替呼叫"
  14. set novisualbell
  15. "高亮显示匹配的括号([{和}])"
  16. set showmatch
  17. "搜索逐字符高亮"
  18. set hlsearch
  19. set incsearch
  20. "搜索时不区分大小写"
  21. set ignorecase
  22. "用浅色高亮显示当前行"
  23. autocmd InsertLeave * se nocul
  24. autocmd InsertEnter * se cul
  25. "输入的命令显示出来,看的清楚"
  26. set showcmd
  27. set autochdir
  28. "打开界面的大小
  29. set lines=30 columns=120

3.4.编码设置

  1. " =============================================================
  2. " 编码设置
  3. " =============================================================
  4. "设置编码"
  5. set encoding=utf-8
  6. set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936,big-5,euc-jp
  7. "设置文件编码"
  8. set fileencodings=utf-8
  9. "设置终端编码"
  10. set termencoding=utf-8
  11. "设置语言编码"
  12. set langmenu=zh_CN.UTF-8
  13. set helplang=cn

3.5.其他设置

  1. " =============================================================
  2. " 其他设置
  3. " =============================================================
  4. "在处理未保存或只读文件的时候,弹出确认"
  5. set confirm
  6. "显示状态栏(默认值为1,表示无法显示状态栏)"
  7. set laststatus=2
  8. "共享剪切板"
  9. set clipboard+=unnamed
  10. "自动保存"
  11. set autowrite
  12. "关闭vi兼容模式"
  13. set nocompatible
  14. set backspace=indent,eol,start
  15. "设置历史记录步数"
  16. set history=1000
  17. "禁止生成临时文件
  18. set nobackup
  19. set noswapfile
  20. "激活鼠标的使用,(类似office中在工作区双击鼠标定位)
  21. set mouse=a
  22. set selection=exclusive
  23. set selectmode=mouse,key

4.插件配置

4.1.插件管理

  1. " -------------------------插件管理----------------------------
  2. call plug#begin()
  3. Plug 'preservim/NERDTree' "目录树
  4. Plug 'bling/vim-airline' "状态栏美化
  5. "Plug 'w0rp/ale' "语法检查,需要vim8.0以上
  6. Plug 'scrooloose/syntastic' "语法检查
  7. Plug 'HonkW93/automatic-verilog' "自动例化
  8. call plug#end()

在终端内打开vim,进入命令模式输入PlugInstall安装插件包

4.2.目录树设置

  1. " -------------------------NERDTree----------------------------
  2. " 目录树窗口尺寸
  3. let g:NERDTreeWinSize = 25
  4. " 忽略以下文件的显示
  5. let NERDTreeIgnore=['\.pyc','\~$','\.swp']
  6. " 显示书签列表
  7. let NERDTreeShowBookmarks=1
  8. " 显示隐藏文件
  9. let NERDTreeShowHidden=1
  10. " 修改默认箭头符号
  11. let g:NERDTreeDirArrowExpandable = '▸'
  12. let g:NERDTreeDirArrowCollapsible = '▾'
  13. " vim启动时自动打开NERDTree
  14. augroup NERDTree
  15. au!
  16. autocmd vimenter * NERDTree
  17. " vim启动打开目录时自动打开NERDTree
  18. autocmd StdinReadPre * let s:std_in=1
  19. autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
  20. autocmd vimenter * NERDTreeFind
  21. " 文件全部关闭时退出NERDTree
  22. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  23. augroup END

4.3.状态栏美化

  1. " -------------------------vim-airline----------------------------
  2. " 显示颜色
  3. set t_Co=256
  4. set laststatus=2
  5. " 使用powerline打过补丁的字体
  6. let g:airline_powerline_fonts = 1

4.4.语法检查ALE,需要vim8.0以上

  1. " -------------------------ale----------------------------
  2. "keep the sign gutter open
  3. let g:ale_sign_column_always = 1
  4. let g:ale_sign_error = '>>'
  5. let g:ale_sign_warning = '--'
  6. " show errors or warnings in my statusline
  7. " self-define statusline
  8. " use quickfix list instead of the loclist
  9. let g:ale_set_loclist = 0
  10. let g:ale_set_quickfix = 1
  11. " only enable these linters
  12. let g:ale_linters = { 'verilog': ['verilator']}

4.5.语法检查syntastic

  1. " 总是打开Location List(相当于QuickFix)窗口
  2. let g:syntastic_always_populate_loc_list = 1
  3. "不自动进行代码检查
  4. let g:syntastic_auto_loc_list = 1
  5. let g:syntastic_check_on_open = 0
  6. let g:syntastic_check_on_wq = 0
  7. "检查语法的编译器
  8. let g:syntastic_verilog_checkers = ['verilator']

4.6.自动例化--automatic-verilog

文件头自动生成:

always块自定义快捷键:

always块自定义格式以及module框架自动生成:

5.自定义快捷键

  1. " =============================================================
  2. " 快捷键设置
  3. " =============================================================
  4. "自定义命令前缀,防止冲突
  5. let mapleader=","
  6. "插入模式退出插入模式ii
  7. imap ii <ESC>
  8. "正常模式下保存,w
  9. nmap <Leader>w :w<CR>
  10. "正常模式下保存退出,q
  11. nmap <Leader>q :q<CR>
  12. "正常模式下保存退出,wq
  13. nmap <Leader>wq :wq<CR>
  14. "正常模式下打开关闭文件目录ctrl+t
  15. nmap <C-t> :NERDTreeToggle<CR>
  16. "正常模式下语法检查,ck
  17. nmap <Leader>ck :SyntasticCheck<CR>
  18. "括号自动补全
  19. :inoremap ( ()<ESC>i
  20. :inoremap ) <c-r>=ClosePair(')')<CR>
  21. :inoremap [ []<ESC>i
  22. :inoremap ] <c-r>=ClosePair(']')<CR>
  23. :inoremap { {<CR>}<ESC>O
  24. :inoremap } <c-r>=ClosePair('}')<CR>
  25. function! ClosePair(char)
  26. if getline('.')[col('.') - 1] == a:char
  27. return "\<Right>"
  28. else
  29. return a:char
  30. endif
  31. endfunction
  32. "配对自动补全,按空格自动补全
  33. :ab case; case()<CR><CR><CR>default: ;<CR>endcase<ESC>kkki
  34. :ab begin; begin<CR><CR>end<ESC>ki
  35. :ab reg; <ESC>0i<Tab>reg<Tab><Tab>[NAME_WIDTH-1:0]<Tab><Tab><Tab>reg_name<Tab>; //<CR>
  36. :ab wire; <ESC>0i<Tab>wire<Tab>[NAME_WIDTH-1:0]<Tab><Tab><Tab>wire_name<Tab>; //<CR>
  37. :ab input; <ESC>0i<Tab>input<Tab><Tab>[NAME_WIDTH-1:0]<Tab><Tab><Tab>input_name<Tab><Tab>, //<CR>
  38. :ab output; <ESC>0i<Tab>output reg<Tab>[NAME_WIDTH-1:0]<Tab><Tab><Tab>output_name<Tab><Tab>, //<CR>
  39. :ab para; <ESC>0i<Tab>parameter<Tab>NAME_WIDTH<Tab><Tab>=<Tab><Tab>8<Tab><Tab>, //<CR>
  40. :ab if; if() begin<CR><CR>end<ESC>ki
  41. :ab elif; else if() begin<CR><CR>end<ESC>ki
  42. :ab else; else begin<CR><CR>end<ESC>ki

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/516710
推荐阅读
相关标签
  

闽ICP备14008679号