Open yaohunzhanyue opened 4 years ago
In all of those situations, you could use :execute
to concatenate the variable into the command.
exe "silent !curl -fLo ".g:location_prefix."/nvim/autoload/plug.vim..."
autocmd VimEnter * PlugInstall --sync | exe "source ".g:location_prefix."/nvim/init.vim"
The :map
examples can be done more simply using <expr>
(see :help :map-expression
).
map <expr> ooo "i".g:location_prefix
noremap <expr> <silent> <LEADER>rc ":e ".g:location_prefix."/nvim/init.vim<CR>"
As for the :set
example, you can do it by using :let
instead (options can be accessed as variables prefixed by &
):
let &backupdir = location_prefix."/nvim/tmp/backup,."
https://stackoverflow.com/questions/60703143/how-to-use-vim-variables-the-right-way-in-these-case
vimrc: