Re: sumup some noremap exe command

3 views
Skip to first unread message

Jürgen Krämer

unread,
Apr 4, 2022, 2:21:34 AM4/4/22
to vim...@googlegroups.com
Hi,

Ni Va schrieb am 02.04.2022 um 07:19:
> Is there a way to reduce, simplify and sumpup *those kind of* noremap *command?*
>
> Avoiding *:exe *(due to concatenate luafile + path)
> nnoremap lua  :*exe* 'luafile ' .. expand('%:p')<CR>
>
> Avoiding *double :exe ... <CR>* command ?
> nnoremap lua  *:exe* 'cd ' .. expand('%:p:h')*<CR>  :exe* 'luafile ' .. expand('%:p')*<CR>*
>
you should be able to use %:p directly in an ex command, where a file name can be used (see :help :_%).

So these two commands can be written as

  :nnoremap lua luafile %:p<cr>

and

  :nnoremap lua cd %:p:h<bar>luafile %:p<cr>

Regards,
Jürgen

--
~
~
~
:wq

Reply all
Reply to author
Forward
0 new messages