Linux
let g:python_host_prog = '/usr/bin/python'
"space replace tab
set ts=4
set softtabstop=4
set shiftwidth=4
set expandtab
"use plug
call plug#begin()
"*************json*******************
Plug 'kevinoid/vim-jsonc'
"gruvbox 主题
Plug 'morhetz/gruvbox'
"*************代码补全*******************
"Use release branch (recommend)
"Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'https://gitee.com/yzhrex/coc.nvim.git', {'branch': 'master'}
"*************状态栏优化*******************
Plug 'liuchengxu/eleline.vim'
"*************效率工具*******************
"vim-autopep8,python自动格式化
Plug 'tell-k/vim-autopep8'
"nerdtree 文件树
Plug 'preservim/nerdtree'
"代码注释
Plug 'preservim/nerdcommenter'
"DeBug
Plug 'puremourning/vimspector'
"括号优化
Plug 'jiangmiao/auto-pairs'
call plug#end()
"*************DEBUG*******************
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
colo gruvbox
"************快捷键设置*******************
"F3 开启关闭文件树
nm <C-b> :NERDTreeToggle<CR>
"设置当前目录为nerdtree的起始目录
let NERDTreeChDirMode=2
"使得窗口有更好看的效果
let NERDChristmasTree=1
"设置窗口宽度为25
"let NERDTreeWinSize=25
"打开一个文件时nerdtree分栏自动关闭
let NERDTreeQuitOnOpen=1
"翻译视图模式选中的单词
vm <C-T> "*y <Esc>:!trans &<CR><CR>
"go代码格式优化加自动导包
au FileType go no <buffer> <a-f> :call CocAction('runCommand', 'editor.action.organizeImport')<CR> :w<CR> :!gofmt -w %<CR> :e<CR>
"添加go源码追踪,需要先安装ctags5.8+ 然后在$GOROOT/src 文件夹下执行命令ctags -R --exclude='cmd/*' --exclude='*test*' . 生成tags文件
au FileType go exe "set tags+=/usr/local/go/src/tags"
"python代码自动格式优化
au FileType python no <buffer> <a-f> :call Autopep8()<CR>
"添加python源码追踪 ctags --languages="Python" --exclude='*test*' -R .
au FileType python exe "set tags+=/usr/lib/python3.8/tags"
"vim-autopep8设置,关闭diff提示
let g:autopep8_disable_show_diff=1
" 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
"Ctrl+/注释
map <C-_> <leader>c<space>
Windows
let g:python3_host_prog = 'C:\Python39\python.exe'
"space replace tab
set ts=4
set softtabstop=4
set shiftwidth=4
set expandtab
"自动加入文件头
autocmd bufnewfile *.py,*.sh so C:\tools\neovim\Neovim\share\nvim\runtime\macros\metadata.vim
autocmd bufnewfile *.py,*.sh exe "1,6g/File Name:.*/s//File Name: " .expand("%")
autocmd bufnewfile *.py,*.sh exe "1,6g/Creation Time:.*/s//Creation Time: " .strftime("%Y-%m-%d %H:%M:%S")
autocmd Bufwritepre,filewritepre *.py,*.sh exe "normal ma"
autocmd Bufwritepre,filewritepre *.py,*.sh exe "1,6g/Last Modified:.*/s//Last Modified: " .strftime("%Y-%m-%d %H:%M:%S")
autocmd bufwritepost,filewritepost *.py,*.sh exe "normal `a"
"有道词典快捷键
vnoremap <silent> <C-T> :<C-u>Ydv<CR>
nnoremap <silent> <C-T> :<C-u>Ydc<CR>
noremap <leader>yd :<C-u>Yde<CR>
" 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
call plug#begin()
Plug 'ianva/vim-youdao-translater'
Plug 'morhetz/gruvbox'
Plug 'bling/vim-airline'
Plug 'scrooloose/nerdtree'
Plug 'tell-k/vim-autopep8'
Plug 'neoclide/coc.nvim'
Plug 'puremourning/vimspector'
Plug 'jiangmiao/auto-pairs'
Plug 'scrooloose/nerdcommenter'
call plug#end()
colorscheme gruvbox
" F3 开启关闭文件树
nnoremap <C-b> :NERDTreeToggle<CR>
"go格式化加自动导包
au FileType go noremap <buffer> <a-f> :call CocAction('runCommand', 'editor.action.organizeImport')<CR> :w<CR> :!gofmt -w %<CR> :e<CR>
au FileType go exe "set tags+=C:/Go/src/tags"
"注释
map <C-_> <leader>c<space>
"python格式化
au FileType python noremap <buffer> <a-f> :call Autopep8()<CR>
au FileType Python exe "set tags+=C:/Python39/lib/tags"
"vim-autopep8设置,关闭diff提示
let g:autopep8_disable_show_diff=1
"*********** NERDTree插件配置 ***********
let NERDTreeChDirMode=2 " 设置当前目录为nerdtree的起始目录
let NERDChristmasTree=1 " 使得窗口有更好看的效果
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'