gvim 配置最终版

点击查看代码
call plug#begin()
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'sqlmap3/tagbar'
Plug 'sqlmap3/vim-snippets'
Plug 'tacahiroy/ctrlp-funky'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'easymotion/vim-easymotion'
Plug 'terryma/vim-multiple-cursors'
Plug 'yggdroot/indentline'
Plug 'garbas/vim-snipmate'
Plug 'sqlmap3/taglist'
Plug 'kien/rainbow_parentheses.vim'
Plug 'marcweber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'luochen1990/rainbow'
Plug 'kien/rainbow_parentheses.vim'
Plug 'sqlmap3/vim-SystemVerilog'
Plug 'dkprice/vim-easygrep'
Plug 'HonkW93/automatic-verilog'
"Plug 'shougo/neocomplcache.vim' " for gvim9
Plug 'morhetz/gruvbox'
Plug 'hardhackerlabs/theme-vim', { 'as': 'hardhacker' }
Plug 'junegunn/vim-easy-align'
Plug 'wesleyche/srcexpl'
Plug 'wesleyche/trinity'
Plug 'itchyny/lightline.vim'
Plug 'mengelbrecht/lightline-bufferline'
Plug 'dstein64/vim-startuptime'
Plug 'ludovicchabant/vim-gutentags'
Plug 'andymass/vim-matchup'
Plug 'fei6409/log-highlight.nvim'
Plug 'girishji/vimcomplete' "for gvim9.03+
Plug 'Donaldttt/fuzzyy'
call plug#end()
"open syntax highlight
syntax enable
syntax on
"indent based on filetype
filetype plugin indent on
filetype on
" no fold
set nofoldenable
set fileformat=unix
set winaltkeys=no
nmap <tab> :bn<cr> "设置tab键映射
nnoremap b :bp<cr>
nnoremap B :bn<cr>
""""""""""rainbow""""""""""""
let g:rainbow_active=1 "0 if you want to enable it later via :RainbowToggle
let g:rainbow_conf = {
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
\ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'],
\ 'guis': [''],
\ 'cterms': [''],
\ 'operators': '_,_',
\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'],
\ 'separately': {
\ '*': {},
\ 'markdown': {
\ 'parentheses_options': 'containedin=markdownCode contained',},
\ 'lisp': {
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'], },
\ 'haskell': {
\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/\v\{\ze[^-]/ end=/}/ fold'], },
\ 'vim': {
\ 'parentheses_options': 'containedin=vimFuncBody', },
\ 'perl': {
\ 'syn_name_prefix': 'perlBlockFoldRainbow', },
\ 'stylus': {
\ 'parentheses': ['start=/{/ end=/}/ fold contains=@colorableGroup'], },
\ 'css': 0
\ }
\}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:lightline_themes = ['one', 'seoul256', 'powerline']
"'colorscheme': s:lightline_themes[localtime()%len(s:lightline_themes)],
let g:lightline = {
"\ 'colorscheme': s:lightline_themes[localtime()%len(s:lightline_themes)],
\ 'colorscheme': 'one',
\ 'active': {
\ 'left' :[[ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly' ],
\ [ 'filename', 'modified' ],['tagbar']],
\ 'right':[[ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'filetype', 'fileencoding', 'fileformat','method','total_lines' ],['tagbar_full']]
\ },
\ 'component': {
\ 'tagbar': '%{tagbar#currenttag("%s","","p")}',
\ 'tagbar_full': '%{tagbar#currenttag("%s","","f")}',
\ 'lineinfo': ' %3l:%-2v',
\ 'filename': '%<%f'
\ },
\ 'component_function': {
\ 'fugitive': 'MyFugitive',
\ 'total_lines': 'TotalLines',
\ 'modified': 'LightLineModified',
\ 'readonly': 'LightLineReadonly',
\ 'filename': 'LightLineFilename',
\ 'fileformat': 'LightLineFileformat',
\ 'filetype': 'LightLineFiletype',
\ 'fileencoding': 'LightLineFileencoding',
\ 'mode': 'LightLineMode'}
\ }
let g:lightline.separator = {
\ 'left': '', 'right': ''
\}
let g:lightline.subseparator = {
\ 'left': '', 'right': ''
\}
let g:lightline.tabline = {
\ 'left': [['buffers']],
"\ 'right': [['close']]
\ 'right': [['string1'], ['string2']]
\}
let g:lightline.component_expand = {
\ 'buffers': 'lightline#bufferline#buffers',
\ 'string1': 'String1',
\ 'string2': 'String2'
\}
let g:lightline.component_type = {
\ 'buffers': 'tabsel'
\}
function! TotalLines()
return line('$') . ' lines'
endfunction
function! String1()
return 'SQLMAP.CN'
endfunction
function! String2()
return 'BUFFERS'
endfunction
function! MyFugitive()
try
if expand('%:t') !~? 'Tagbar\|NERD' && exists('*fugitive#head')
let mark = '' " edit here for cool mark
let _ = fugitive#head()
return strlen(_) ? mark._ : ''
endif
catch
endtry
return ''
endfunction
" autoreload
command! LightlineReload call LightlineReload()
function! LightlineReload()
call lightline#init()
call lightline#colorscheme()
call lightline#update()
endfunction
function! LightLineModified()
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! LightLineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : ''
endfunction
function! LightLineFilename()
let fname = expand('%:t')
return fname == '__Tagbar__' ? g:lightline.fname :
\ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ ('' != fname ? fname : '[No Name]') .
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction
function! LightLineFileformat()
return winwidth(0) > 70 ? &fileformat : ''
endfunction
function! LightLineFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
function! LightLineFileencoding()
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction
function! LightLineMode()
let fname = expand('%:t')
return fname == '__Tagbar__' ? 'Tagbar' :
\ winwidth(0) > 60 ? lightline#mode() : ''
endfunction
let g:tagbar_status_func = 'TagbarStatusFunc'
function! TagbarStatusFunc(current, sort, fname, ...) abort
let g:lightline.fname = a:fname
return lightline#statusline(0)
endfunction
let g:airline#extensions#tagbar#flags = 'f'
let g:lightline#bufferline#unnamed = "[NO NAME]"
let g:lightline#bufferline#filename_modifier= ":."
let g:lightline#bufferline#more_buffers = "..."
let g:lightline#bufferline#modified = ""
let g:lightline#bufferline#read_only = ""
let g:lightline#bufferline#shorten_path = 1
let g:lightline#bufferline#show_number = 2
let g:lightline#bufferline#enable_devicons = 1
let g:lightline#bufferline#unicode_symbols = 1
let g:lightline#bufferline#number_map = {
\ 0: '₀', 1: '₁', 2: '₂', 3: '₃', 4: '₄',
\ 5: '₅', 6: '₆', 7: '₇', 8: '₈', 9: '₉'}
set showtabline=2 " Show tabline
set guioptions-=e " Don't use GUI tabline
""""""""""""""""""""""""""""""""""""""""""tagbar""""""""""""""""""""""""""""""""""""""""
"let g:tagbar_ctags_bin='/opt/homebrew/bin/ctags'
let g:tagbar_autofocus = 1
nmap <silent> <F8> :TagbarToggle<CR>
"let g:tagbar_type_systemverilog = {
" \ 'ctagstype' : 'SystemVerilog',
" \ 'kinds' : [
" \ 'b:blocks:1:1',
" \ 'c:constants:1:0',
" \ 'e:events:0:1',
" \ 'd:defines:0:1',
" \ 'f:functions:1:1',
" \ 'm:modules:0:1',
" \ 'n:nets:1:0',
" \ 'p:ports:1:0',
" \ 'r:registers:1:0',
" \ 't:tasks:1:1',
" \ 'A:asserts:1:1',
" \ 'C:classes:0:1',
" \ 'O:constraints:0:1',
" \ 'Q:prototypes:1:0',
" \ 'V:covergroups:0:1',
" \ 'I:interfaces:0:1',
" \ 'M:modport:0:1',
" \ 'K:packages:0:1',
" \ 'P:programs:0:1',
" \ 'R:properties:1:1',
" \ 'T:typedefs:0:1'
" \ ],
" \ 'sro' : '.',
" \ 'kind2scope' : {
" \ 'm' : 'module',
" \ 'b' : 'block',
" \ 'O' : 'constraint',
" \ 'c' : 'constant',
" \ 'e' : 'event',
" \ 'd' : 'define',
" \ 't' : 'task',
" \ 'f' : 'function',
" \ 'C' : 'class',
" \ 'V' : 'covergroup',
" \ 'I' : 'interface',
" \ 'K' : 'package',
" \ 'P' : 'program',
" \ 'Q' : 'prototype',
" \ 'R' : 'property'
" \ },
" \ }
"
"""""""""""""""""""""""""""""""""""nerdtree"""""""""""""""""""""""""""""""""""""""""""""""
""将F3设置为开关NERDTree的快捷键
"map <F3> :NERDTreeToggle<CR>
""修改树的显示图标
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
let g:NERDTreeIgnore = ['\c^ntuser\..*', '\~$']
""窗口位置
let g:NERDTreeWinPos='left'
""窗口尺寸
let g:NERDTreeSize=32
""窗口是否显示行号
let g:NERDTreeShowLineNumbers=1
""不显示隐藏文件
let g:NERDTreeHidden=0
"当NERDTree为剩下的唯一窗口时自动关闭
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Exit Vim if NERDTree is the only window remaining in the only tab. for vim9
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | call feedkeys(":quit\<CR>:\<BS>") | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | call feedkeys(":quit\<CR>:\<BS>") | endif
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
"autocmd BufEnter * silent if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
let NERDTreeIgnore=['\.pyc','\~$','\.swp']
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "",
\ "Staged" : "",
\ "Untracked" : "",
\ "Renamed" : "",
\ "Unmerged" : "",
\ "Deleted" : "",
\ "Dirty" : "",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
""修改树的显示图标
let g:NERDTreeDirArrowExpandable = '►'
let g:NERDTreeDirArrowCollapsible = '▼'
let NERDTreeAutoCenter=1
" 显示行号
let NERDTreeShowLineNumbers=1
let g:NERDTreeFileLines = 1
let g:NERDTreeDirArrowExpandable = '?'
let g:NERDTreeDirArrowCollapsible = '?'
set wildmenu
set showcmd
"""""""""fold set""""""""""""""""
set foldmethod=syntax
set foldcolumn=2
highlight Folded guibg=grey guifg=blue
highlight FoldColumn guibg=black guifg=white
""""""""""""""""""""""""""ctags""""""""""""""""""""""""""""""""""""""
set tags=tags; "vim首先在当前目录里寻找tags文件,如果没有找到tags文件,就到父目录中查找,一直向上递归
set autochdir " 改变vim的当前目录
"let g:airline_theme='angr'
set tags+=./tags "当前路径下的tags文件
""""""""""""""""""slient update ctags file""""""""""""""""""""""""
"autocmd BufWritePost *.v,*.sv,*.c,*.py,*.pl,*.cpp call system("~/opt/homebrew/bin/ctags -R --fields=+lS &")
"autocmd FileWritePost,BufWritePost *.v,*.sv,*.c,*.py,*.pl,*.cpp call system("opt/homebrew/bin/ctags -R --c-kinds=+px --c++-kinds=+px --systemverilog-kinds=+p --fields=+liafksS --extras=+qf ")
"
"
"
" gutentags 搜索工程目录的标志,碰到这些文件/目录名就停止向上一级目录递归
let g:gutentags_project_root = ['.root']
" 所生成的数据文件的名称
let g:gutentags_ctags_tagfile = '.tags'
" 将自动生成的 tags 文件全部放入 ~/.cache/tags 目录中,避免污染工程目录
let s:vim_tags = expand('~/.cache/tags')
let g:gutentags_cache_dir = s:vim_tags
" 配置 ctags 的参数
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']
" 检测 ~/.cache/tags 不存在就新建
if !isdirectory(s:vim_tags)
silent! call mkdir(s:vim_tags, 'p')
endif
if !executable('ctags')
let g:gutentags_dont_load = 1
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ru
set nu
set nobackup
set noswapfile
set guioptions+=b
set guioptions+=c " 启用居中显示
"""""""""""""""""""""<search setting>"""""""""""""""""""""""
"Override the 'ignorecase' option if the search pattern contains upper
"case characters. Only used when the search pattern is typed and
"'ignorecase' option is on.
set incsearch
set hls
"set ignorecase
set ignorecase smartcase
"set infercase
""""""""""""""""""""<color scheme setting>""""""""""""""""""
""vim color scheme setting
if has("gui_running")
set background=dark
" colorscheme desert
" colorscheme molokai
"colorscheme solarized
colorscheme gruvbox
"colorscheme tokyonight
else
colorscheme hardhacker-darker
endif
"""""""""""""""""""""""""set match pairs"""""""""""""""""""""""
set showmatch
"How many tenths of a second to blink
set matchtime=5
"set guicursor=n:block-blinkoff0
"""""""""""""<set for chinese support>""""""""""""""""""""""""""
":language ja_JP.eucJP
":let &termencoding = &encoding
":set termencoding=euc-jp
set fileencodings=utf-8,gbk,big5,euc-jp,gb2312
""""""""""""""""matchit""""""""""""""""""""""""""""""""""""
let b:match_ignorecase=0
let mapleader="\<Space>"
nmap <leader><leader>a <Esc>gg=G
nnoremap <leader>i :VerilogFollowInstance<CR>
nnoremap <leader>I :VerilogFollowPort<CR>
nnoremap <leader>u :VerilogGotoInstanceStart<CR>
set complete-=k
set viminfo="NONE"
set nobackup
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=200 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
"set incsearch " do incremental searching
set wrap
set textwidth=80
" For indent
set shiftwidth=4
set expandtab
set smarttab
" Don't use Ex mode, use Q for formatting
" map Q gq
noremap Q @q
map gy gT
map gb gT
map <C-j> <C-w>j
map <C-k> <C-w>k
if &t_Co > 2 || has("gui_running")
" syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
" autocmd FileType make setlocal noexpandtab
" autocmd FileType perl setlocal shiftwidth=2
"Ack search results show a mix of relative and absolute paths, making them hard to read
"autocmd BufAdd * execute "cd" fnameescape(getcwd())
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
""""""""""""""""""""""< Taglist setting >""""""""""""""""
"let Tlist_Ctags_Cmd = '/opt/homebrew/bin/ctags'
let Tlist_Show_One_File = 1
let Tlist_Use_Right_Window = 0
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_WinWidt =20
"nnoremap <silent> <F8> :TlistToggle<CR>
""""""""""""""""""""""""< Quickfix Window>""""""""""""
function! GetBufferList()
redir =>buflist
silent! ls
redir END
return buflist
endfunction
function! ToggleList(bufname, pfx)
let buflist = GetBufferList()
for bufnum in map(filter(split(buflist, '\n'), 'v:val =~ "'.a:bufname.'"'), 'str2nr(matchstr(v:val, "\\d\\+"))')
if bufwinnr(bufnum) != -1
exec(a:pfx.'close')
return
endif
endfor
if a:pfx == 'l' && len(getloclist(0)) == 0
echohl ErrorMsg
echo "Location List is Empty."
return
endif
let winnr = winnr()
exec(a:pfx.'open')
if winnr() != winnr
wincmd p
endif
endfunction
nmap <silent> <leader>l :call ToggleList("Location List", 'l')<CR>
nmap <silent> <F7> :call ToggleList("Quickfix List", 'c')<CR>
"nnoremap <C-N> :cn<CR>
"nnoremap <C-P> :cp<CR>
""""""""""""""<For save fold information>""""""""""""""""""""""""""""""""
"au BufWinLeave * mkview
"au BufWinEnter * silent loadview
"""""""""""""<:Gr hello will find all hello,and vertical split window will have >"""""""""""""
command! -bang -nargs=+ Gr let @g=""|execute 'g/<args>/y G'|new|setlocal bt=nofile|put! g|redraw
nnoremap <silent> <Leader>ng :redir @g<CR>:silent g//<CR>:redir END<CR>:new<CR>:setlocal bt=nofile<CR>:put! g<CR>:redraw!<CR>
nnoremap <silent> <Leader>nn :redir @g<CR>:silent execute 'g/'.expand("<cword>").'/'<CR>:redir END<CR>:new<CR>:setlocal bt=nofile<CR>:put! g<CR>:redraw!<CR>
""""""""""""""<Set Foldexpr>""""""""""""""""""""""""""""
function! MyFoldLevel(lnum)
let m_fold = (getline(a:lnum)=~'^\x\+') ? 1 : 0
return m_fold
endfunction
function! ToggleFoldmethod()
if &foldmethod!='manual'
set foldmethod=manual
normal zE
else
set foldmethod=expr
set foldexpr=MyFoldLevel(v:lnum)
endif
endfunction
"command! -bang -nargs=0 Fe set foldmethod=expr|set foldexpr=MyFoldLevel(v:lnum)
nmap <silent> <F9> :call ToggleFoldmethod()<CR>
" Set window size
function! ToggleWinWidth()
if &columns=='100'
set columns=160
else
set columns=100
endif
endfunction
function! ToggleWinHeight()
if &lines!='40'
set lines=40
endif
endfunction
nmap <silent> <F12> :call ToggleWinWidth()<CR>
nmap <silent> <S-F12> :call ToggleWinHeight()<CR>
" Set CursorLine CoursorColumn
function! ToggleCursorLine()
if &cursorline||&cursorcolumn
set nocursorline
set nocursorcolumn
else
set cursorline
set cursorcolumn
endif
endfunction
nmap <silent> <F11> :call ToggleCursorLine()<CR>
nnoremap <silent> <Leader>sv :setfiletype svtb_log<CR>
" Set window font
let s:pattern = '^\(.* \)\([1-9][0-9]*\)$'
let s:minfontsize = 10
let s:maxfontsize = 16
function! AdjustFontSize(amount)
if has("gui_running") && has("gui_gtk2")
let fontname = substitute(&guifont, s:pattern, '\1', '')
let cursize = substitute(&guifont, s:pattern, '\2', '')
let newsize = cursize + a:amount
if (newsize >= s:minfontsize) && (newsize <= s:maxfontsize)
let newfont = fontname . newsize
let &guifont = newfont
endif
else
echoerr "You need to run the GTK2 version of Vim to use this function."
endif
endfunction
let s:FontSizeToggled = 0
function! ToggleWinFont()
if has("gui_running") && has("gui_gtk2")
if s:FontSizeToggled == 0
call AdjustFontSize(2)
let s:FontSizeToggled = 1
else
call AdjustFontSize(-2)
let s:FontSizeToggled = 0
endif
endif
endfunction
nmap <silent> <F10> :call ToggleWinFont()<CR>:redraw!<CR>
let s:ColorSchemeToggled = 0
function! ToggleColorScheme()
if has("gui_running") && has("gui_gtk2")
if s:ColorSchemeToggled == 0
"colorscheme nightfox
colorscheme space-vim-dark
let s:ColorSchemeToggled = 1
elseif s:ColorSchemeToggled == 1
colorscheme codedark
"colorscheme gruvbox
let s:ColorSchemeToggled = 2
elseif s:ColorSchemeToggled == 2
" colorscheme codedark
colorscheme gruvbox
let s:ColorSchemeToggled = 3
elseif s:ColorSchemeToggled == 3
" colorscheme codedark
colorscheme tokyonight
let s:ColorSchemeToggled = 4
else
colorscheme molokai
"colorscheme gruvbox
let s:ColorSchemeToggled = 0
endif
endif
endfunction
nmap <silent> <F6> :call ToggleColorScheme()<CR>:redraw!<CR>
""""""""""""""""""""""<gui_font_setting>""""""""""""""""""
set linespace=1
if has("gui_running")
if has("gui_gtk2")
":set guifont=Bitstream\ Vera\ Sans\ Mono\ 11
":set guifont=Courier\ 16,mendium\ 16
":set guifont=Courier\ 12,fixed\ 12,\ 7x13
" :set guifont=Monospace\ 14
" set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 14 "config font for gvim ”for gvim
set guifont=Meslo\ LG\ S\ DZ\ Regular\ for\ Powerline:h13
elseif has("x11")
"also for GTK 1
" :set guifont=-Courier_10_Pitch-Medium-R-Normal--14-110-70-70-C-75-ISO8859-1
set guifont=Meslo\ LG\ S\ DZ\ Regular\ for\ Powerline:h13
elseif has("gui_win32")
" :set guifont=Luxi_mono:28:cANSI
" set guifont=Consolas:h18
"set guifont=Droid\ Sans\ Mono\ for\ Powerline:h18
set guifont=Fira\ Mono\ for\ Powerline:h18
" set guifont=Meslo:h18
" set guifont=Droid_Sans_Mono_Dotted_for_Powerline:18
endif
endif
"set guifont=Meslo\ LG\ S\ DZ\ Regular\ for\ Powerline:h18
"set guifont=Consolas:h28
"""""""""""""""""""""<status columbar>""""""""""""""""""""""""
set laststatus =2
"highlight StatusLine guifg=SlateBlue guibg=Yellow
highlight StatusLine guifg=SlateBlue guibg=Gray
""""""""""""""""""""""""""<multiple-cursors>""""""""""""""""""""""""""""
let g:multi_cursor_use_default_mapping=0
" Default mapping
let g:multi_cursor_start_word_key = '<C-n>'
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = 'g<C-n>'
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = '<C-n>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
""""""""""""""""""""""""""<EasyMotion>""""""""""""""""""""""""""""
let g:EasyMotion_smartcase = 1
"let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
map <Leader><leader>h <Plug>(easymotion-linebackward)
map <Leader><Leader>j <Plug>(easymotion-j)
map <Leader><Leader>k <Plug>(easymotion-k)
map <Leader><leader>l <Plug>(easymotion-lineforward)
map <Leader><leader>. <Plug>(easymotion-repeat)
"""""""""""""""""""<some common customization settings for GVim>"""""""""""
"exit vim
nmap <c-q> :q <CR>
"save file
nmap <c-s> :w <CR>
""""""""""""""""""""<Setting GVim to center in Linux >""""""""""""""""""""
function! WindowCenterInScreen()
set lines=9999 columns=9999
let g:windowsSizeFixX = 58
let g:windowsSizeFixY = 118
let g:windowsScaleX = 7.75
let g:windowsScaleY = 17.0
let g:windowsPosOldX = getwinposx()
let g:windowsPosOldY = getwinposy()
let g:windowsScreenWidth = float2nr(winwidth(0) * g:windowsScaleX) + g:windowsPosOldX + g:windowsSizeFixX
let g:windowsScreenHeight = float2nr(winheight(0) * g:windowsScaleY) + g:windowsPosOldY + g:windowsSizeFixY
set lines=30 columns=108
let g:windowsSizeWidth = float2nr(winwidth(0) * g:windowsScaleX) + g:windowsSizeFixX
let g:windowsSizeHeight = float2nr(winheight(0) * g:windowsScaleY) + g:windowsSizeFixY
let g:windowsPosX = ((g:windowsScreenWidth - g:windowsSizeWidth) / 2)
let g:windowsPosY = ((g:windowsScreenHeight - g:windowsSizeHeight) / 2)
exec ':winpos ' . g:windowsPosX . ' ' . g:windowsPosY
endfunction
"au GUIEnter * call WindowCenterInScreen()
"""""""""""""""""""""""""""""""""""""""<setting for indentLine>"""""""""""""""""""""""""""
let g:indentLine_color_gui = '#A4E57E'
let g:indentLine_char = '┆'
let g:indentLine_enabled = 1
"""""""""""""""""""""""""""""""""""ctrlp"""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
map <leader>f :CtrlPMRU<CR>
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn|rvm)$',
\ 'file': '\v\.(exe|so|dll|zip|tar|tar.gz|pyc)$',
\ }
let g:ctrlp_working_path_mode=0
let g:ctrlp_match_window_bottom=1
let g:ctrlp_max_height=15
let g:ctrlp_match_window_reversed=0
let g:ctrlp_mruf_max=500
let g:ctrlp_follow_symlinks=1
set wildignore+=*\\node_modules\\*,*.git*,*.svn*,*.zip*,*.exe* " 使用vim的忽略文件
nnoremap <Leader>u :CtrlPFunky<Cr>
" narrow the list down with a word under cursor
nnoremap <Leader>U :execute 'CtrlPFunky ' . expand('<cword>')<Cr>
let g:ctrlp_funky_syntax_highlight = 1
let g:ctrlp_extensions = ['funky']
""""""""""""""""""""""""""""""""""""auto read modify file"""""""""""""""""""""""""""""""""""
set autoread
""""""""""""""""""""modify automatic-verilog by honk.wang""""""""""""""""""""""""""""""""""
let g:atv_snippet_project = 'XXX'
let g:atv_snippet_company = 'XX'
let g:atv_snippet_author = 'XX'
let g:atv_snippet_email = 'xxxx.com'
let g:atv_snippet_website = 'SQLMAP.COM'
let g:atv_snippet_device = 'XXX'
""""""""""""""""""""""""""""""easygrep""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:EasyGrepMode = 2 " All:0, Open Buffers:1, TrackExt:2,
let g:EasyGrepCommand = 0 " Use vimgrep:0, grepprg:1
let g:EasyGrepRecursive = 1 " Recursive searching
let g:EasyGrepIgnoreCase = 1 " not ignorecase:0
let g:EasyGrepFilesToExclude = "*.bak,tags"
" 定义按 Enter 键两次打开 Quickfix 窗口的映射
nnoremap <CR><CR> :copen<CR>
"
""""""""""""""""""Auto complete"""""""""""""""""""""""""""
"set complete=.,w,i,b,u,d,k
"set dictionary=~/.vim/words/uvm_kwords,/ic/eda_tools/synopsys/vcs_vV-2023.12_P/gui/tb/qdbg_sv.ini
"set isfname+={,}
"set isfname-=,
""""""""""""""""""""""""""""""""""""""vim easy align"""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""" EasyAlign Config""""""""""""""""""""""""""""""""""""""
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
" 端口对齐 Align input & output
xmap aa :EasyAlign /input\\|output/<CR> :'<,'>EasyAlign /[/<CR>:'<,'>EasyAlign /:/ <CR>:'<,'>EasyAlign /]/ <CR>:'<,'>EasyAlign /\ \S\+,/ <CR>
"xmap aa :EasyAlign /input\\|output/<CR> :'<,'>EasyAlign /[/<CR>:'<,'>EasyAlign /:/ <CR>:'<,'>EasyAlign /]/ <CR>:'<,'>EasyAlign /\s\+\L*/{'s':0,'l':1}<CR>:'<,'>EasyAlign /,/<CR>
" 例化名对齐 Align instance
xmap ab :EasyAlign /./r0<CR>:'<,'>EasyAlign /(/<CR>:'<,'>EasyAlign /[/<CR>:'<,'>EasyAlign /:/<CR>:'<,'>EasyAlign /]/<CR>:'<,'>EasyAlign /)/<CR>:'<,'>EasyAlign /,/<CR>
" 声明对齐 Align declare wire & reg
xmap ad :EasyAlign /wire\\|reg\\|logic\\|bit\\|int\\byte/<CR>:'<,'>EasyAlign /[/<CR>:'<,'>EasyAlign /:/ <CR>:'<,'>EasyAlign /]/ <CR> :'<,'>EasyAlign /\s\+\L*/{'s':0,'l':1}<CR>:'<,'>EasyAlign /;/ <CR>
"====================================================================
" Trinity Settings
"====================================================================
" Open and close all the three plugins on the same time
nmap <Leader><F8> :TrinityToggleAll<CR>
" Open and close the Source Explorer separately
nmap <Leader><F9> :TrinityToggleSourceExplorer<CR>
" Open and close the Taglist separately
nmap <F8> :TrinityToggleTagList<CR>
" Open and close the NERD Tree separately
nmap <F2> :TrinityToggleNERDTree<CR>
" 设置配置文件夹路径
if has('win32') || has('win64')
let $MYVIMRC = $HOME . "/vimfiles"
let $WORDS_FOLDER = $MYVIMRC . "/words"
elseif has('mac') || has('macunix')
let $MYVIMRC = $HOME . "/.vim"
let $WORDS_FOLDER = $MYVIMRC . "/words"
else
let $MYVIMRC = $HOME . "/.vim" " 默认情况,例如类 Unix 系统
let $WORDS_FOLDER = $MYVIMRC . "/words"
endif
let g:SrcExpl_nextDefKey = "<Leader><F4>"
let g:SrcExpl_prevDefKey = "<Leader><F3>"
"autocmd FileType text set dictionary+=/usr/share/dict/words
autocmd FileType systemverilog set dictionary=${WORDS_FOLDER}/words/uvm_kwords

本文作者:LeslieQ

本文链接:https://www.cnblogs.com/LeslieQ/p/18284656

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   LeslieQ  阅读(44)  评论(0编辑  收藏  举报
(评论功能已被禁用)
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
  1. 1 当你老了 赵照
当你老了 - 赵照
00:00 / 00:00
An audio error has occurred.