自用vscode neovim插件配置文件 init.vim
這樣配置是為了區(qū)分 terminal 中使用 neovim
和在 vscode 中使用 neovim 使用不同的配置文件
$ cat ~/.config/nvim/init.vim文章來源:http://www.zghlxwxcb.cn/news/detail-541513.html
注意 window系統(tǒng)生效的配置文件和
*unix
系統(tǒng)文件生效的配置文件存放不同,window系統(tǒng)的配置是%LocalAppData%\nvim\init.vim
文章來源地址http://www.zghlxwxcb.cn/news/detail-541513.html
" 當(dāng)打開nvim時,若沒有下載vim-plug則自動下載
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source ~/.config/nvim/init.vim
endif
let mapleader=" "
if exists('g:vscode')
" vscode extension
" ----- Plug -----
call plug#begin('~/.vim/plugged')
" 快速跳轉(zhuǎn)
Plug 'asvetliakov/vim-easymotion'
" 包裹修改
Plug 'tpope/vim-surround'
call plug#end()
" 切換行注釋
nnoremap gc <Cmd>call VSCodeNotify('editor.action.commentLine')<CR>
" 切換塊注釋
nnoremap gC <Cmd>call VSCodeNotify('editor.action.blockComment')<CR>
" 展開所有折疊
nnoremap zR <Cmd>call VSCodeNotify('editor.unfoldAll')<CR>
" 關(guān)閉所有折疊
nnoremap zM <Cmd>call VSCodeNotify('editor.foldAll')<CR>
" 展開當(dāng)下折疊
nnoremap zo <Cmd>call VSCodeNotify('editor.unfold')<CR>
" 關(guān)閉當(dāng)下折疊
nnoremap zc <Cmd>call VSCodeNotify('editor.fold')<CR>
" 切換當(dāng)下折疊
nnoremap zz <Cmd>call VSCodeNotify('editor.toggleFold')<CR>
" 轉(zhuǎn)到文件中上一個問題
nnoremap g[ <Cmd>call VSCodeNotify('editor.action.marker.prevInFiles')<CR>
" 轉(zhuǎn)到文件中下一個問題
nnoremap g] <Cmd>call VSCodeNotify('editor.action.marker.nextInFiles')<CR>
" 用H替換掉^
noremap H ^
" 用L替換掉$
noremap L $
" 使用vscode的undo替換nvim的undo
nnoremap u <Cmd>call VSCodeNotify('undo')<CR>
" easymotion相關(guān)配置
let g:EasyMotion_smartcase = 0
" easymotion前綴 leader leader
map <Leader> <Plug>(easymotion-prefix)
" 其他鍵位綁定
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
else
" neovim
inoremap jj <Esc>
endif
到了這里,關(guān)于自用vscode neovim插件配置文件 init.vim的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!