Installation and configuration of VIM on Centos7
VIM8 is the latest version, it has a lot of features that can improve our production efficiency, so we take VIM8 as an example here
Preparation before compilation of VIM8
We need to install some plugins, some depend on python, some depend on node.js. So we need to install these two first
install python3
Source code installation, you can download 3.8.x or 3.9.x
wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz
wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz
wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz
To generate a dynamic link library, optimization cannot be turned on
./configure --prefix=/home/harriszh/.local --enable-shared --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions
make -j4
make install
Add /home/harriszh/.local/lib
to LD_LIBRARY_PATH
install gcc9
yum install centos-release-scl -y
yum clean all
yum install devtoolset-9-* -y
It is not recommended to keep it on all the time, only when needed source /opt/rh/devtoolset-9/enable
(requires bash or zsh)
Install node.js
need to use gcc9
Download the source code:
wget https://nodejs.org/dist/v16.15.0/node-v16.15.0.tar.gz
The official requirements are as follows:
gcc and g++ >= 8.3 or newer
GNU Make 3.81 or newer
Python 3.6, 3.7, 3.8, 3.9, or 3.10 (see note above)
For test coverage, your Python installation must include pip.
After decompression
./configuration --prefix=/home/harriszh/.local
make -j4
make install
install powerline
pip3 install --user git+https://github.com/powerline/powerline
install vim
Then install vim with source code
git clone https://github.com/vim/vim.git
cd vim/src
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp \
--enable-python3interp \
--with-python3-config-dir=/home/harriszh/.local/lib/python3.8/config-3.8m-x86_64-linux-gnu/ \
--with-python3-command=/home/harriszh/.local/bin/python3 \
--enable-perlinterp \
--enable-luainterp \
--with-lua_prefix=/home/harriszh/.local \
--enable-gui=gtk2 --enable-cscope
make && make install
Ripgrep
Install RUST first
curl https://sh.rustup.rs -sSf | sh
Then enter all the way
Install rigpre with RUST
cargo install ripgrep
By default it is placed in ~/.cargo/bin
direct copy
The easiest way is to copy a rg executable from someone else
fd
cargo install fd-find
By default it is placed in ~/.cargo/bin
fzf
fzf install
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
fzf configuration
#fzf
export LD_LIBRARY_PATH=/usr/local/lib:/lib64:/usr/lib64:/usr/lib:/lib
if [ ${CURSHELL} = "bash" ]; then
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
elif [ ${CURSHELL} = "zsh" ]; then
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
fi
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_CTRL_T_DEFAULT_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND='rg --sort-files --files --null 2> /dev/null | xargs -0 dirname | uniq'
#Use fd instead of the default find command for listing candidates
_fzf_compgen_path() {
rg -g "" -- "$1"
}
# Use fd to generate the list for directory completion
_fzf_compgen_dir() {
fd --type d --hidden --follow --exclude ".git" . "$1"
}
# repeat history
fh() {
eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
}
# fd - cd to selected directory
fd() {
local dir
dir=$(fd ${1:-.} --type d -print 2> /dev/null | fzf +m) &&
cd "$dir"
}
# fda - including hidden directories
fda() {
local dir
dir=$(fd ${1:-.} --type d 2> /dev/null | fzf +m) && cd "$dir"
}
fzfp() {
fzf --preview '[[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || (rougify {} || highlight -O ansi -l {} || coderay {} || cat {}) 2> /dev/null | head -500'
}
# click Ctrl-X+Ctrl-R to execute
fzf-history-widget-accept() {
fzf-history-widget
zle accept-line
}
zle -N fzf-history-widget-accept
bindkey '^X^R' fzf-history-widget-accept
# interactive cd
source ~/.fzf/shell/zsh-interactive-cd.zshrc
Install vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
If you can't download it, manually download ---2407ff0d64f9f9ed1181365247306ce4--- from https://github.com/junegunn/vim-plug
and put it in plug.vim
~/.vim/autoload
Then add it to ~/.vimrc
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'yianwillis/vimcdoc'
Plug 'honza/vim-snippets'
let s:my_loading_vim_snippets = 1
Plug 'zhuzhzh/verilog_emacsauto.vim'
Plug 'junegunn/fzf', { 'dir':'~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
let s:my_loading_fzf = 1
if version >= 800
if is_win
Plug 'liuchengxu/vim-clap', { 'do': { -> clap#installer#force_download() } }
else
Plug 'liuchengxu/vim-clap', { 'do': ':Clap install-binary' }
endif
let s:my_loading_vim_clap = 1
Plug 'dense-analysis/ale', { 'for': ['cpp', 'c']}
let s:my_loading_ale = 1
Plug 'neoclide/coc.nvim', {'branch': 'release'}
let s:my_coc_nvim = 1
Plug 'nanotee/zoxide.vim'
let s:my_loading_zoxide = 1
Plug 'Yggdroot/LeaderF', {'do': ':LeaderfInstallCExtension'}
let s:my_loading_leaderf = 1
Plug 'skywind3000/asyncrun.vim'
let s:my_loading_asyncrun = 1
endif
Plug 'preservim/nerdtree', {'on': 'NERDTreeToggle'}
let s:my_loading_nerdtree = 1
Plug 'junegunn/vim-easy-align'
let s:my_loading_vimeasyalign = 1
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
call plug#end()
After exiting vim, enter vim again, enter :PlugInstall
Configure the plugin
powerline
if !is_win
python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup
endif
vim-clap
"-----------------------------------------------------------------------------
" plugin - vim-clap
"-----------------------------------------------------------------------------
if exists("s:my_loading_vim_clap")
let g:clap_theme = 'material_design_dark'
let g:clap_builtin_fuzzy_filter_threshold = 0
noremap <Leader>ff :Clap files<cr>
noremap <Leader>ft :Clap tags<cr>
noremap <Leader>fl :Clap lines<cr>
noremap <Leader>fh :Clap history<cr>
noremap <Leader>fb :Clap buffers<cr>
noremap <Leader>fc :Clap colors<cr>
noremap <Leader>fg :Clap grep<cr>
noremap <Leader>fj :Clap jumps<cr>
noremap <Leader>fm :Clap marks<cr>
noremap <Leader>fq :Clap quickfix<cr>
noremap <Leader>fd :Clap dumb_jump<cr>
noremap <Leader>fr :Clap filer<cr>
noremap <Leader>fo :Clap gfiles<cr>
noremap <Leader>fu :Clap git_diff_files<cr>
endif
"------------------------END vim-clap--------------------------------------
LeaderF
Optional also fzf.vim
"-----------------------------------------------------------------------------
" plugin - LeaderF
"-----------------------------------------------------------------------------
if exists("s:my_loading_leaderf")
" don't show the help in normal mode
let g:Lf_HideHelp = 1
let g:Lf_UseCache = 0
let g:Lf_UseVersionControlTool = 0
let g:Lf_IgnoreCurrentBufferName = 1
" popup mode
let g:Lf_WindowPosition = 'popup'
let g:Lf_PreviewInPopup = 1
let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2", 'font': "MesloLGS Nerd Font Mono" }
let g:Lf_PreviewResult = {'Function': 0, 'BufTag': 0 }
let g:Lf_ShowDevIcons = 1
let g:Lf_DevIconsFont = "MesloLGS Nerd Font Mono"
let g:Lf_ShortcutF = "<leader>ff"
noremap <leader>fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR>
noremap <leader>fm :<C-U><C-R>=printf("Leaderf mru %s", "")<CR><CR>
noremap <leader>ft :<C-U><C-R>=printf("Leaderf bufTag %s", "")<CR><CR>
noremap <leader>fl :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR>
noremap <leader>fc :<C-U><C-R>=printf("Leaderf! rg --current-buffer -e %s ", expand("<cword>"))<CR>
noremap <leader>fa :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR>
" search visually selected text literally
xnoremap gf :<C-U><C-R>=printf("Leaderf! rg -F -e %s ", leaderf#Rg#visual())<CR>
noremap go :<C-U>Leaderf! rg --recall<CR>
" should use `Leaderf gtags --update` first
let g:Lf_GtagsAutoGenerate = 0
let g:Lf_Gtagslabel = 'native-pygments'
noremap <leader>fg :<C-U><C-R>=printf("Leaderf! gtags --update")<CR><CR>
noremap <leader>fr :<C-U><C-R>=printf("Leaderf! gtags -r %s --auto-jump", expand("<cword>"))<CR><CR>
noremap <leader>fd :<C-U><C-R>=printf("Leaderf! gtags -d %s --auto-jump", expand("<cword>"))<CR><CR>
noremap <leader>fo :<C-U><C-R>=printf("Leaderf! gtags --recall %s", "")<CR><CR>
noremap <leader>fn :<C-U><C-R>=printf("Leaderf gtags --next %s", "")<CR><CR>
noremap <leader>fp :<C-U><C-R>=printf("Leaderf gtags --previous %s", "")<CR><CR>
let g:Lf_ShowHidden = 1
let g:Lf_RgConfig = [
\ "--hidden",
\ "--no-messages",
\ "--color never",
\ "--no-ignore"
\ ]
let g:Lf_WildIgnore = {
\ 'dir': ['.root','.svn','.git','.hg','.ccls-cache'],
\ 'file': ['*.sw?','~$*', '*swp', '*.bak','*.exe','*.o','*.so','*.py[co]']
\}
let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git', '.root']
endif
"------------------------END LeaderF--------------------------------------
coc.nvim
"-----------------------------------------------------------------------------
" plugin -coc.nvim
"-----------------------------------------------------------------------------
if exists("s:my_coc_nvim")
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
"let g:coc_snippet_next = '<tab>'
" Use <C-l> for trigger snippet expand.
imap <C-l> <Plug>(coc-snippets-expand)
" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'
" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)
" Use <leader>x for convert visual selected code to snippet
xmap <leader>x <Plug>(coc-convert-snippet)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gD <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
" Using Coc-explorer
noremap <leader>ee :CocCommand explorer<CR>
" Close Coc-explorer if it is the only window
autocmd BufEnter * if (&ft == 'coc-explorer' && winnr("$") == 1) | q | endif
autocmd CursorHold * silent call CocActionAsync('highlight')
" Run the Code Lens action on the current line.
nmap <leader>cl <Plug>(coc-codelens-action)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <leader>ca :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <leader>ce :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <leader>cc :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <leader>co :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <leader>cs :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <leader>cj :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <leader>ck :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <leader>cp :<C-u>CocListResume<CR>
command! SvBuildIndex call CocRequest("svlangserver", 'workspace/executeCommand', {'command': 'systemverilog.build_index'})
command! -range SvReportHierarchy call CocRequest("svlangserver", 'workspace/executeCommand', {'command': 'systemverilog.report_hierarchy', 'arguments': [input('Module/interface: ', <range> == 0 ? "" : expand("<cword>"))]})
endif
"----------------------END coc.nvim--------------------------------------
vista.vim
vista relies on ctags with json output
if exists("s:my_loading_vista")
" How each level is indented and what to prepend.
" This could make the display more compact or more spacious.
" e.g., more compact: ["▸ ", ""]
" Note: this option only works for the kind renderer, not the tree renderer.
let g:vista_icon_indent = ["╰─▸ ", "├─▸ "]
" Executive used when opening vista sidebar without specifying it.
" See all the avaliable executives via `:echo g:vista#executives`.
let g:vista_default_executive = 'ctags'
" To enable fzf's preview window set g:vista_fzf_preview.
" The elements of g:vista_fzf_preview will be passed as arguments to fzf#vim#with_preview()
" For example:
let g:vista_fzf_preview = ['right:50%']
" Ensure you have installed some decent font to show these pretty symbols, then you can enable icon for the kind.
let g:vista#renderer#enable_icon = 1
" The default icons can't be suitable for all the filetypes, you can extend it as you wish.
let g:vista#renderer#icons = {
\ "function": "\uf794",
\ "variable": "\uf71b",
\ }
nnoremap <leader>vt :Vista ctags<CR>
nnoremap <leader>vo :Vista coc<CR>
nnoremap <leader>vft :Vista finder ctags<CR>
nnoremap <leader>vfo :Vista finder coc<CR>
endif
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。