Sunday, April 3, 2022

Re: sumup some noremap exe command

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

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/b1c280c9-a9b8-4d1c-43eb-70dd0646ed33%40googlemail.com.

No comments:

Post a Comment