1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Use vim.cmd instead of vim.api.nvim_exec

This commit is contained in:
jdhao 2021-07-24 12:45:54 +08:00
parent 4ff301a728
commit edd74337a9

View File

@ -1,4 +1,3 @@
local execute = vim.api.nvim_command
local fn = vim.fn local fn = vim.fn
local packer_install_dir = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' local packer_install_dir = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
@ -16,8 +15,8 @@ local install_cmd = string.format('10split |term git clone --depth=1 %s %s', pac
-- Auto-install packer in case it hasn't been installed. -- Auto-install packer in case it hasn't been installed.
if fn.glob(packer_install_dir) == '' then if fn.glob(packer_install_dir) == '' then
vim.api.nvim_echo({{'Installing packer.nvim', 'Type'}}, true, {}) vim.api.nvim_echo({{'Installing packer.nvim', 'Type'}}, true, {})
execute(install_cmd) vim.cmd(install_cmd)
execute 'packadd packer.nvim' vim.cmd('packadd packer.nvim')
end end
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
@ -284,9 +283,9 @@ require('packer').startup(
} }
}) })
vim.api.nvim_exec([[ vim.cmd([[
augroup packer_auto_compile augroup packer_auto_compile
autocmd! autocmd!
autocmd BufWritePost */nvim/lua/plugins.lua source <afile> | PackerCompile autocmd BufWritePost */nvim/lua/plugins.lua source <afile> | PackerCompile
augroup END augroup END
]], false) ]])