Wednesday, July 10, 2019

Re: execute an alias with vim

Le mercredi 10 juillet 2019 05:30:19 UTC-3, Mathieu Roux a écrit :
> Hello,
>
> I use many text files to write many things on my laptop, and i use
> aliases to access them.
> For exemple, suppose that i have the alias "foo" to access ~/bar with
> vim.
>
> alias foo='vim ~/bar'
>
> So it works when i write "foo" in my terminal.
>
> But I also want to use this alias in vim.
> When i am in vim, i do "C-w n" to open one new window.
> And then i try :!foo
>
> But it writes:
>
> "/bin/bash: foo: command not found
>
> le shell a retourné 127"
>
> Can you help me?
> Best regards,
> Mathieu

If you use bash, then define the aliases in `~/.bash_profile` and add

let $BASH_ENV = $HOME.'/.bash_profile'

to your vimrc. See also

http://stackoverflow.com/questions/4642822/commands-executed-from-vim-are-not-recognizing-bash-command-aliases/19819036#19819036

and

and http://unix.stackexchange.com/questions/117467/how-to-permanently-set-environmental-variables/117470#117470


If you use zsh, then add them in `~/.zshenv` (instead of ~/.zshrc`) as well as the line 'setopt aliases'.

--
--
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/cb014739-5208-4d8c-b103-cf70eec66d33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment