Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim - run :!commands in my .bashrc [duplicate]

Tags:

bash

vim

Possible Duplicate:
Commands executed from vim are not recognizing bash command aliases
Why doesn't my vim know my alias?

say I set alias kapow='grep' in my .bashrc, which I source after.

I open vim, type

:!kapow "dude"

but vim tries to run /bin/bash kapow, when I actually wanted it to run my alias.

How does one run commands from a bashrc inside of vim (without leaving to the :shell)?

like image 385
tester Avatar asked Dec 07 '11 18:12

tester


People also ask

How do you repeat the last command in bash?

Just press the Ctrl and P keys together to fill the prompt with the last executed command and you are ready to go. This method works in bash perfectly even after closing the terminal, but it might not work in zsh after closing the session.

How do I enable VIM mode in bash?

The bash shell (again, via GNU Readline) is able to provide this functionality for us. In order to enable it, you run the command $ set -o vi.

How do I find previous commands in bash?

You can search command from the history by pressing Ctrl+R. When these keys are pressed then a search option will appear. The command will search from the history based on the keypress by the user.


1 Answers

The vim manual says this about :!

On Unix the command normally runs in a non-interactive shell. If you want an interactive shell to be used (to use aliases) set 'shellcmdflag' to "-ic".

like image 137
Mattias Wadman Avatar answered Oct 06 '22 00:10

Mattias Wadman